[or-cvs] a skeletal print_usage() function
Roger Dingledine
arma at seul.org
Mon Oct 20 01:19:56 UTC 2003
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
config.c main.c
Log Message:
a skeletal print_usage() function
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- config.c 15 Oct 2003 18:50:16 -0000 1.59
+++ config.c 20 Oct 2003 01:19:54 -0000 1.60
@@ -191,6 +191,10 @@
}
}
+void print_usage(void) {
+
+}
+
/* return 0 if success, <0 if failure. */
int getconfig(int argc, char **argv, or_options_t *options) {
struct config_line *cl;
@@ -214,6 +218,11 @@
options->NewCircuitPeriod = 60; /* once a minute */
options->TotalBandwidth = 800000; /* at most 800kB/s total sustained incoming */
options->NumCpus = 1;
+
+ if(argc > 1 && (!strcmp(argv[1], "-h") || !strcmp(argv[1],"--help"))) {
+ print_usage();
+ exit(0);
+ }
/* learn config file name, get config lines, assign them */
i = 1;
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- main.c 18 Oct 2003 00:13:08 -0000 1.137
+++ main.c 20 Oct 2003 01:19:54 -0000 1.138
@@ -784,7 +784,7 @@
add_stream_log(LOG_INFO, "<stdout>", stdout);
if(getconfig(argc,argv,&options)) {
- log_fn(LOG_ERR,"Reading config file failed. exiting.");
+ log_fn(LOG_ERR,"Reading config failed. For usage, try -h.");
return -1;
}
log_set_severity(options.loglevel); /* assign logging severity level from options */
More information about the tor-commits
mailing list