- Timestamp:
- Apr 19, 2013, 3:23:18 AM (10 years ago)
- Parents:
- 487cc2b (diff), 0625919 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zcrypt.c
r6249a88f r8f335a8 16 16 #include <sys/wait.h> 17 17 #include <ctype.h> 18 #include <limits.h> 19 #include <getopt.h> 18 20 19 21 #include <config.h> … … 26 28 27 29 #include "filterproc.h" 30 31 #ifndef OWL_VERSION_STRING 32 #ifdef GIT_VERSION 33 #define stringify(x) __stringify(x) 34 #define __stringify(x) #x 35 #define OWL_VERSION_STRING stringify(GIT_VERSION) 36 #else 37 #define OWL_VERSION_STRING PACKAGE_VERSION 38 #endif 39 #endif /* !OWL_VERSION_STRING */ 28 40 29 41 /* Annotate functions in which the caller owns the return value and is … … 106 118 } 107 119 120 void 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 108 127 int main(int argc, char *argv[]) 109 128 { … … 116 135 int mode = M_NONE; 117 136 118 charc;137 int c; 119 138 120 139 int messageflag = FALSE; … … 122 141 zoptions.flags = 0; 123 142 124 while ((c = getopt(argc, argv, "ZDERSF:c:i:advqtluons:f:m")) != (char)EOF) 143 enum { 144 OPT_VERSION = CHAR_MAX + 1, 145 OPT_HELP, 146 }; 147 static const struct option options[] = { 148 {"version", no_argument, NULL, OPT_VERSION}, 149 {"help", no_argument, NULL, OPT_HELP}, 150 {NULL, 0, NULL, 0} 151 }; 152 153 while ((c = getopt_long(argc, argv, "ZDERSF:c:i:advqtluons:f:m", options, NULL)) != -1) 125 154 { 126 155 switch(c) 127 156 { 157 case OPT_VERSION: 158 /* Version */ 159 printf("This is zcrypt version %s\n", OWL_VERSION_STRING); 160 exit(0); 161 case OPT_HELP: 162 /* Help */ 163 usage(stdout, argv[0]); 164 exit(0); 128 165 case 'Z': 129 166 /* Zephyr encrypt */ … … 257 294 if (error || !cryptspec) 258 295 { 259 fprintf(stderr, "Usage: %s [-Z|-D|-E|-R|-S] [-F Keyfile] [-c class] [-i instance]\n", argv[0]); 260 fprintf(stderr, " [-advqtluon] [-s signature] [-f arg] [-m message]\n"); 261 fprintf(stderr, " One or more of class, instance, and keyfile must be specified.\n"); 296 usage(stderr, argv[0]); 262 297 exit(1); 263 298 }
Note: See TracChangeset
for help on using the changeset viewer.