Beispiel #1
0
/****************************************************************************
parse the debug levels from smbcontrol. Example debug level parameter:
  printdrivers:7
****************************************************************************/
BOOL debug_parse_params(char **params, int *debuglevel_class)
{
	int   i, ndx;
	char *class_name;
	char *class_level;
	
	/* Set the new debug level array to the current DEBUGLEVEL array */
	memcpy(debuglevel_class, DEBUGLEVEL_CLASS, sizeof(DEBUGLEVEL_CLASS));

	/* Allow DBGC_ALL to be specifies w/o requiring its class name e.g."10"  
	 * v.s. "all:10", this is the traditional way to set DEBUGLEVEL 
	 */
	if (isdigit((int)params[0][0])) {
		debuglevel_class[DBGC_ALL] = atoi(params[0]);
		i = 1; /* start processing at the next params */
	}
	else
		i = 0; /* DBGC_ALL not specified  OR calss name was included */

	/* Fill in new debug class levels */
	for (; i < DBGC_LAST && params[i]; i++) {
		if ((class_name=strtok(params[i],":")) &&
			(class_level=strtok(NULL, "\0")) &&
            ((ndx = debug_lookup_classname(class_name)) != -1)) {
				debuglevel_class[ndx] = atoi(class_level);
		} else {
			DEBUG(0,("debug_parse_params: unrecognized debug class name or format [%s]\n", params[i]));
			return False;
		}
	}

	return True;
}
Beispiel #2
0
/****************************************************************************
parse the debug levels from smbcontrol. Example debug level parameter:
  printdrivers:7
****************************************************************************/
static BOOL debug_parse_params(char **params)
{
    int   i, ndx;
    char *class_name;
    char *class_level;

    if (!params)
        return False;

    /* Allow DBGC_ALL to be specified w/o requiring its class name e.g."10"
     * v.s. "all:10", this is the traditional way to set DEBUGLEVEL
     */
    if (isdigit((int)params[0][0])) {
        DEBUGLEVEL_CLASS[DBGC_ALL] = atoi(params[0]);
        DEBUGLEVEL_CLASS_ISSET[DBGC_ALL] = True;
        i = 1; /* start processing at the next params */
    }
    else
        i = 0; /* DBGC_ALL not specified OR class name was included */

    /* Fill in new debug class levels */
    for (; i < debug_num_classes && params[i]; i++) {
        if ((class_name=strtok(params[i],":")) &&
                (class_level=strtok(NULL, "\0")) &&
                ((ndx = debug_lookup_classname(class_name)) != -1)) {
            DEBUGLEVEL_CLASS[ndx] = atoi(class_level);
            DEBUGLEVEL_CLASS_ISSET[ndx] = True;
        } else {
            DEBUG(0,("debug_parse_params: unrecognized debug class name or format [%s]\n", params[i]));
            return False;
        }
    }

    return True;
}