* Read in an extended command, doing command line completion. We * stop when we have found enough characters to make a unique command. */
| 289 | * stop when we have found enough characters to make a unique command. |
| 290 | */ |
| 291 | int |
| 292 | tty_get_ext_cmd(void) |
| 293 | { |
| 294 | char buf[BUFSZ]; |
| 295 | int nmatches; |
| 296 | int *ecmatches = 0; |
| 297 | boolean (*no_hook)(char *base) = (boolean (*)(char *)) 0; |
| 298 | char extcmd_char[2]; |
| 299 | |
| 300 | if (iflags.extmenu) |
| 301 | return extcmd_via_menu(); |
| 302 | |
| 303 | suppress_history = TRUE; |
| 304 | /* maybe a runtime option? |
| 305 | * hooked_tty_getlin("#", buf, |
| 306 | * (flags.cmd_comp && !gi.in_doagain) |
| 307 | * ? ext_cmd_getlin_hook |
| 308 | * : (getlin_hook_proc) 0); |
| 309 | */ |
| 310 | extcmd_char[0] = extcmd_initiator(), extcmd_char[1] = '\0'; |
| 311 | buf[0] = '\0'; |
| 312 | hooked_tty_getlin(extcmd_char, buf, |
| 313 | !gi.in_doagain ? ext_cmd_getlin_hook : no_hook); |
| 314 | (void) mungspaces(buf); |
| 315 | |
| 316 | nmatches = (buf[0] == '\0' || buf[0] == '\033') ? -1 |
| 317 | : extcmds_match(buf, ECM_IGNOREAC | ECM_EXACTMATCH, &ecmatches); |
| 318 | if (nmatches != 1) { |
| 319 | if (nmatches != -1) |
| 320 | pline("%s%.60s: unknown extended command.", |
| 321 | visctrl(extcmd_char[0]), buf); |
| 322 | return -1; |
| 323 | } |
| 324 | |
| 325 | return ecmatches[0]; |
| 326 | } |
| 327 | |
| 328 | #endif /* TTY_GRAPHICS */ |
| 329 |
nothing calls this directly
no test coverage detected