Bläddra i källkod

* Support for platforms without <getopt.h> in TOIlet.

tags/v0.99.beta14
Sam Hocevar sam 18 år sedan
förälder
incheckning
074694fe75
1 ändrade filer med 10 tillägg och 5 borttagningar
  1. +10
    -5
      test/toilet.c

+ 10
- 5
test/toilet.c Visa fil

@@ -47,10 +47,11 @@ int main(int argc, char *argv[])


unsigned flag_gay = 0; unsigned flag_gay = 0;


#if defined(HAVE_GETOPT_H)
for(;;) for(;;)
{ {
#ifdef HAVE_GETOPT_LONG
# define MOREINFO "Try `%s --help' for more information.\n"
# ifdef HAVE_GETOPT_LONG
# define MOREINFO "Try `%s --help' for more information.\n"
int option_index = 0; int option_index = 0;
static struct option long_options[] = static struct option long_options[] =
{ {
@@ -62,10 +63,10 @@ int main(int argc, char *argv[])
}; };


int c = getopt_long(argc, argv, "ghv", long_options, &option_index); int c = getopt_long(argc, argv, "ghv", long_options, &option_index);
#else
# define MOREINFO "Try `%s -h' for more information.\n"
# else
# define MOREINFO "Try `%s -h' for more information.\n"
int c = getopt(argc, argv, "ghv"); int c = getopt(argc, argv, "ghv");
#endif
# endif
if(c == -1) if(c == -1)
break; break;


@@ -100,6 +101,10 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
} }
#else
# define MOREINFO "Usage: %s message...\n"
int optind = 1;
#endif


if(optind >= argc) if(optind >= argc)
{ {


Laddar…
Avbryt
Spara