1 /* source: procan_main.c */
2 /* Copyright Gerhard Rieger 2001-2008 */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 const char copyright
[] = "procan by Gerhard Rieger - send bug reports to socat@dest-unreach.org";
7 #include <stdlib.h> /* strtoul() */
18 static void procan_usage(FILE *fd
);
21 int main(int argc
, const char *argv
[]) {
24 unsigned int n
= 1024; /* this is default on my Linux */
27 diag_set('p', strchr(argv
[0], '/') ? strrchr(argv
[0], '/')+1 : argv
[0]);
29 arg1
= argv
+1; --argc
;
30 while (arg1
[0] && (arg1
[0][0] == '-')) {
33 case '?': case 'h': procan_usage(stdout
); exit(0);
34 #endif /* WITH_HELP */
35 case 'c': procan_cdefs(stdout
); exit(0);
37 case 'V': procan_version(stdout
); exit(0);
38 case 'l': diag_set(arg1
[0][2], &arg1
[0][3]); break;
39 case 'd': diag_set('d', NULL
); break;
42 case 'n': n
= strtoul(&arg1
[0][2], NULL
, 0); break;
46 diag_set_int('e', E_FATAL
);
47 Error1("unknown option \"%s\"", arg1
[0]);
53 if (arg1
[0][1] == '\0')
58 Error1("%d superfluous arguments", argc
);
71 static void procan_usage(FILE *fd
) {
72 fputs(copyright
, fd
); fputc('\n', fd
);
73 fputs("Analyze system parameters of process\n", fd
);
74 fputs("Usage:\n", fd
);
75 fputs("procan [options]\n", fd
);
76 fputs(" options:\n", fd
);
78 fputs(" -V print version information to stdout, and exit\n", fd
);
81 fputs(" -?|-h print a help text describing command line options\n", fd
);
83 fputs(" -c print values of compile time C defines\n", fd
);
85 fputs(" -d increase verbosity (use up to 4 times; 2 are recommended)\n", fd
);
88 fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd
);
89 fputs(" -lf<logfile> log to file\n", fd
);
90 fputs(" -ls log to stderr (default if no other log)\n", fd
);
93 fputs(" -n<fdnum> first file descriptor number not analyzed\n", fd
);
96 #endif /* WITH_HELP */