jbig2dec
Ralph Giles <[email protected]> Mon, 15 Jul 2002 16:50:49 -0700
| Newsgroups | gmane.comp.printing.ghostscript.jbig2dec.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jbig2dec/jbig2dec
In directory usw-pr-cvs1:/tmp/cvs-serv26515
Modified Files:
jbig2dec.c
Log Message:
implement --version
Index: jbig2dec.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2dec.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- jbig2dec.c 15 Jul 2002 20:01:01 -0000 1.32
+++ jbig2dec.c 15 Jul 2002 23:50:47 -0000 1.33
@@ -52,6 +52,9 @@
char *output_file;
} jbig2dec_params_t;
+static int print_version(void);
+static int print_usage(void);
+
/* page hashing functions */
static void
hash_init(jbig2dec_params_t *params)
@@ -111,6 +114,7 @@
{
static struct option long_options[] = {
{"quiet", 0, NULL, 'q'},
+ {"version", 0, NULL, 'V'},
{"help", 0, NULL, 'h'},
{"dump", 0, NULL, 'd'},
{"hash", 0, NULL, 'm'},
@@ -122,10 +126,10 @@
while (1) {
option = getopt_long(argc, argv,
- "qhdo:", long_options, &option_idx);
+ "qVh?do:", long_options, &option_idx);
if (option == -1) break;
- fprintf(stderr, "option '%c' value '%s'\n", option, optarg);
+ //fprintf(stderr, "option '%c' value '%s'\n", option, optarg);
switch (option) {
case 0: // unknown long option
if (!params->verbose) fprintf(stdout,
@@ -139,6 +143,12 @@
case '?':
params->mode = usage;
break;
+ case 'V':
+ /* the GNU Coding Standards suggest --version should
+ override all other options */
+ print_version();
+ exit(0);
+ break;
case 'd':
params->mode=dump;
break;
@@ -158,6 +168,13 @@
}
static int
+print_version (void)
+{
+ fprintf(stdout, "%s %s\n", PACKAGE, VERSION);
+ return 0;
+}
+
+static int
print_usage (void)
{
fprintf(stderr,
@@ -175,6 +192,7 @@
" -q --quiet suppress diagnostic output\n"
" -d --dump print the structure of the jbig2 file\n"
" rather than explicitly decoding\n"
+ " --version program name and version information\n"
" --hash print a hash of the decode document\n"
" -o <file> send decoded output to <file>\n"
" Defaults to the the input with a different\n"