chiark / gitweb /
@@ -9,6 +9,9 @@
[adns] / client / adnslogres.c
index 44a185c7b0f588e3d38a7f098e99e7ef8c70e736..3f7a4e9fe5933fb58b76e815f76a5c195a8ddc2f 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 static const char * const cvsid =
  */
 
 static const char * const cvsid =
-       "$Id: adnslogres.c,v 1.18 2000/09/17 00:24:24 ian Exp $";
+       "$Id: adnslogres.c,v 1.19 2000/09/17 00:43:10 ian Exp $";
 
 #include <sys/types.h>
 #include <sys/time.h>
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -218,9 +218,13 @@ static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) {
   adns_finish(adns);
 }
 
   adns_finish(adns);
 }
 
-static void usage(void) {
-  fprintf(stderr, "usage: %s [-d] [-p] [-c concurrency] [-C config] [logfile]\n",
+static void printhelp(FILE *file) {
+  fprintf(file, "usage: %s [-d] [-p] [-c concurrency] [-C config] [logfile]\n",
          progname);
          progname);
+}
+
+static void usage(void) {
+  printhelp(stderr);
   exit(1);
 }
 
   exit(1);
 }
 
@@ -229,6 +233,12 @@ int main(int argc, char *argv[]) {
   extern char *optarg;
   FILE *inf;
 
   extern char *optarg;
   FILE *inf;
 
+  if (argv[1] && !strcmp(argv[1],"--help")) {
+    printhelp(stdout);
+    if (ferror(stdout) || fclose(stdout)) { perror("stdout"); exit(1); }
+    exit(0);
+  }
+
   maxpending= DEFMAXPENDING;
   opts= 0;
   while ((c= getopt(argc, argv, "c:C:dp")) != -1)
   maxpending= DEFMAXPENDING;
   opts= 0;
   while ((c= getopt(argc, argv, "c:C:dp")) != -1)