Revision 0bcbd4d3
Added by Hamish Coleman over 17 years ago
- ID 0bcbd4d3614a72f7cbfa4590f59fec763232600c
| wconsd.c | ||
|---|---|---|
|
BOOL menu=TRUE;
|
||
|
WORD i;
|
||
|
|
||
|
int skip_lf=0;
|
||
|
|
||
|
unsigned long zero=0;
|
||
|
|
||
|
send_header(cs);
|
||
| ... | ... | |
|
} else if (buf[i] == 127 || buf[i]==8) {
|
||
|
// backspace
|
||
|
if (linelen > 0) {
|
||
|
send(cs,"\x7f",1,0);
|
||
|
send(cs,"\x08",1,0);
|
||
|
linelen--;
|
||
|
} else {
|
||
|
send(cs,"\x07",1,0); // bell
|
||
| ... | ... | |
|
} else if (buf[i] == 0x0d || buf[i]==0x0a) {
|
||
|
// detected cr or lf
|
||
|
|
||
|
// if this is a zero length line, just ignore it
|
||
|
if (linelen==0) {
|
||
|
if (buf[i]==0x0a && skip_lf==1) {
|
||
|
skip_lf=0;
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
line[linelen]=0; // ensure string is terminated
|
||
|
if (buf[i]==0x0d) {
|
||
|
skip_lf=1;
|
||
|
}
|
||
|
|
||
|
menu = process_menu_line(line);
|
||
|
// echo the endofline
|
||
|
// FIXME - dont do this if linemode is on
|
||
|
send(cs,"\r\n",2,0);
|
||
|
|
||
|
if (!menu) {
|
||
|
return 0;
|
||
|
if (linelen!=0) {
|
||
|
line[linelen]=0; // ensure string is terminated
|
||
|
menu = process_menu_line(line);
|
||
|
if (!menu) {
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
send(cs,"> ",2,0);
|
||
| ... | ... | |
|
continue;
|
||
|
} else {
|
||
|
// other chars
|
||
|
skip_lf=0;
|
||
|
|
||
|
if (linelen < MAXLEN - 1) {
|
||
|
line[linelen] = buf[i];
|
||
|
linelen++;
|
||
Also available in: Unified diff
More cmdline processing fiddling