head 1.3; access; symbols petidomo-2-2:1.1.1.1 petidomo:1.1.1; locks; strict; comment @ * @; 1.3 date 2000.12.15.15.48.00; author simons; state dead; branches; next 1.2; 1.2 date 2000.12.13.15.35.14; author simons; state Exp; branches; next 1.1; 1.1 date 2000.12.13.13.19.22; author simons; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2000.12.13.13.19.22; author simons; state Exp; branches; next ; desc @@ 1.3 log @ - Removed all debugging code. Now that Petidomo will be "rewritten" in C++, I need a new paradigm for debugging anyway and the old solution of mine was to messy for my taste anyway. - Petidomo no longer cares under what name it has been started. The different modes of operation will now be distinguished by a mandatory command line parameter. @ text @/* $Source: /d1/e/petidomo/cvs/petidomo/source/argvSetDebugLevel.c,v $ $Revision: 1.2 $ Copyright (C) 2000 by CyberSolutions GmbH, Germany. This file is part of OpenPetidomo. OpenPetidomo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. OpenPetidomo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include #include #include #include "debug.h" #include "libargv/argv.h" #ifdef DEBUG extern const char * const ModuleTable[]; /* This routine is a convenient way to enable or disable various debugging modules according to the wishes of the user. It takes a result array from argv_process(3), parses the contents and set the debug level of the specified modules accordingly. The provided array must contain zero or more options describing how the debug level should be set. Each string must be of the form 'module,level', 'module/level' or 'module:level', for example: 'rfcparse,5'. argvSetDebugLevel() will then set the debug level of the module 'rfcparse' to '5'. In order to be able to map the name of a debug module to the according internal module number, argvSetDebugLevel() expects an array string pointers of the name 'ModuleTable', which lists all available module names in the order in which they have been assigned an id number. This array will typically be provided by the main() routine of the caller. RETURNS: In case of an error, -1 is returned. A return code of 0 indicates success. REQUIRES: extern const char * const ModuleTable[] */ /* let's define ModuleTable here */ MODULE_TABLE int argvSetDebugLevel(argv_array_t debug /* parameter array as returned by the argv routines */ ) { char * ModuleName; char * DebugLevel; unsigned int count, i; for (count = 0; count < debug.aa_entry_n; count++) { ModuleName = strtok(ARGV_ARRAY_ENTRY(debug, char *, count), ",/:"); DebugLevel = strtok(NULL, ",/:"); if (ModuleName == NULL || DebugLevel == NULL || atoi(DebugLevel) < 0 || atoi(DebugLevel) > 9) { fprintf(stderr, "\"%s\" is not a valid debug-level specification.\n", ARGV_ARRAY_ENTRY(debug, char *, count)); return -1; } for (i = 0; ModuleTable[i] != NULL; i++) { if (!strcasecmp(ModuleName, ModuleTable[i])) { setDebugLevel(i, atoi(DebugLevel)); break; } } if (ModuleTable[i] == NULL) { fprintf(stderr, "\"%s\" is not a valid debug-module name.\n", ModuleName); return -1; } } return 0; } #endif @ 1.2 log @ - Added correct GNU GPL copyright statements to the files. - Removed unnecessary include statements. @ text @d2 2 a3 2 $Source$ $Revision$ @ 1.1 log @Initial revision @ text @d2 17 a18 9 * $Source: /usr/local/libdata/cvs/simons/petidomo/src/petidomo/argvSetDebugLevel.c,v $ * $Revision: 1.1 $ * $Date: 1997/12/09 21:23:21 $ * * Copyright (C) 1996,97 CyberSolutions GmbH. * All rights reserved. * * - Set debug-level for various modules from the command line. */ d23 2 a24 2 #include #include d54 4 d66 1 a66 1 for (count = 0; count < debug.aa_entryn; count++) { @ 1.1.1.1 log @Imported Petidomo 2.2 as found on www.petidomo.com. @ text @@