Project

General

Profile

« Previous | Next » 

Revision b9a4e090

Added by Hamish Coleman over 16 years ago

  • ID b9a4e090a2470bf1b2902af0f28f9590ebe75882

More cmdline processing hacks

View differences:

wconsd.c
BOOL com_autoclose=TRUE;
BOOL com_state=FALSE; // FALSE=closed,TRUE=open
int default_tcpport = 9600;
int default_tcpport = 23;
/* Service status: our current status, and handle on service manager */
SERVICE_STATUS wconsd_status;
......
}
for (i = 0; i < size; i++) {
if (buf[i] == 127 || buf[i]==8) { // backspace
if (buf[i]==0) {
// strange, I'm not expecting nul bytes !
continue;
} else if (buf[i] == 127 || buf[i]==8) {
// backspace
if (linelen > 0) {
send(cs,"\x7f",1,0);
linelen--;
} else {
send(cs,"\x07",1,0); // bell
}
} else if (buf[i] == 10) {
// ignore LF chars
continue;
} else if (buf[i] == 13) { // cr
} 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) {
continue;
}
line[linelen]=0; // ensure string is terminated
menu = process_menu_line(line);
......
send(cs,"> ",2,0);
linelen=0;
continue;
} else if (buf[i]==0xff) {
// telnet option packet
// skip next two bytes as well
i+=2;
continue;
} else {
// other chars
if (linelen < MAXLEN - 1) {
......
} else {
send(cs,"\x07",1,0); // bell
}
continue;
}
}
}
......
// if we have decided to run as a console app..
if (console_application) {
int r;
printf("wconsd: Console Application Mode\n");
printf("wconsd: Console Application Mode (version %s)\n",VERSION);
r=wconsd_init(argc,argv,&err);
if (r!=0) {
printf("wconsd: debug: init failed, return code %d [%d]\n",r, err);

Also available in: Unified diff