]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
a skeletal print_usage() function
authorRoger Dingledine <arma@torproject.org>
Mon, 20 Oct 2003 01:19:54 +0000 (01:19 +0000)
committerRoger Dingledine <arma@torproject.org>
Mon, 20 Oct 2003 01:19:54 +0000 (01:19 +0000)
svn:r634

src/or/config.c
src/or/main.c

index 977af49816d135134cadf63b4ca0eb9d4991181c..c1733905ef3456c0597e132a55302fbdcfa6789d 100644 (file)
@@ -191,6 +191,10 @@ static void config_assign(or_options_t *options, struct config_line *list) {
   }  
 }
 
+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;
@@ -215,6 +219,11 @@ int getconfig(int argc, char **argv, or_options_t *options) {
   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;
   while(i < argc-1 && strcmp(argv[i],"-f")) {
index dd42865c4edadb723124f7f7365525c5a60f9fc7..44194438999014fe57b04ec2e4632356d010d2e7 100644 (file)
@@ -784,7 +784,7 @@ int tor_main(int argc, char *argv[]) {
   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 */