Changes in uspace/app/bdsh/compl.c [f737c1d5:e14a103] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/compl.c
rf737c1d5 re14a103 99 99 tokenizer_t tok; 100 100 token_t tokens[WORD_MAX]; 101 int current_token;101 unsigned 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 < (int) tokens_length; 130 current_token++) { 129 for (current_token = 0; current_token < tokens_length; current_token++) { 131 130 token_t *t = &tokens[current_token]; 132 131 size_t end = t->char_start + t->char_length; … … 138 137 } 139 138 } 140 if (tokens_length == 0) current_token = -1; 141 142 if (current_token >= 0 && tokens[current_token].type != TOKTYPE_SPACE) { 139 140 if (tokens[current_token].type != TOKTYPE_SPACE) { 143 141 *cstart = tokens[current_token].char_start; 144 142 } … … 156 154 goto error; 157 155 } 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 } 156 157 str_ncpy(prefix, pref_size + 1, stext + 158 tokens[current_token].byte_start, pref_size); 164 159 165 160 /* … … 171 166 /* Skip any whitespace before current token */ 172 167 int prev_token = current_token - 1; 173 if (prev_token >= 0&& tokens[prev_token].type == TOKTYPE_SPACE) {168 if (prev_token != -1 && tokens[prev_token].type == TOKTYPE_SPACE) { 174 169 prev_token--; 175 170 } … … 179 174 * follows a pipe token. 180 175 */ 181 if (prev_token < 0|| tokens[prev_token].type == TOKTYPE_SPACE)176 if (prev_token == -1 || tokens[prev_token].type == TOKTYPE_SPACE) 182 177 cs->is_command = true; 183 178 else
Note:
See TracChangeset
for help on using the changeset viewer.