[Autosec-devel] sonar/src sonar.c,1.28,1.29 sonar.h,1.28,1.29
Brought to you by:
red0x
From: <ph...@us...> - 2004-02-03 01:52:05
|
Update of /cvsroot/autosec/sonar/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22416 Modified Files: sonar.c sonar.h Log Message: Added numeric arguments to the verbosity flag Index: sonar.c =================================================================== RCS file: /cvsroot/autosec/sonar/src/sonar.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** sonar.c 29 Jan 2004 23:43:52 -0000 1.28 --- sonar.c 3 Feb 2004 01:49:57 -0000 1.29 *************** *** 24,28 **** --- 24,31 ---- #include <assert.h> + #include <getopt.h> #include <stdarg.h> + #include <errno.h> + #include "types.h" #include "sonar.h" *************** *** 39,46 **** #endif - #ifdef HAVE_GETOPT_H - # include <getopt.h> - #endif - static const char rcsid[] = "\100$ autosec/sonar: $Id$"; --- 42,45 ---- *************** *** 122,125 **** --- 121,125 ---- int cur = 0, opt = 0, ret, opt_ind = 1; int plugin_selected = 0, i; + int verbosity=0; target_t *first_target; struct timeval ts, te; *************** *** 165,169 **** } ! while((opt = getopt_long(argc, argv, "vqrfd:c:s:i:o:p:w:t:h:be:?", optionsTable, &opt_ind)) >= 0) { // core options, handled first --- 165,170 ---- } ! while((opt = getopt_long(argc, argv, "v::qrfd:c:s:i:o:p:w:t:h:be:?", ! optionsTable, &opt_ind)) >= 0) { // core options, handled first *************** *** 291,296 **** break; case 'v': ! if(mthis.sCon.iVerbose == 0) ! mthis.sCon.iVerbose++; log_write(LOG_DBUG, "verbosity = %d;\n", mthis.sCon.iVerbose); --- 292,307 ---- break; case 'v': ! if(optarg!=NULL) { ! verbosity=atoi(optarg); ! if(errno==EINVAL) ! verbosity=0; ! if(errno==LONG_MIN) ! verbosity=-1; ! if(errno==LONG_MAX) ! verbosity=MAX_VERBOSE; ! mthis.sCon.iVerbose=verbosity; ! } else { ! mthis.sCon.iVerbose=1; ! } log_write(LOG_DBUG, "verbosity = %d;\n", mthis.sCon.iVerbose); Index: sonar.h =================================================================== RCS file: /cvsroot/autosec/sonar/src/sonar.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** sonar.h 29 Jan 2004 23:43:52 -0000 1.28 --- sonar.h 3 Feb 2004 01:49:57 -0000 1.29 *************** *** 24,27 **** --- 24,29 ---- /// Ok #define SONAR_OK 1 + // Trying to avoid magic numbers + #define MAX_VERBOSE 5 /* #define DEFAULT_OPTIONS {"fork", 'f', POPT_ARG_NONE, 0, 'd', \ |