Project

General

Profile

« Previous | Next » 

Revision 211ce618

Added by Hamish Coleman over 15 years ago

  • ID 211ce61879a3f9c4435a2fc90041d58d65c203fd

Move the console mode handling inside the SCM for increased consistancy

View differences:

wconsd.c
WSADATA wsaData;
int err;
if (sd->mode==SVC_CONSOLE) {
/* We are running in a command-line mode */
dprintf_to_stdout=1;
dprintf(1,"\n"
"wconsd: Serial Console server (version %s)\n",VERSION);
dprintf(1,
" (see http://wob.zot.org/2/wiki/wconsd for more info)\n\n");
dprintf(1,"wconsd: Foreground mode\n");
}
/* setup the libcli early so that modules can use it */
if (!(cli = cli_init())) {
dprintf(1,"wconsd: wconsd_init: failed run cli_init\n");
......
// debug info for when I test this as a service
dprintf(1,"wconsd: started with argc==%i\n",argc);
if (argc==1 || argc==0) {
/* assume that our messages are going to the debug log */
dprintf_to_stdout=0;
// assume that our messages are going to the debug log
dprintf_to_stdout=0;
if (SCM_Start(&sd)!=SVC_CONSOLE) {
return 0;
}
// fall through and try running as a command-line application
}
// We are running in debug mode (or any other command-line mode)
dprintf_to_stdout=1;
dprintf(1,"\n"
"wconsd: Serial Console server (version %s)\n",VERSION);
dprintf(1,
" (see http://wob.zot.org/2/wiki/wconsd for more info)\n\n");
/* we are running as a console app so simulate the SCM */
/* TODO - this could all be done inside the *-scm.c code */
int r=wconsd_init(argc,argv);
if (r!=0) {
dprintf(1,"wconsd: wconsd_init failed, return code %d\n",r);
if (SCM_Start(&sd,argc,argv)!=SVC_OK) {
dprintf(1,"Service startup failed\n");
return 1;
}
dprintf(1,"wconsd: Foreground mode\n");
wconsd_main(0);
return 0;
}

Also available in: Unified diff