/* * STevie - ST editor for VI enthusiasts. ...Tim Thompson...twitch!tjt... */ #include #include #include "stevie.h" readcmdline(firstc) int firstc; /* either ':', '/', or '?' */ { int c; char buff[100]; char *p, *q, *cmd, *arg; gotocmd(1,1,firstc); p = buff; if ( firstc != ':' ) *p++ = firstc; /* collect the command string, handling '\b' and @ */ for ( ; ; ) { c = vgetc(); if ( c=='\n'||c=='\r'||c==EOF ) break; if ( c=='\b' ) { if ( p > buff ) { p--; /* I know this is gross, but it has the */ /* advantage of relying only on 'gotocmd' */ gotocmd(1,0,firstc==':'?':':0); for ( q=buff; q