From 39e8ce6f8eca1a46306df75058f8de39ddc5997d Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 21 Mar 2005 07:24:47 +0000 Subject: [PATCH] in printopt(), add DB's tweaks to make sure longflag isn't passed in when HAVE_GETOPT_LONG isn't defined, and rework the special case of options that are ignored for Pico compatibility so that they display more neatly when HAVE_GETOPT_LONG isn't defined; in usage(), fix an erroneous #ifdef that resulted in the -d/--rebinddelete and -k/--cut options' not being printed when NANO_SMALL was defined git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2410 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 15 +++++++++++++++ src/nano.c | 16 ++++++++++------ src/nano.h | 7 +++++++ src/proto.h | 7 +++++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 14c8f206..5b852fa4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,21 @@ CVS code - - files.c: do_browser() - Rename variable lineno to fileline to avoid confusion. (DLR) +- nano.c: + print1opt() + - Don't include longflag if HAVE_GETOPT_LONG isn't defined. + Rename this function to print1opt_full(), leave out the + longflag parameter if HAVE_GETOPT_LONG isn't defined, and make + print1opt() a macro for print1opt_full() that does that + without the need for a lot of extra #ifdefs. (David + Benbennick) DLR: Rename print1opt_f() to print1opt_full(). + - Rework the special case of options that are ignored for Pico + compatibility so that they display more neatly when + HAVE_GETOPT_LONG isn't defined. (DLR) + usage() + - Fix erroneous #ifdef that resulted in the -d/--rebinddelete + and -k/--cut options' not being printed when NANO_SMALL was + defined. (DLR) - utils.c: regexec_safe() - Rename to safe_regexec() for consistency. (DLR) diff --git a/src/nano.c b/src/nano.c index ecb87a71..24b8ae40 100644 --- a/src/nano.c +++ b/src/nano.c @@ -927,10 +927,13 @@ void renumber(filestruct *fileptr) } /* Print one usage string to the screen. This cuts down on duplicate - * strings to translate and leaves out the parts that shouldn't be + * strings to translate, and leaves out the parts that shouldn't be * translatable (the flag names). */ -void print1opt(const char *shortflag, const char *longflag, const char - *desc) +void print1opt_full(const char *shortflag +#ifdef HAVE_GETOPT_LONG + , const char *longflag +#endif + , const char *desc) { printf(" %s\t", shortflag); if (strlen(shortflag) < 8) @@ -993,11 +996,11 @@ void usage(void) #endif print1opt("-Z", "--restricted", N_("Restricted mode")); print1opt("-c", "--const", N_("Constantly show cursor position")); -#ifndef NANO_SMALL print1opt("-d", "--rebinddelete", N_("Fix Backspace/Delete confusion problem")); +#ifndef NANO_SMALL print1opt("-i", "--autoindent", N_("Automatically indent new lines")); - print1opt("-k", "--cut", N_("Cut from cursor to end of line")); #endif + print1opt("-k", "--cut", N_("Cut from cursor to end of line")); print1opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite")); #ifndef DISABLE_MOUSE print1opt("-m", "--mouse", N_("Enable mouse")); @@ -1021,7 +1024,8 @@ void usage(void) print1opt("-z", "--suspend", N_("Enable suspend")); /* This is a special case. */ - printf(" %s\t\t\t%s\n","-a, -b, -e, -f, -g, -j", _("(ignored, for Pico compatibility)")); + print1opt("-a, -b, -e,", "", ""); + print1opt("-f, -g, -j", "", _("(ignored, for Pico compatibility)")); exit(0); } diff --git a/src/nano.h b/src/nano.h index 071bf80e..6fff20cb 100644 --- a/src/nano.h +++ b/src/nano.h @@ -46,6 +46,13 @@ #define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char)) #define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char)) +/* Other macros. */ +#ifdef HAVE_GETOPT_LONG +#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, longflag, desc) +#else +#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, desc) +#endif + #ifdef BROKEN_REGEXEC #undef regexec #define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags) diff --git a/src/proto.h b/src/proto.h index 03989ba7..8398fe29 100644 --- a/src/proto.h +++ b/src/proto.h @@ -382,8 +382,11 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot, void copy_from_filestruct(filestruct *file_top, filestruct *file_bot); void renumber_all(void); void renumber(filestruct *fileptr); -void print1opt(const char *shortflag, const char *longflag, const char - *desc); +void print1opt_full(const char *shortflag +#ifdef HAVE_GETOPT_LONG + , const char *longflag +#endif + , const char *desc); void usage(void); void version(void); int no_more_space(void); -- 2.39.5