cosmetic fixes for the getopt_(long)?() calls and the switch block

dealing with the command line options


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1887 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-08-07 22:00:02 +00:00
parent 00d7798756
commit c7b6ac5afe
1 changed files with 116 additions and 117 deletions

View File

@ -642,7 +642,7 @@ void usage(void)
#else #else
printf(_("Usage: nano [+LINE] [option] [file]\n\n")); printf(_("Usage: nano [+LINE] [option] [file]\n\n"));
printf(_("Option\t\tMeaning\n")); printf(_("Option\t\tMeaning\n"));
#endif /* HAVE_GETOPT_LONG */ #endif
print1opt("-h, -?", "--help", N_("Show this message")); print1opt("-h, -?", "--help", N_("Show this message"));
print1opt(_("+LINE"), "", N_("Start at line number LINE")); print1opt(_("+LINE"), "", N_("Start at line number LINE"));
@ -3093,156 +3093,155 @@ int main(int argc, char *argv[])
SET(NO_WRAP); SET(NO_WRAP);
#endif #endif
#ifdef HAVE_GETOPT_LONG
while ((optchr = getopt_long(argc, argv, "h?ABDE:FHIMNQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz",
long_options, NULL)) != -1) {
#else
while ((optchr = while ((optchr =
getopt(argc, argv, "h?ABDE:FHIMNQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")) != -1) { #ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv, "h?ABDE:FHIMNQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz", long_options, NULL)
#else
getopt(argc, argv, "h?ABDE:FHIMNQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")
#endif #endif
) != -1) {
switch (optchr) { switch (optchr) {
case 'a':
case 'a': case 'b':
case 'b': case 'e':
case 'e': case 'f':
case 'f': case 'g':
case 'g': case 'j':
case 'j': /* Pico compatibility flags. */
/* Pico compatibility flags */ break;
break;
#ifndef NANO_SMALL #ifndef NANO_SMALL
case 'A': case 'A':
SET(SMART_HOME); SET(SMART_HOME);
break; break;
case 'B': case 'B':
SET(BACKUP_FILE); SET(BACKUP_FILE);
break; break;
case 'D': case 'D':
SET(DOS_FILE); SET(DOS_FILE);
break; break;
case 'E': case 'E':
backup_dir = mallocstrcpy(backup_dir, optarg); backup_dir = mallocstrcpy(backup_dir, optarg);
break; break;
#endif #endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
case 'F': case 'F':
SET(MULTIBUFFER); SET(MULTIBUFFER);
break; break;
#endif #endif
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
#ifndef NANO_SMALL #ifndef NANO_SMALL
case 'H': case 'H':
SET(HISTORYLOG); SET(HISTORYLOG);
break; break;
#endif #endif
case 'I': case 'I':
SET(NO_RCFILE); SET(NO_RCFILE);
break; break;
#endif #endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
case 'M': case 'M':
SET(MAC_FILE); SET(MAC_FILE);
break; break;
case 'N': case 'N':
SET(NO_CONVERT); SET(NO_CONVERT);
break; break;
#endif #endif
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
case 'Q': case 'Q':
quotestr = mallocstrcpy(quotestr, optarg); quotestr = mallocstrcpy(quotestr, optarg);
break; break;
#endif #endif
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
case 'R': case 'R':
SET(USE_REGEXP); SET(USE_REGEXP);
break; break;
#endif #endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
case 'S': case 'S':
SET(SMOOTHSCROLL); SET(SMOOTHSCROLL);
break; break;
#endif #endif
case 'T': case 'T':
if (!parse_num(optarg, &tabsize) || tabsize <= 0) { if (!parse_num(optarg, &tabsize) || tabsize <= 0) {
fprintf(stderr, _("Requested tab size %s invalid\n"), optarg); fprintf(stderr, _("Requested tab size %s invalid\n"), optarg);
exit(1); exit(1);
} }
break; break;
case 'V': case 'V':
version(); version();
exit(0); exit(0);
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
case 'Y': case 'Y':
syntaxstr = mallocstrcpy(syntaxstr, optarg); syntaxstr = mallocstrcpy(syntaxstr, optarg);
break; break;
#endif #endif
case 'Z': case 'Z':
SET(RESTRICTED); SET(RESTRICTED);
break; break;
case 'c': case 'c':
SET(CONSTUPDATE); SET(CONSTUPDATE);
break; break;
case 'd': case 'd':
SET(REBIND_DELETE); SET(REBIND_DELETE);
break; break;
#ifndef NANO_SMALL #ifndef NANO_SMALL
case 'i': case 'i':
SET(AUTOINDENT); SET(AUTOINDENT);
break; break;
case 'k': case 'k':
SET(CUT_TO_END); SET(CUT_TO_END);
break; break;
#endif #endif
case 'l': case 'l':
SET(NOFOLLOW_SYMLINKS); SET(NOFOLLOW_SYMLINKS);
break; break;
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
case 'm': case 'm':
SET(USE_MOUSE); SET(USE_MOUSE);
break; break;
#endif #endif
#ifndef DISABLE_OPERATINGDIR #ifndef DISABLE_OPERATINGDIR
case 'o': case 'o':
operating_dir = mallocstrcpy(operating_dir, optarg); operating_dir = mallocstrcpy(operating_dir, optarg);
break; break;
#endif #endif
case 'p': case 'p':
SET(PRESERVE); SET(PRESERVE);
break; break;
#ifndef DISABLE_WRAPJUSTIFY #ifndef DISABLE_WRAPJUSTIFY
case 'r': case 'r':
if (!parse_num(optarg, &wrap_at)) { if (!parse_num(optarg, &wrap_at)) {
fprintf(stderr, _("Requested fill size %s invalid\n"), optarg); fprintf(stderr, _("Requested fill size %s invalid\n"), optarg);
exit(1); exit(1);
} }
fill_flag_used = TRUE; fill_flag_used = TRUE;
break; break;
#endif #endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
case 's': case 's':
alt_speller = mallocstrcpy(alt_speller, optarg); alt_speller = mallocstrcpy(alt_speller, optarg);
break; break;
#endif #endif
case 't': case 't':
SET(TEMP_FILE); SET(TEMP_FILE);
break; break;
case 'v': case 'v':
SET(VIEW_MODE); SET(VIEW_MODE);
break; break;
#ifndef DISABLE_WRAPPING #ifndef DISABLE_WRAPPING
case 'w': case 'w':
SET(NO_WRAP); SET(NO_WRAP);
break; break;
#endif #endif
case 'x': case 'x':
SET(NO_HELP); SET(NO_HELP);
break; break;
case 'z': case 'z':
SET(SUSPEND); SET(SUSPEND);
break; break;
default: default:
usage(); usage();
} }
} }