Changeset 8f335a8 for zcrypt.c


Ignore:
Timestamp:
Apr 19, 2013, 3:22:54 AM (8 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master
Children:
0625919
Parents:
5175cf8
git-author:
Anders Kaseorg <andersk@mit.edu> (04/10/13 00:19:44)
git-committer:
Anders Kaseorg <andersk@mit.edu> (04/19/13 03:22:54)
Message:
zcrypt: Accept --help

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zcrypt.c

    r5175cf8 r8f335a8  
    1616#include <sys/wait.h>
    1717#include <ctype.h>
     18#include <limits.h>
    1819#include <getopt.h>
    1920
     
    117118}
    118119
     120void usage(FILE *file, const char *progname)
     121{
     122  fprintf(file, "Usage: %s [-Z|-D|-E|-R|-S] [-F Keyfile] [-c class] [-i instance]\n", progname);
     123  fprintf(file, "       [-advqtluon] [-s signature] [-f arg] [-m message]\n");
     124  fprintf(file, "  One or more of class, instance, and keyfile must be specified.\n");
     125}
     126
    119127int main(int argc, char *argv[])
    120128{
     
    135143  enum {
    136144    OPT_VERSION = CHAR_MAX + 1,
     145    OPT_HELP,
    137146  };
    138147  static const struct option options[] = {
    139148    {"version", no_argument, NULL, OPT_VERSION},
     149    {"help", no_argument, NULL, OPT_HELP},
    140150    {NULL, 0, NULL, 0}
    141151  };
     
    148158        /* Version */
    149159        printf("This is zcrypt version %s\n", OWL_VERSION_STRING);
     160        exit(0);
     161      case OPT_HELP:
     162        /* Help */
     163        usage(stdout, argv[0]);
    150164        exit(0);
    151165      case 'Z':
     
    280294  if (error || !cryptspec)
    281295  {
    282     fprintf(stderr, "Usage: %s [-Z|-D|-E|-R|-S] [-F Keyfile] [-c class] [-i instance]\n", argv[0]);
    283     fprintf(stderr, "       [-advqtluon] [-s signature] [-f arg] [-m message]\n");
    284     fprintf(stderr, "  One or more of class, instance, and keyfile must be specified.\n");
     296    usage(stderr, argv[0]);
    285297    exit(1);
    286298  }
Note: See TracChangeset for help on using the changeset viewer.