From: Peep P. <so...@us...> - 2004-03-21 12:35:30
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18758/src Modified Files: main.c Log Message: Debuglevel can be set with option -d=x. Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- main.c 21 Mar 2004 08:51:05 -0000 1.13 +++ main.c 21 Mar 2004 12:24:59 -0000 1.14 @@ -19,6 +19,8 @@ */ #include "config.h" +#include "compile_options.h" + #include <stdio.h> #include <time.h> #include <signal.h> @@ -98,12 +100,15 @@ #endif } +#define JUMPTONEXT() if(argv[i][j+1] == '=') { i++; if(i < argc) goto next_i; else return; } + void parse_args(int argc, char **argv) { int i, j; int confs_provided = 0; for(i=1;i<argc;i++) { +next_i: if(argv[i][0] == '-') { int len = strlen(argv[i]); for(j=1;j<len;j++) { @@ -118,11 +123,17 @@ break; case 'd': #ifdef DEBUG - conf.debuglevel++; + if(argv[i][j+1] == '=') { + conf.debuglevel = atoi(argv[i]+j+2); + JUMPTONEXT() + } else { + conf.debuglevel++; + } #else - if(!conf.debuglevel) { + if(conf.debuglevel >= 0) { printf("-d only works if the driver is compiled with debugging on.\n"); conf.debuglevel = -1; + JUMPTONEXT() } #endif break; |