Use a saner variant for computing the number of groups in cpuctl tests
[ltp-debian.git] / pan / debug.c
bloba89303cd69fd95f9f7c05614e0d10d43299bd999
1 /*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
26 * http://www.sgi.com
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
33 /* $Id: debug.c,v 1.1 2000/09/21 21:35:06 alaffin Exp $ */
34 #include <stdio.h>
35 #include <string.h>
36 #include "reporter.h"
39 #ifdef DEBUGGING
40 int Debug[MAXDEBUG]; /* Debug level in their areas */
41 #endif
44 * set debug areas & levels
46 * Syntax: area[,area]:level[,area[,area]:level]...
48 int
49 set_debug(char *optarg)
51 #ifdef DEBUGGING
52 /* pointers to the debug area and level in the option's arguments */
53 char *d_area, *d_level;
54 /* debug area and level after converted to integers */
55 int db_area, db_level;
57 d_area = optarg;
59 while(*d_area) {
60 d_level= strchr(d_area,':');
61 *d_level++ = '\0';
62 db_level= atoi(d_level);
63 db_area=atoi(d_area);
65 if(db_area > MAXDEBUG) {
66 printf("Error - Debug area %s > maximum of %d\n", d_area,
67 MAXDEBUG);
68 exit(-1);
71 while(d_area != NULL) {
72 db_area = atoi(d_area);
73 printf("Debug area %d set to %d\n", db_area, db_level);
74 Debug[db_area] = db_level;
75 if((d_area = strchr(d_area, ',')) != NULL)
76 d_area++;
78 if( (d_area = strchr(d_level, ',')) == NULL )
79 break;
81 #else
82 printf("Debugging is not enabled. -D has been ignored\n");
83 #endif
85 return 0;