1 /* [argparse.c wk 17.06.97] Argument Parser for option handling
2 * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
28 #include "libjnlib-config.h"
30 #include "stringhelp.h"
35 /*********************************
40 * char *argc; pointer to argc (value subject to change)
41 * char ***argv; pointer to argv (value subject to change)
42 * unsigned flags; Global flags (DO NOT CHANGE)
43 * int err; print error about last option
44 * 1 = warning, 2 = abort
45 * int r_opt; return option
46 * int r_type; type of return value (0 = no argument found)
57 * } internal; DO NOT CHANGE
62 * const char *long_opt;
66 * int arg_parse( ARGPARSE_ARGS *arg, ARGPARSE_OPTS *opts );
69 * This is my replacement for getopt(). See the example for a typical usage.
71 * Bit 0 : Do not remove options form argv
72 * Bit 1 : Do not stop at last option but return other args
73 * with r_opt set to -1.
74 * Bit 2 : Assume options and real args are mixed.
75 * Bit 3 : Do not use -- to stop option processing.
76 * Bit 4 : Do not skip the first arg.
77 * Bit 5 : allow usage of long option with only one dash
78 * Bit 6 : ignore --version
79 * all other bits must be set to zero, this value is modified by the
80 * function, so assume this is write only.
81 * Local flags (for each option):
82 * Bit 2-0 : 0 = does not take an argument
83 * 1 = takes int argument
84 * 2 = takes string argument
85 * 3 = takes long argument
86 * 4 = takes ulong argument
87 * Bit 3 : argument is optional (r_type will the be set to 0)
88 * Bit 4 : allow 0x etc. prefixed values.
89 * Bit 7 : this is a command and not an option
90 * You stop the option processing by setting opts to NULL, the function will
93 * Returns the args.r_opt or 0 if ready
94 * r_opt may be -2/-7 to indicate an unknown option/command.
98 * You do not need to process the options 'h', '--help' or '--version'
99 * because this function includes standard help processing; but if you
100 * specify '-h', '--help' or '--version' you have to do it yourself.
101 * The option '--' stops argument processing; if bit 1 is set the function
102 * continues to return normal arguments.
103 * To process float args or unsigned args you must use a string args and do
104 * the conversion yourself.
107 * ARGPARSE_OPTS opts[] = {
108 * { 'v', "verbose", 0 },
109 * { 'd', "debug", 0 },
110 * { 'o', "output", 2 },
111 * { 'c', "cross-ref", 2|8 },
112 * { 'm', "my-option", 1|8 },
113 * { 500, "have-no-short-option-for-this-long-option", 0 },
115 * ARGPARSE_ARGS pargs = { &argc, &argv, 0 }
117 * while( ArgParse( &pargs, &opts) ) {
118 * switch( pargs.r_opt ) {
119 * case 'v': opt.verbose++; break;
120 * case 'd': opt.debug++; break;
121 * case 'o': opt.outfile = pargs.r.ret_str; break;
122 * case 'c': opt.crf = pargs.r_type? pargs.r.ret_str:"a.crf"; break;
123 * case 'm': opt.myopt = pargs.r_type? pargs.r.ret_int : 1; break;
124 * case 500: opt.a_long_one++; break
125 * default : pargs.err = 1; break; -- force warning output --
129 * log_fatal( "Too many args");
133 typedef struct alias_def_s
*ALIAS_DEF
;
136 char *name
; /* malloced buffer with name, \0, value */
137 const char *value
; /* ptr into name */
140 static const char *(*strusage_handler
)( int ) = NULL
;
142 static int set_opt_arg(ARGPARSE_ARGS
*arg
, unsigned flags
, char *s
);
143 static void show_help(ARGPARSE_OPTS
*opts
, unsigned flags
);
144 static void show_version(void);
148 initialize( ARGPARSE_ARGS
*arg
, const char *filename
, unsigned *lineno
)
150 if( !(arg
->flags
& (1<<15)) ) { /* initialize this instance */
151 arg
->internal
.idx
= 0;
152 arg
->internal
.last
= NULL
;
153 arg
->internal
.inarg
= 0;
154 arg
->internal
.stopped
= 0;
155 arg
->internal
.aliases
= NULL
;
156 arg
->internal
.cur_alias
= NULL
;
158 arg
->flags
|= 1<<15; /* mark initialized */
160 jnlib_log_bug("Invalid argument for ArgParse\n");
164 if( arg
->err
) { /* last option was erroneous */
168 if( arg
->r_opt
== -6 )
169 s
= "argument not expected\n";
170 else if( arg
->r_opt
== -5 )
172 else if( arg
->r_opt
== -4 )
173 s
= "keyword too long\n";
174 else if( arg
->r_opt
== -3 )
175 s
= "missing argument\n";
176 else if( arg
->r_opt
== -7 )
177 s
= "invalid command\n";
178 else if( arg
->r_opt
== -10 )
179 s
= "invalid alias definition\n";
181 s
= "invalid option\n";
182 jnlib_log_error("%s:%u: %s\n", filename
, *lineno
, s
);
185 s
= arg
->internal
.last
? arg
->internal
.last
:"[??]";
187 if( arg
->r_opt
== -3 )
188 jnlib_log_error ("Missing argument for option \"%.50s\"\n", s
);
189 else if( arg
->r_opt
== -6 )
190 jnlib_log_error ("Option \"%.50s\" does not expect an argument\n",
192 else if( arg
->r_opt
== -7 )
193 jnlib_log_error ("Invalid command \"%.50s\"\n", s
);
194 else if( arg
->r_opt
== -8 )
195 jnlib_log_error ("Option \"%.50s\" is ambiguous\n", s
);
196 else if( arg
->r_opt
== -9 )
197 jnlib_log_error ("Command \"%.50s\" is ambiguous\n",s
);
199 jnlib_log_error ("Invalid option \"%.50s\"\n", s
);
206 /* clearout the return value union */
207 arg
->r
.ret_str
= NULL
;
213 store_alias( ARGPARSE_ARGS
*arg
, char *name
, char *value
)
215 /* TODO: replace this dummy function with a rea one
216 * and fix the probelms IRIX has with (ALIAS_DEV)arg..
220 ALIAS_DEF a
= jnlib_xmalloc( sizeof *a
);
223 a
->next
= (ALIAS_DEF
)arg
->internal
.aliases
;
224 (ALIAS_DEF
)arg
->internal
.aliases
= a
;
229 * Get options from a file.
230 * Lines starting with '#' are comment lines.
231 * Syntax is simply a keyword and the argument.
232 * Valid keywords are all keywords from the long_opt list without
233 * the leading dashes. The special keywords "help", "warranty" and "version"
234 * are not valid here.
235 * The special keyword "alias" may be used to store alias definitions,
236 * which are later expanded like long options.
237 * Caller must free returned strings.
238 * If called with FP set to NULL command line args are parse instead.
240 * Q: Should we allow the syntax
242 * and accept for boolean options a value of 1/0, yes/no or true/false?
243 * Note: Abbreviation of options is here not allowed.
246 optfile_parse( FILE *fp
, const char *filename
, unsigned *lineno
,
247 ARGPARSE_ARGS
*arg
, ARGPARSE_OPTS
*opts
)
257 if( !fp
) /* same as arg_parse() in this case */
258 return arg_parse( arg
, opts
);
260 initialize( arg
, filename
, lineno
);
262 /* find the next keyword */
266 if( c
== '\n' || c
== EOF
) {
271 else if( state
== 2 ) {
273 for(i
=0; opts
[i
].short_opt
; i
++ )
274 if( opts
[i
].long_opt
&& !strcmp( opts
[i
].long_opt
, keyword
) )
277 arg
->r_opt
= opts
[idx
].short_opt
;
278 if( inverse
) /* this does not have an effect, hmmm */
279 arg
->r_opt
= -arg
->r_opt
;
280 if( !opts
[idx
].short_opt
) /* unknown command/option */
281 arg
->r_opt
= (opts
[idx
].flags
& 256)? -7:-2;
282 else if( !(opts
[idx
].flags
& 7) ) /* does not take an arg */
283 arg
->r_type
= 0; /* okay */
284 else if( (opts
[idx
].flags
& 8) ) /* argument is optional */
285 arg
->r_type
= 0; /* okay */
286 else /* required argument */
287 arg
->r_opt
= -3; /* error */
290 else if( state
== 3 ) { /* no argument found */
292 arg
->r_opt
= -3; /* error */
293 else if( !(opts
[idx
].flags
& 7) ) /* does not take an arg */
294 arg
->r_type
= 0; /* okay */
295 else if( (opts
[idx
].flags
& 8) ) /* no optional argument */
296 arg
->r_type
= 0; /* okay */
297 else /* no required argument */
298 arg
->r_opt
= -3; /* error */
301 else if( state
== 4 ) { /* have an argument */
309 p
= strpbrk( buffer
, " \t" );
315 jnlib_free( buffer
);
319 store_alias( arg
, buffer
, p
);
323 else if( !(opts
[idx
].flags
& 7) ) /* does not take an arg */
324 arg
->r_opt
= -6; /* error */
329 buffer
= jnlib_xstrdup(keyword
);
334 trim_spaces( buffer
);
336 if( *p
== '"' ) { /* remove quotes */
338 if( *p
&& p
[strlen(p
)-1] == '"' )
341 if( !set_opt_arg(arg
, opts
[idx
].flags
, p
) )
346 else if( c
== EOF
) {
348 arg
->r_opt
= -5; /* read error */
350 arg
->r_opt
= 0; /* eof */
356 else if( state
== -1 )
358 else if( !state
&& isspace(c
) )
359 ; /* skip leading white space */
360 else if( !state
&& c
== '#' )
361 state
= 1; /* start of a comment */
362 else if( state
== 1 )
363 ; /* skip comments */
364 else if( state
== 2 && isspace(c
) ) {
366 for(i
=0; opts
[i
].short_opt
; i
++ )
367 if( opts
[i
].long_opt
&& !strcmp( opts
[i
].long_opt
, keyword
) )
370 arg
->r_opt
= opts
[idx
].short_opt
;
371 if( !opts
[idx
].short_opt
) {
372 if( !strcmp( keyword
, "alias" ) ) {
377 arg
->r_opt
= (opts
[idx
].flags
& 256)? -7:-2;
378 state
= -1; /* skip rest of line and leave */
384 else if( state
== 3 ) { /* skip leading spaces of the argument */
391 else if( state
== 4 ) { /* collect the argument */
397 buffer
= jnlib_xrealloc(buffer
, buflen
);
401 else if( i
< DIM(keyword
)-1 )
404 buflen
= DIM(keyword
)+50;
405 buffer
= jnlib_xmalloc(buflen
);
406 memcpy(buffer
, keyword
, i
);
410 else if( i
>= DIM(keyword
)-1 ) {
411 arg
->r_opt
= -4; /* keyword to long */
412 state
= -1; /* skip rest of line and leave */
426 find_long_option( ARGPARSE_ARGS
*arg
,
427 ARGPARSE_OPTS
*opts
, const char *keyword
)
432 /* Would be better if we can do a binary search, but it is not
433 possible to reorder our option table because we would mess
434 up our help strings - What we can do is: Build a nice option
435 lookup table wehn this function is first invoked */
438 for(i
=0; opts
[i
].short_opt
; i
++ )
439 if( opts
[i
].long_opt
&& !strcmp( opts
[i
].long_opt
, keyword
) )
444 /* see whether it is an alias */
445 for( a
= args
->internal
.aliases
; a
; a
= a
->next
) {
446 if( !strcmp( a
->name
, keyword
) ) {
447 /* todo: must parse the alias here */
448 args
->internal
.cur_alias
= a
;
449 return -3; /* alias available */
454 /* not found, see whether it is an abbreviation */
455 /* aliases may not be abbreviated */
456 n
= strlen( keyword
);
457 for(i
=0; opts
[i
].short_opt
; i
++ ) {
458 if( opts
[i
].long_opt
&& !strncmp( opts
[i
].long_opt
, keyword
, n
) ) {
460 for(j
=i
+1; opts
[j
].short_opt
; j
++ ) {
462 && !strncmp( opts
[j
].long_opt
, keyword
, n
) )
463 return -2; /* abbreviation is ambiguous */
472 arg_parse( ARGPARSE_ARGS
*arg
, ARGPARSE_OPTS
*opts
)
480 initialize( arg
, NULL
, NULL
);
483 idx
= arg
->internal
.idx
;
485 if( !idx
&& argc
&& !(arg
->flags
& (1<<4)) ) { /* skip the first entry */
486 argc
--; argv
++; idx
++;
490 if( !argc
) { /* no more args */
492 goto leave
; /* ready */
496 arg
->internal
.last
= s
;
498 if( arg
->internal
.stopped
&& (arg
->flags
& (1<<1)) ) {
499 arg
->r_opt
= -1; /* not an option but a argument */
502 argc
--; argv
++; idx
++; /* set to next one */
504 else if( arg
->internal
.stopped
) { /* ready */
508 else if( *s
== '-' && s
[1] == '-' ) { /* long option */
511 arg
->internal
.inarg
= 0;
512 if( !s
[2] && !(arg
->flags
& (1<<3)) ) { /* stop option processing */
513 arg
->internal
.stopped
= 1;
514 argc
--; argv
++; idx
++;
518 argpos
= strchr( s
+2, '=' );
521 i
= find_long_option( arg
, opts
, s
+2 );
525 if( i
< 0 && !strcmp( "help", s
+2) )
526 show_help(opts
, arg
->flags
);
527 else if( i
< 0 && !strcmp( "version", s
+2) ) {
528 if( !(arg
->flags
& (1<<6)) ) {
533 else if( i
< 0 && !strcmp( "warranty", s
+2) ) {
534 puts( strusage(16) );
537 else if( i
< 0 && !strcmp( "dump-options", s
+2) ) {
538 for(i
=0; opts
[i
].short_opt
; i
++ ) {
539 if( opts
[i
].long_opt
)
540 printf( "--%s\n", opts
[i
].long_opt
);
542 fputs("--dump-options\n--help\n--version\n--warranty\n", stdout
);
546 if( i
== -2 ) /* ambiguous option */
550 arg
->r
.ret_str
= s
+2;
553 arg
->r_opt
= opts
[i
].short_opt
;
556 else if( (opts
[i
].flags
& 7) ) {
564 if( !s2
&& (opts
[i
].flags
& 8) ) { /* no argument but it is okay*/
565 arg
->r_type
= 0; /* because it is optional */
568 arg
->r_opt
= -3; /* missing argument */
570 else if( !argpos
&& *s2
== '-' && (opts
[i
].flags
& 8) ) {
571 /* the argument is optional and the next seems to be
572 * an option. We do not check this possible option
573 * but assume no argument */
577 set_opt_arg(arg
, opts
[i
].flags
, s2
);
579 argc
--; argv
++; idx
++; /* skip one */
583 else { /* does not take an argument */
585 arg
->r_type
= -6; /* argument not expected */
589 argc
--; argv
++; idx
++; /* set to next one */
591 else if( (*s
== '-' && s
[1]) || arg
->internal
.inarg
) { /* short option */
594 if( !arg
->internal
.inarg
) {
595 arg
->internal
.inarg
++;
596 if( arg
->flags
& (1<<5) ) {
597 for(i
=0; opts
[i
].short_opt
; i
++ )
598 if( opts
[i
].long_opt
&& !strcmp( opts
[i
].long_opt
, s
+1)) {
604 s
+= arg
->internal
.inarg
;
607 for(i
=0; opts
[i
].short_opt
; i
++ )
608 if( opts
[i
].short_opt
== *s
)
612 if( !opts
[i
].short_opt
&& ( *s
== 'h' || *s
== '?' ) )
613 show_help(opts
, arg
->flags
);
615 arg
->r_opt
= opts
[i
].short_opt
;
616 if( !opts
[i
].short_opt
) {
617 arg
->r_opt
= (opts
[i
].flags
& 256)? -7:-2;
618 arg
->internal
.inarg
++; /* point to the next arg */
621 else if( (opts
[i
].flags
& 7) ) {
622 if( s
[1] && !dash_kludge
) {
624 set_opt_arg(arg
, opts
[i
].flags
, s2
);
628 if( !s2
&& (opts
[i
].flags
& 8) ) { /* no argument but it is okay*/
629 arg
->r_type
= 0; /* because it is optional */
632 arg
->r_opt
= -3; /* missing argument */
634 else if( *s2
== '-' && s2
[1] && (opts
[i
].flags
& 8) ) {
635 /* the argument is optional and the next seems to be
636 * an option. We do not check this possible option
637 * but assume no argument */
641 set_opt_arg(arg
, opts
[i
].flags
, s2
);
642 argc
--; argv
++; idx
++; /* skip one */
645 s
= "x"; /* so that !s[1] yields false */
647 else { /* does not take an argument */
649 arg
->internal
.inarg
++; /* point to the next arg */
651 if( !s
[1] || dash_kludge
) { /* no more concatenated short options */
652 arg
->internal
.inarg
= 0;
653 argc
--; argv
++; idx
++;
656 else if( arg
->flags
& (1<<2) ) {
657 arg
->r_opt
= -1; /* not an option but a argument */
660 argc
--; argv
++; idx
++; /* set to next one */
663 arg
->internal
.stopped
= 1; /* stop option processing */
670 arg
->internal
.idx
= idx
;
677 set_opt_arg(ARGPARSE_ARGS
*arg
, unsigned flags
, char *s
)
679 int base
= (flags
& 16)? 0 : 10;
681 switch( arg
->r_type
= (flags
& 7) ) {
682 case 1: /* takes int argument */
683 arg
->r
.ret_int
= (int)strtol(s
,NULL
,base
);
685 case 3: /* takes long argument */
686 arg
->r
.ret_long
= strtol(s
,NULL
,base
);
688 case 4: /* takes ulong argument */
689 arg
->r
.ret_ulong
= strtoul(s
,NULL
,base
);
691 case 2: /* takes string argument */
700 long_opt_strlen( ARGPARSE_OPTS
*o
)
702 size_t n
= strlen(o
->long_opt
);
704 if( o
->description
&& *o
->description
== '|' ) {
710 for(; *s
&& *s
!= '|'; s
++ )
717 * Print formatted help. The description string has some special
719 * - A description string which is "@" suppresses help output for
721 * - a description,ine which starts with a '@' and is followed by
722 * any other characters is printed as is; this may be used for examples
724 * - A description which starts with a '|' outputs the string between this
725 * bar and the next one as arguments of the long option.
728 show_help( ARGPARSE_OPTS
*opts
, unsigned flags
)
736 if( opts
[0].description
) { /* auto format the option description */
738 /* get max. length of long options */
739 for(i
=indent
=0; opts
[i
].short_opt
; i
++ ) {
740 if( opts
[i
].long_opt
)
741 if( !opts
[i
].description
|| *opts
[i
].description
!= '@' )
742 if( (j
=long_opt_strlen(opts
+i
)) > indent
&& j
< 35 )
745 /* example: " -v, --verbose Viele Sachen ausgeben" */
747 if( *opts
[0].description
!= '@' )
749 for(i
=0; opts
[i
].short_opt
; i
++ ) {
750 s
= _( opts
[i
].description
);
751 if( s
&& *s
== '@' && !s
[1] ) /* hide this line */
753 if( s
&& *s
== '@' ) { /* unindented comment only line */
767 if( opts
[i
].short_opt
< 256 ) {
768 printf(" -%c", opts
[i
].short_opt
);
769 if( !opts
[i
].long_opt
) {
770 if(s
&& *s
== '|' ) {
772 for(s
++ ; *s
&& *s
!= '|'; s
++, j
++ )
781 if( opts
[i
].long_opt
) {
782 j
+= printf("%c --%s", opts
[i
].short_opt
< 256?',':' ',
784 if(s
&& *s
== '|' ) {
789 for( ; *s
&& *s
!= '|'; s
++, j
++ )
797 for(;j
< indent
; j
++ )
800 if( *s
&& j
> indent
) {
802 for(j
=0;j
< indent
; j
++ )
809 for(j
=0;j
< indent
; j
++ )
820 puts("\n(A single dash may be used instead of the double ones)");
822 if( (s
=strusage(19)) ) { /* bug reports to ... */
836 fputs(strusage(11), stdout
);
837 if( (s
=strusage(12)) )
839 printf(" %s\n", strusage(13) );
840 /* additional version lines */
841 for(i
=20; i
< 30; i
++ )
842 if( (s
=strusage(i
)) )
844 /* copyright string */
845 if( (s
=strusage(14)) )
847 /* copying conditions */
848 if( (s
=strusage(15)) )
851 if( (s
=strusage(18)) )
853 /* additional program info */
854 for(i
=30; i
< 40; i
++ )
855 if( (s
=strusage(i
)) )
865 fprintf(stderr
,"%s %s; %s\n", strusage(11), strusage(13),
869 else if( level
== 1 ) {
870 fputs(strusage(40),stderr
);
873 else if( level
== 2 ) {
880 * 0: Copyright String auf stderr ausgeben
881 * 1: Kurzusage auf stderr ausgeben und beenden
882 * 2: Langusage auf stdout ausgeben und beenden
883 * 11: name of program
884 * 12: optional name of package which includes this program.
886 * 14: copyright string
887 * 15: Short copying conditions (with LFs)
888 * 16: Long copying conditions (with LFs)
889 * 17: Optional printable OS name
890 * 18: Optional thanks list (with LFs)
891 * 19: Bug report info
892 *20..29: Additional lib version strings.
893 *30..39: Additional program info (with LFs)
894 * 40: short usage note (with LF)
895 * 41: long usage note (with LF)
898 strusage( int level
)
900 const char *p
= strusage_handler
? strusage_handler(level
) : NULL
;
906 case 11: p
= "foo"; break;
907 case 13: p
= "0.0"; break;
908 case 14: p
= "Copyright (C) 2006 Free Software Foundation, Inc."; break;
910 "This program comes with ABSOLUTELY NO WARRANTY.\n"
911 "This is free software, and you are welcome to redistribute it\n"
912 "under certain conditions. See the file COPYING for details.\n"; break;
914 "This is free software; you can redistribute it and/or modify\n"
915 "it under the terms of the GNU General Public License as published by\n"
916 "the Free Software Foundation; either version 2 of the License, or\n"
917 "(at your option) any later version.\n\n"
918 "It is distributed in the hope that it will be useful,\n"
919 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
920 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
921 "GNU General Public License for more details.\n\n"
922 "You should have received a copy of the GNU General Public License\n"
923 "along with this program; if not, write to the Free Software\n"
924 "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n"
927 case 40: /* short and long usage */
928 case 41: p
= ""; break;
935 set_strusage( const char *(*f
)( int ) )
937 strusage_handler
= f
;
953 main(int argc
, char **argv
)
955 ARGPARSE_OPTS opts
[] = {
956 { 'v', "verbose", 0 , "Laut sein"},
957 { 'e', "echo" , 0 , "Zeile ausgeben, damit wir sehen, was wir einegegeben haben"},
958 { 'd', "debug", 0 , "Debug\nfalls mal etasws\nSchief geht"},
959 { 'o', "output", 2 },
960 { 'c', "cross-ref", 2|8, "cross-reference erzeugen\n" },
961 { 'm', "my-option", 1|8 },
962 { 500, "a-long-option", 0 },
964 ARGPARSE_ARGS pargs
= { &argc
, &argv
, 2|4|32 };
967 while( ArgParse( &pargs
, opts
) ) {
968 switch( pargs
.r_opt
) {
969 case -1 : printf( "arg=`%s'\n", pargs
.r
.ret_str
); break;
970 case 'v': opt
.verbose
++; break;
971 case 'e': opt
.echo
++; break;
972 case 'd': opt
.debug
++; break;
973 case 'o': opt
.outfile
= pargs
.r
.ret_str
; break;
974 case 'c': opt
.crf
= pargs
.r_type
? pargs
.r
.ret_str
:"a.crf"; break;
975 case 'm': opt
.myopt
= pargs
.r_type
? pargs
.r
.ret_int
: 1; break;
976 case 500: opt
.a_long_one
++; break;
977 default : pargs
.err
= 1; break; /* force warning output */
980 for(i
=0; i
< argc
; i
++ )
981 printf("%3d -> (%s)\n", i
, argv
[i
] );
984 printf(" verbose=%d\n", opt
.verbose
);
986 printf(" debug=%d\n", opt
.debug
);
988 printf(" outfile=`%s'\n", opt
.outfile
);
990 printf(" crffile=`%s'\n", opt
.crf
);
992 printf(" myopt=%d\n", opt
.myopt
);
994 printf(" a-long-one=%d\n", opt
.a_long_one
);
996 printf(" echo=%d\n", opt
.echo
);
1001 /**** bottom of file ****/