Changeset a6480d5 in mainline for uspace/app/bdsh/compl.c
- Timestamp:
- 2011-08-21T11:44:59Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 25c1b2c, bd5f3b7, d1e196f7
- Parents:
- c22531fc (diff), 1877128 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Martin Sucha <> (2011-08-21 11:44:59)
- git-committer:
- Martin Decky <martin@…> (2011-08-21 11:44:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/compl.c
rc22531fc ra6480d5 99 99 tokenizer_t tok; 100 100 token_t tokens[WORD_MAX]; 101 unsignedint current_token;101 int current_token; 102 102 size_t tokens_length; 103 103 … … 127 127 128 128 /* Find the current token */ 129 for (current_token = 0; current_token < tokens_length; current_token++) { 129 for (current_token = 0; current_token < (int) tokens_length; 130 current_token++) { 130 131 token_t *t = &tokens[current_token]; 131 132 size_t end = t->char_start + t->char_length; … … 137 138 } 138 139 } 139 140 if (tokens[current_token].type != TOKTYPE_SPACE) { 140 if (tokens_length == 0) current_token = -1; 141 142 if (current_token >= 0 && tokens[current_token].type != TOKTYPE_SPACE) { 141 143 *cstart = tokens[current_token].char_start; 142 144 } … … 154 156 goto error; 155 157 } 156 157 str_ncpy(prefix, pref_size + 1, stext + 158 tokens[current_token].byte_start, pref_size); 158 prefix[pref_size] = 0; 159 160 if (current_token >= 0) { 161 str_ncpy(prefix, pref_size + 1, stext + 162 tokens[current_token].byte_start, pref_size); 163 } 159 164 160 165 /* … … 166 171 /* Skip any whitespace before current token */ 167 172 int prev_token = current_token - 1; 168 if (prev_token != -1&& tokens[prev_token].type == TOKTYPE_SPACE) {173 if (prev_token >= 0 && tokens[prev_token].type == TOKTYPE_SPACE) { 169 174 prev_token--; 170 175 } … … 174 179 * follows a pipe token. 175 180 */ 176 if (prev_token == -1|| tokens[prev_token].type == TOKTYPE_SPACE)181 if (prev_token < 0 || tokens[prev_token].type == TOKTYPE_SPACE) 177 182 cs->is_command = true; 178 183 else
Note:
See TracChangeset
for help on using the changeset viewer.