diff --git a/autogen.sh b/autogen.sh index 5eef19f11b4c9a510536db3e6792c484fcb8d526..98a88f8610913a853b3a50a1872f03646ead9fcf 100755 --- a/autogen.sh +++ b/autogen.sh @@ -7,6 +7,7 @@ gnulib_hash="4084b3a1094372b960ce4a97634e08f4538c8bdd" modules=" getdelim getline + getopt-gnu isblank iswblank regex diff --git a/configure.ac b/configure.ac index 1da851407af70badf8b3ca87faa9f8c4ae99b910..c9abd1e923615369a98cb80b6e20804a66826dc2 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,7 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.]) dnl Checks for header files. -AC_CHECK_HEADERS(getopt.h libintl.h limits.h sys/param.h wchar.h wctype.h stdarg.h) +AC_CHECK_HEADERS(libintl.h limits.h sys/param.h wchar.h wctype.h stdarg.h) dnl Checks for options. @@ -499,7 +499,6 @@ dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(getopt_long) dnl Checks for libraries. diff --git a/src/nano.c b/src/nano.c index 8f1b4e00e288e20a990735e389f793fcd2040251..e957874d3efa5d9bfcdc4d618cacf3377b139ef2 100644 --- a/src/nano.c +++ b/src/nano.c @@ -35,9 +35,7 @@ #include <langinfo.h> #endif #include <termios.h> -#ifdef HAVE_GETOPT_H #include <getopt.h> -#endif #ifndef NANO_TINY #include <sys/ioctl.h> #endif @@ -746,32 +744,20 @@ void mouse_init(void) } #endif /* !DISABLE_MOUSE */ -#ifdef HAVE_GETOPT_LONG -#define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, longflag, desc) -#else -#define print_opt(shortflag, longflag, desc) print_opt_full(shortflag, desc) -#endif - /* Print one usage string to the screen. This cuts down on duplicate * strings to translate, and leaves out the parts that shouldn't be * translatable (i.e. the flag names). */ -void print_opt_full(const char *shortflag -#ifdef HAVE_GETOPT_LONG - , const char *longflag -#endif - , const char *desc) +void print_opt(const char *shortflag, const char *longflag, const char *desc) { printf(" %s\t", shortflag); if (strlenpt(shortflag) < 8) printf("\t"); -#ifdef HAVE_GETOPT_LONG printf("%s\t", longflag); if (strlenpt(longflag) < 8) printf("\t\t"); else if (strlenpt(longflag) < 16) printf("\t"); -#endif if (desc != NULL) printf("%s", _(desc)); @@ -787,11 +773,7 @@ void usage(void) printf(_("To place the cursor on a specific line of a file, put the line number with\n" "a '+' before the filename. The column number can be added after a comma.\n")); printf(_("When the first filename is '-', nano reads data from standard input.\n\n")); -#ifdef HAVE_GETOPT_LONG printf(_("Option\t\tGNU long option\t\tMeaning\n")); -#else - printf(_("Option\t\tMeaning\n")); -#endif #ifndef NANO_TINY print_opt("-A", "--smarthome", /* TRANSLATORS: The next forty or so strings are option descriptions @@ -1925,7 +1907,6 @@ int main(int argc, char **argv) /* The old value of the multibuffer option, restored after we * load all files on the command line. */ #endif -#ifdef HAVE_GETOPT_LONG const struct option long_options[] = { {"boldtext", 0, NULL, 'D'}, #ifndef DISABLE_MULTIBUFFER @@ -1998,7 +1979,6 @@ int main(int argc, char **argv) #endif {NULL, 0, NULL, 0} }; -#endif /* Back up the terminal settings so that they can be restored. */ tcgetattr(0, &oldterm); @@ -2038,15 +2018,9 @@ int main(int argc, char **argv) SET(RESTRICTED); while ((optchr = -#ifdef HAVE_GETOPT_LONG getopt_long(argc, argv, "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", - long_options, NULL) -#else - getopt(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$") -#endif - ) != -1) { + long_options, NULL)) != -1) { switch (optchr) { case 'a': case 'b': diff --git a/src/proto.h b/src/proto.h index 242a8e8a5f11e3e8c357bb73a0a577a6c5313ba7..365388e223b7138f629abf2a075c29bea9a7aae5 100644 --- a/src/proto.h +++ b/src/proto.h @@ -431,11 +431,7 @@ void disable_mouse_support(void); void enable_mouse_support(void); void mouse_init(void); #endif -void print_opt_full(const char *shortflag -#ifdef HAVE_GETOPT_LONG - , const char *longflag -#endif - , const char *desc); +void print_opt(const char *shortflag, const char *longflag, const char *desc); void usage(void); void version(void); void do_exit(void);