From 46445399e895a52a1db85c9d845f44d4ced31285 Mon Sep 17 00:00:00 2001 From: Hayaki Saito Date: Thu, 25 Sep 2014 22:30:22 +0900 Subject: [PATCH] Fix for some environment missing "getopt_long" --- converters/sixel2png.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/converters/sixel2png.c b/converters/sixel2png.c index 016eb5b1..599ce660 100644 --- a/converters/sixel2png.c +++ b/converters/sixel2png.c @@ -253,9 +253,13 @@ 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'}, @@ -263,10 +267,15 @@ main(int argc, char *argv[]) {"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; }