Changeset f737c1d5 in mainline
- Timestamp:
- 2011-08-21T10:53:08Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b9ae539
- Parents:
- 6045ecf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/compl.c
r6045ecf rf737c1d5 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.