Changeset 6a75c134 in mainline
- Timestamp:
- 2016-03-08T09:21:14Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a363016
- Parents:
- 83b2e73
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/console/kconsole.h
r83b2e73 r6a75c134 88 88 /** Function for printing detailed help. */ 89 89 void (* help)(void); 90 /** Function for enumerating hints for arguments. */ 91 hints_enum_func_t hints_enum; 90 92 } cmd_info_t; 91 93 -
kernel/generic/src/console/kconsole.c
r83b2e73 r6a75c134 286 286 } 287 287 288 NO_TRACE static cmd_info_t *parse_cmd(const wchar_t *cmdline) 289 { 290 size_t start = 0; 291 size_t end; 292 char *tmp; 293 294 while (isspace(cmdline[start])) 295 start++; 296 end = start + 1; 297 while (!isspace(cmdline[end])) 298 end++; 299 300 tmp = malloc(STR_BOUNDS(end - start + 1), 0); 301 302 wstr_to_str(tmp, end - start + 1, &cmdline[start]); 303 304 spinlock_lock(&cmd_lock); 305 306 list_foreach(cmd_list, link, cmd_info_t, hlp) { 307 spinlock_lock(&hlp->lock); 308 309 if (str_cmp(hlp->name, tmp) == 0) { 310 spinlock_unlock(&hlp->lock); 311 spinlock_unlock(&cmd_lock); 312 free(tmp); 313 return hlp; 314 } 315 316 spinlock_unlock(&hlp->lock); 317 } 318 319 free(tmp); 320 spinlock_unlock(&cmd_lock); 321 322 return NULL; 323 } 324 288 325 NO_TRACE static wchar_t *clever_readline(const char *prompt, indev_t *indev) 289 326 { … … 345 382 if (beg == 0) { 346 383 /* Command completion */ 347 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev, cmdtab_enum); 384 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev, 385 cmdtab_enum); 348 386 } else { 349 /* Symbol completion */ 350 found = symtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev); 387 /* Arguments completion */ 388 cmd_info_t *cmd = parse_cmd(current); 389 if (!cmd || !cmd->hints_enum) 390 continue; 391 found = cmdtab_compl(tmp, STR_BOUNDS(MAX_CMDLINE), indev, 392 cmd->hints_enum); 351 393 } 352 394
Note:
See TracChangeset
for help on using the changeset viewer.