1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* http://www.i-scream.org |
4 |
+ |
* Copyright (C) 2000-2002 i-scream |
5 |
+ |
* |
6 |
+ |
* This program is free software; you can redistribute it and/or |
7 |
+ |
* modify it under the terms of the GNU General Public License |
8 |
+ |
* as published by the Free Software Foundation; either version 2 |
9 |
+ |
* of the License, or (at your option) any later version. |
10 |
+ |
* |
11 |
+ |
* This program is distributed in the hope that it will be useful, |
12 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
+ |
* GNU General Public License for more details. |
15 |
+ |
* |
16 |
+ |
* You should have received a copy of the GNU General Public License |
17 |
+ |
* along with this program; if not, write to the Free Software |
18 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
+ |
*/ |
20 |
+ |
|
21 |
+ |
#ifdef HAVE_CONFIG_H |
22 |
+ |
#include "config.h" |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#include <stdio.h> |
26 |
|
#include <string.h> |
27 |
|
#include <sys/ioctl.h> |
34 |
|
#include <sys/times.h> |
35 |
|
#include <limits.h> |
36 |
|
#include <time.h> |
37 |
+ |
|
38 |
+ |
#ifdef HAVE_NCURSES_H |
39 |
+ |
#include <ncurses.h> |
40 |
+ |
#else |
41 |
|
#include <curses.h> |
42 |
+ |
#endif |
43 |
|
|
44 |
|
typedef struct{ |
45 |
|
cpu_percent_t *cpu_percents; |
352 |
|
return 1; |
353 |
|
} |
354 |
|
|
355 |
+ |
void version_num(char *progname){ |
356 |
+ |
fprintf(stderr, "%s version %s\n", progname, PACKAGE_VERSION); |
357 |
+ |
fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); |
358 |
+ |
exit(1); |
359 |
+ |
} |
360 |
+ |
|
361 |
+ |
void usage(char *progname){ |
362 |
+ |
fprintf(stderr, "Usage: %s [-d delay] [-v] [-h]\n\n", progname); |
363 |
+ |
fprintf(stderr, " -d Sets the update time in seconds\n"); |
364 |
+ |
fprintf(stderr, " -v Prints version number\n"); |
365 |
+ |
fprintf(stderr, " -h Displays this help information.\n"); |
366 |
+ |
fprintf(stderr, "\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); |
367 |
+ |
exit(1); |
368 |
+ |
|
369 |
+ |
} |
370 |
+ |
|
371 |
|
int main(int argc, char **argv){ |
372 |
|
|
373 |
|
extern char *optarg; |
385 |
|
|
386 |
|
int delay=2; |
387 |
|
|
388 |
< |
while ((c = getopt(argc, argv, "d:")) != EOF){ |
388 |
> |
while ((c = getopt(argc, argv, "vhd:")) != EOF){ |
389 |
|
switch (c){ |
390 |
|
case 'd': |
391 |
|
delay = atoi(optarg); |
395 |
|
} |
396 |
|
delay--; |
397 |
|
break; |
398 |
+ |
case 'v': |
399 |
+ |
version_num(argv[0]); |
400 |
+ |
break; |
401 |
+ |
case 'h': |
402 |
+ |
default: |
403 |
+ |
usage(argv[0]); |
404 |
+ |
return 1; |
405 |
+ |
break; |
406 |
+ |
|
407 |
|
} |
408 |
|
} |
409 |
|
|