Skip to content

Commit

Permalink
Fix for some environment missing "getopt_long"
Browse files Browse the repository at this point in the history
  • Loading branch information
saitoha committed Sep 25, 2014
1 parent d02f1e3 commit 4644539
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion converters/sixel2png.c
Expand Up @@ -253,20 +253,29 @@ main(int argc, char *argv[])
char *output = strdup("-");
char *input = strdup("-");
int long_opt;
#if HAVE_GETOPT_LONG
int option_index;
#endif /* HAVE_GETOPT_LONG */
int nret = 0;
char const *optstring = "i:o:VH";

#if HAVE_GETOPT_LONG
struct option long_options[] = {
{"input", required_argument, &long_opt, 'i'},
{"output", required_argument, &long_opt, 'o'},
{"version", no_argument, &long_opt, 'H'},
{"help", no_argument, &long_opt, 'V'},
{0, 0, 0, 0}
};
#endif /* HAVE_GETOPT_LONG */

for (;;) {
n = getopt_long(argc, argv, "i:o:VH",
#if HAVE_GETOPT_LONG
n = getopt_long(argc, argv, optstring,
long_options, &option_index);
#else
n = getopt(argc, argv, optstring);
#endif /* HAVE_GETOPT_LONG */
if (n == -1) {
break;
}
Expand Down

0 comments on commit 4644539

Please sign in to comment.