2 File autogenerated by gengetopt version 2.3
3 generated with the following command:
4 gengetopt --input=gliv.ggo --unamed-opts
6 The developers of gengetopt consider the fixed text that goes in all
7 gengetopt output files to be in the public domain:
8 we make no copyright claims on it.
15 /* If we use autoconf. */
19 /* Check for configure's getopt check result. */
20 #ifndef HAVE_GETOPT_LONG
30 cmdline_parser_print_version (void)
32 printf ("%s %s\n", PACKAGE
, VERSION
);
36 cmdline_parser_print_help (void)
38 cmdline_parser_print_version ();
40 "Usage: %s [OPTIONS]... FILES...\n\
41 -h --help Print help and exit\n\
42 -V --version Print version and exit\n\
43 -f --full-screen Start in full screen mode (default=off)\n\
44 -s --shuffle Show images in random order (default=off)\n\
45 -R --recursive Process directories recursively (default=off)\n\
46 -i --info Show infos about displayed image (default=on)\n\
47 -m --maximize Maximize image to fit window (default=off)\n\
48 -dINT --delay=INT Delay before hiding the cursor\n\
49 -b --menu Display the menu bar (default=on)\n\
55 gengetopt_strdup (char * s
)
57 char * n
, * pn
, * ps
= s
;
59 n
= (char *) malloc (1 + ps
- s
);
62 for (ps
=s
,pn
=n
; *ps
; ps
++,pn
++)
71 cmdline_parser (int argc
, char * const *argv
, struct gengetopt_args_info
*args_info
)
73 int c
; /* Character of the parsed option. */
74 int missing_required_options
= 0;
76 args_info
->help_given
= 0 ;
77 args_info
->version_given
= 0 ;
78 args_info
->full_screen_given
= 0 ;
79 args_info
->shuffle_given
= 0 ;
80 args_info
->recursive_given
= 0 ;
81 args_info
->info_given
= 0 ;
82 args_info
->maximize_given
= 0 ;
83 args_info
->delay_given
= 0 ;
84 args_info
->menu_given
= 0 ;
85 #define clear_args() { \
86 args_info->full_screen_flag = 0;\
87 args_info->shuffle_flag = 0;\
88 args_info->recursive_flag = 0;\
89 args_info->info_flag = 1;\
90 args_info->maximize_flag = 0;\
91 args_info->menu_flag = 1;\
96 args_info
->inputs
= NULL
;
97 args_info
->inputs_num
= 0;
101 int option_index
= 0;
102 static struct option long_options
[] = {
103 { "help", 0, NULL
, 'h' },
104 { "version", 0, NULL
, 'V' },
105 { "full-screen", 0, NULL
, 'f' },
106 { "shuffle", 0, NULL
, 's' },
107 { "recursive", 0, NULL
, 'R' },
108 { "info", 0, NULL
, 'i' },
109 { "maximize", 0, NULL
, 'm' },
110 { "delay", 1, NULL
, 'd' },
111 { "menu", 0, NULL
, 'b' },
115 c
= getopt_long (argc
, argv
, "hVfsRimd:b", long_options
, &option_index
);
117 if (c
== -1) break; /* Exit from `while (1)' loop. */
121 case 'h': /* Print help and exit. */
123 cmdline_parser_print_help ();
126 case 'V': /* Print version and exit. */
128 cmdline_parser_print_version ();
131 case 'f': /* Start in full screen mode. */
132 args_info
->full_screen_flag
= !(args_info
->full_screen_flag
);
135 case 's': /* Show images in random order. */
136 args_info
->shuffle_flag
= !(args_info
->shuffle_flag
);
139 case 'R': /* Process directories recursively. */
140 args_info
->recursive_flag
= !(args_info
->recursive_flag
);
143 case 'i': /* Show infos about displayed image. */
144 args_info
->info_flag
= !(args_info
->info_flag
);
147 case 'm': /* Maximize image to fit window. */
148 args_info
->maximize_flag
= !(args_info
->maximize_flag
);
151 case 'd': /* Delay before hiding the cursor. */
152 if (args_info
->delay_given
)
154 fprintf (stderr
, "%s: `--delay' (`-d') option given more than once\n", PACKAGE
);
156 cmdline_parser_print_help ();
159 args_info
->delay_given
= 1;
160 args_info
->delay_arg
= atoi (optarg
);
163 case 'b': /* Display the menu bar. */
164 args_info
->menu_flag
= !(args_info
->menu_flag
);
167 case 0: /* Long option with no short option */
169 case '?': /* Invalid option. */
170 /* `getopt_long' already printed an error message. */
173 default: /* bug: option not considered. */
174 fprintf (stderr
, "%s: option unknown: %c\n", PACKAGE
, c
);
179 if ( missing_required_options
)
186 args_info
->inputs_num
= argc
- optind
;
188 (char **)(malloc ((args_info
->inputs_num
)*sizeof(char *))) ;
189 while (optind
< argc
)
190 args_info
->inputs
[ i
++ ] = gengetopt_strdup (argv
[optind
++]) ;