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
master
David Lawrence Ramsey 2005-03-21 07:24:47 +00:00
parent afbcf68c1a
commit 39e8ce6f8e
4 changed files with 37 additions and 8 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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)

View File

@ -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);