Changeset 72cf064 in mainline for kernel/generic/src/console/kconsole.c
- Timestamp:
- 2012-08-13T17:17:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33fee91
- Parents:
- f4a8734 (diff), 4820360 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/kconsole.c
rf4a8734 r72cf064 202 202 * 203 203 */ 204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t * 204 NO_TRACE static int cmdtab_compl(char *input, size_t size, indev_t *indev) 205 205 { 206 206 const char *name = input; 207 207 208 208 size_t found = 0; 209 /* Maximum Match Length : Length of longest matching common substring in 210 case more than one match is found */ 209 210 /* 211 * Maximum Match Length: Length of longest matching common 212 * substring in case more than one match is found. 213 */ 211 214 size_t max_match_len = size; 212 215 size_t max_match_len_tmp = size; … … 229 232 } 230 233 231 /* If possible completions are more than MAX_TAB_HINTS, ask user whether to display them or not. */ 234 /* 235 * If the number of possible completions is more than MAX_TAB_HINTS, 236 * ask the user whether to display them or not. 237 */ 232 238 if (found > MAX_TAB_HINTS) { 233 239 printf("\n"); 234 continue_showing_hints = console_prompt_display_all_hints(indev, found); 240 continue_showing_hints = 241 console_prompt_display_all_hints(indev, found); 235 242 } 236 243 … … 240 247 while (cmdtab_search_one(name, &pos)) { 241 248 cmd_info_t *hlp = list_get_instance(pos, cmd_info_t, link); 242 249 243 250 if (continue_showing_hints) { 244 251 printf("%s (%s)\n", hlp->name, hlp->description); 245 252 --hints_to_show; 246 253 ++total_hints_shown; 247 248 if (hints_to_show == 0 && total_hints_shown != found) { /* Time to ask user to continue */ 249 continue_showing_hints = console_prompt_more_hints(indev, &hints_to_show); 254 255 if ((hints_to_show == 0) && (total_hints_shown != found)) { 256 /* Ask user to continue */ 257 continue_showing_hints = 258 console_prompt_more_hints(indev, &hints_to_show); 250 259 } 251 260 } 252 261 253 262 pos = pos->next; 254 for(max_match_len_tmp = 0; output[max_match_len_tmp] == hlp->name[input_len + max_match_len_tmp] 255 && max_match_len_tmp < max_match_len; ++max_match_len_tmp); 263 264 for (max_match_len_tmp = 0; 265 (output[max_match_len_tmp] == 266 hlp->name[input_len + max_match_len_tmp]) && 267 (max_match_len_tmp < max_match_len); ++max_match_len_tmp); 268 256 269 max_match_len = max_match_len_tmp; 257 270 } 258 /* keep only the characters common in all completions */ 271 272 /* Keep only the characters common in all completions */ 259 273 output[max_match_len] = 0; 260 274 } … … 310 324 continue; 311 325 312 /* Find the beginning of the word 313 and copy it to tmp */ 326 /* 327 * Find the beginning of the word 328 * and copy it to tmp 329 */ 314 330 size_t beg; 315 331 for (beg = position - 1; (beg > 0) && (!isspace(current[beg])); … … 333 349 continue; 334 350 335 /* We have hints, may be many. In case of more than one hint, 336 tmp will contain the common prefix. */ 351 /* 352 * We have hints, possibly many. In case of more than one hint, 353 * tmp will contain the common prefix. 354 */ 337 355 size_t off = 0; 338 356 size_t i = 0; … … 340 358 if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE)) 341 359 break; 360 342 361 i++; 343 362 }
Note:
See TracChangeset
for help on using the changeset viewer.