Move #ifndef cleanups. Some HELP and SPELLER #ifndef additions.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@472 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Rocco Corsi 2001-01-12 07:51:05 +00:00
parent 4ee0b41b41
commit af5c302b48
7 changed files with 72 additions and 59 deletions

View File

@ -2,9 +2,10 @@ CVS code -
General General
- Changed #ifdefs to check for both DISABLE_TABCOMP and - Changed #ifdefs to check for both DISABLE_TABCOMP and
NANO_SMALL, makes tiny option leave out tab completion, which NANO_SMALL, makes tiny option leave out tab completion, which
shoudl be left out in that circumstance. Saves at least 5k. should be left out in that circumstance. Saves at least 5k.
- Previous change to #ifdefs DISABLE_TABCOMP and NANO_SMALL rolled - Previous change to #ifdefs DISABLE_TABCOMP and NANO_SMALL rolled
back. back. (Rocco)
- Various #ifdef & #ifndef cleanups. (Rocco)
- configure.in: - configure.in:
- Fix for _use_keypad check breaking slang support (Christian - Fix for _use_keypad check breaking slang support (Christian
Weisgerber). Weisgerber).
@ -19,6 +20,21 @@ General
Neil Parks). Neil Parks).
do_browser() do_browser()
- Added space and - keys to do page up and down. - Added space and - keys to do page up and down.
- nano.c:
main()
- Alternate speller option no longer valid if DISABLE_SPELLER is
active. (Rocco)
nano_small_msg()
- This function has been removed. All references now call
nano_disabled_msg. (Rocco)
version()
- When NANO_SMALL (enable-tiny) is defined, the 5 main DISABLE
variables (SPELLER, HELP, JUSTIFY, BROWSER, TABCOMP) are not
reported as enabled when Nano is called with -V (--version)
command-line option. (Rocco)
usage()
- Alternate speller option no longer valid if DISABLE_SPELLER is
active. (Rocco)
nano 0.9.25 - 01/07/2001 nano 0.9.25 - 01/07/2001
General - General -

View File

@ -271,7 +271,7 @@ int do_insertfile(void)
realname = mallocstrcpy(realname, answer); realname = mallocstrcpy(realname, answer);
#endif #endif
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
if (i == NANO_TOFILES_KEY) { if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(realname); char *tmp = do_browse_from(realname);
@ -525,7 +525,7 @@ int do_writeout(char *path, int exiting)
if (i != -1) { if (i != -1) {
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
if (i == NANO_TOFILES_KEY) { if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(answer); char *tmp = do_browse_from(answer);
@ -1057,7 +1057,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
} }
#endif #endif
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
/* Return the stat of the file pointed to by path */ /* Return the stat of the file pointed to by path */
struct stat filestat(const char *path) { struct stat filestat(const char *path) {

View File

@ -79,7 +79,7 @@ shortcut goto_list[GOTO_LIST_LEN];
shortcut writefile_list[WRITEFILE_LIST_LEN]; shortcut writefile_list[WRITEFILE_LIST_LEN];
shortcut help_list[HELP_LIST_LEN]; shortcut help_list[HELP_LIST_LEN];
shortcut spell_list[SPELL_LIST_LEN]; shortcut spell_list[SPELL_LIST_LEN];
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
shortcut browser_list[BROWSER_LIST_LEN]; shortcut browser_list[BROWSER_LIST_LEN];
#endif #endif
@ -410,7 +410,7 @@ void shortcut_init(int unjustify)
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit); nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"), sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"),
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0); nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
#endif #endif
@ -421,7 +421,7 @@ void shortcut_init(int unjustify)
sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"), sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0); nano_cancel_msg, 0, 0, 0, VIEW, 0);
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"), sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg, nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0); 0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);

71
nano.c
View File

@ -62,11 +62,15 @@
/* Former globals, now static */ /* Former globals, now static */
int fill = 0; /* Fill - where to wrap lines, basically */ int fill = 0; /* Fill - where to wrap lines, basically */
#ifndef DISABLE_SPELLER
static char *alt_speller; /* Alternative spell command */ static char *alt_speller; /* Alternative spell command */
#endif
struct termios oldterm; /* The user's original term settings */ struct termios oldterm; /* The user's original term settings */
static struct sigaction act; /* For all out fun signal handlers */ static struct sigaction act; /* For all out fun signal handlers */
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP) #ifndef DISABLE_HELP
static char *help_text_init = ""; /* Initial message, not including shortcuts */ static char *help_text_init = ""; /* Initial message, not including shortcuts */
#endif #endif
@ -177,11 +181,10 @@ void global_init(void)
hblank[i] = 0; hblank[i] = 0;
} }
#ifndef DISABLE_HELP
void init_help_msg(void) void init_help_msg(void)
{ {
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
help_text_init = help_text_init =
_(" nano help text\n\n " _(" nano help text\n\n "
"The nano editor is designed to emulate the functionality and " "The nano editor is designed to emulate the functionality and "
@ -200,9 +203,9 @@ void init_help_msg(void)
"Esc, Alt or Meta key depending on your keyboard setup. The " "Esc, Alt or Meta key depending on your keyboard setup. The "
"following keystrokes are available in the main editor window. " "following keystrokes are available in the main editor window. "
"Optional keys are shown in parentheses:\n\n"); "Optional keys are shown in parentheses:\n\n");
#endif
} }
#endif
/* Make a copy of a node to a pointer (space will be malloc()ed) */ /* Make a copy of a node to a pointer (space will be malloc()ed) */
filestruct *copy_node(filestruct * src) filestruct *copy_node(filestruct * src)
@ -379,8 +382,10 @@ void usage(void)
printf printf
(_ (_
(" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n")); (" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n"));
#ifndef DISABLE_SPELLER
printf(_ printf(_
(" -s [prog] --speller=[prog] Enable alternate speller\n")); (" -s [prog] --speller=[prog] Enable alternate speller\n"));
#endif
printf(_ printf(_
(" -t --tempfile Auto save on exit, don't prompt\n")); (" -t --tempfile Auto save on exit, don't prompt\n"));
printf(_ printf(_
@ -414,7 +419,9 @@ void usage(void)
#endif #endif
printf(_(" -p Emulate Pico as closely as possible\n")); printf(_(" -p Emulate Pico as closely as possible\n"));
printf(_(" -r [#cols] Set fill cols to (wrap lines at) #cols\n")); printf(_(" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
#ifndef DISABLE_SPELLER
printf(_(" -s [prog] Enable alternate speller\n")); printf(_(" -s [prog] Enable alternate speller\n"));
#endif
printf(_(" -t Auto save on exit, don't prompt\n")); printf(_(" -t Auto save on exit, don't prompt\n"));
printf(_(" -v View (read only) mode\n")); printf(_(" -v View (read only) mode\n"));
printf(_(" -w Don't wrap long lines\n")); printf(_(" -w Don't wrap long lines\n"));
@ -433,12 +440,13 @@ void version(void)
(" Email: nano@nano-editor.org Web: http://www.nano-editor.org")); (" Email: nano@nano-editor.org Web: http://www.nano-editor.org"));
printf(_("\n Compiled options:")); printf(_("\n Compiled options:"));
#ifdef NANO_SMALL
printf(" --enable-tiny");
#endif
#ifdef NANO_EXTRA #ifdef NANO_EXTRA
printf(" --enable-extra"); printf(" --enable-extra");
#endif #endif
#ifdef NANO_SMALL
printf(" --enable-tiny");
#else
#ifdef DISABLE_BROWSER #ifdef DISABLE_BROWSER
printf(" --disable-browser"); printf(" --disable-browser");
#endif #endif
@ -454,6 +462,8 @@ void version(void)
#ifdef DISABLE_HELP #ifdef DISABLE_HELP
printf(" --disable-help"); printf(" --disable-help");
#endif #endif
#endif
#ifdef USE_SLANG #ifdef USE_SLANG
printf(" --with-slang"); printf(" --with-slang");
#endif #endif
@ -490,7 +500,7 @@ void splice_node(filestruct * begin, filestruct * new, filestruct * end)
int do_mark() int do_mark()
{ {
#ifdef NANO_SMALL #ifdef NANO_SMALL
nano_small_msg(); nano_disabled_msg();
#else #else
if (!ISSET(MARK_ISSET)) { if (!ISSET(MARK_ISSET)) {
statusbar(_("Mark Set")); statusbar(_("Mark Set"));
@ -518,13 +528,6 @@ int no_help(void)
return 0; return 0;
} }
#ifdef NANO_SMALL
void nano_small_msg(void)
{
statusbar("Sorry, this function not available with nano-tiny option");
}
#endif
#if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP) #if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP)
void nano_disabled_msg(void) void nano_disabled_msg(void)
{ {
@ -1112,7 +1115,7 @@ void wrap_reset(void)
UNSET(SAMELINEWRAP); UNSET(SAMELINEWRAP);
} }
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER) #ifndef DISABLE_SPELLER
int do_int_spell_fix(char *word) int do_int_spell_fix(char *word)
{ {
@ -1178,9 +1181,6 @@ int do_int_spell_fix(char *word)
return TRUE; return TRUE;
} }
#endif
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
/* Integrated spell checking using 'spell' program */ /* Integrated spell checking using 'spell' program */
int do_int_speller(char *tempfile_name) int do_int_speller(char *tempfile_name)
@ -1308,9 +1308,6 @@ int do_int_speller(char *tempfile_name)
return TRUE; return TRUE;
} }
#endif
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
/* External spell checking */ /* External spell checking */
int do_alt_speller(char *file_name) int do_alt_speller(char *file_name)
@ -1362,10 +1359,7 @@ int do_alt_speller(char *file_name)
int do_spell(void) int do_spell(void)
{ {
#if defined(NANO_SMALL) #ifdef DISABLE_SPELLER
nano_small_msg();
return (TRUE);
#elif defined(DISABLE_SPELLER)
nano_disabled_msg(); nano_disabled_msg();
return (TRUE); return (TRUE);
#else #else
@ -1677,7 +1671,7 @@ int do_tab(void)
return 1; return 1;
} }
#if !defined(NANO_SMALL) && !defined(DISABLE_JUSTIFY) #ifndef DISABLE_JUSTIFY
int empty_line(const char *data) int empty_line(const char *data)
{ {
while (*data) { while (*data) {
@ -1729,10 +1723,7 @@ void justify_format(char *data)
int do_justify(void) int do_justify(void)
{ {
#ifdef NANO_SMALL #ifdef DISABLE_JUSTIFY
nano_small_msg();
return 1;
#elif defined(DISABLE_JUSTIFY)
nano_disabled_msg(); nano_disabled_msg();
return 1; return 1;
#else #else
@ -1915,7 +1906,7 @@ int do_justify(void)
#endif #endif
} }
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP) #ifndef DISABLE_HELP
void help_init(void) void help_init(void)
{ {
int i, sofar = 0; int i, sofar = 0;
@ -1987,7 +1978,9 @@ void help_init(void)
void do_toggle(int which) void do_toggle(int which)
{ {
#ifndef NANO_SMALL #ifdef NANO_SMALL
nano_disabled_msg();
#else
char *enabled = _("enabled"); char *enabled = _("enabled");
char *disabled = _("disabled"); char *disabled = _("disabled");
@ -2032,8 +2025,6 @@ void do_toggle(int which)
} }
SET(DISABLE_CURPOS); SET(DISABLE_CURPOS);
#else
nano_small_msg();
#endif #endif
} }
@ -2067,7 +2058,9 @@ int main(int argc, char *argv[])
#endif #endif
{"autoindent", 0, 0, 'i'}, {"autoindent", 0, 0, 'i'},
{"tempfile", 0, 0, 't'}, {"tempfile", 0, 0, 't'},
#ifndef DISABLE_SPELLER
{"speller", 1, 0, 's'}, {"speller", 1, 0, 's'},
#endif
{"fill", 1, 0, 'r'}, {"fill", 1, 0, 'r'},
{"mouse", 0, 0, 'm'}, {"mouse", 0, 0, 'm'},
{"pico", 0, 0, 'p'}, {"pico", 0, 0, 'p'},
@ -2149,10 +2142,16 @@ int main(int argc, char *argv[])
finish(1); finish(1);
} }
break; break;
#ifndef DISABLE_SPELLER
case 's': case 's':
alt_speller = nmalloc(strlen(optarg) + 1); alt_speller = nmalloc(strlen(optarg) + 1);
strcpy(alt_speller, optarg); strcpy(alt_speller, optarg);
break; break;
#else
case 's':
usage(); /* Oops! You dont really have that option */
finish(1);
#endif
case 't': case 't':
SET(TEMP_OPT); SET(TEMP_OPT);
break; break;
@ -2220,8 +2219,8 @@ int main(int argc, char *argv[])
/* Set up some global variables */ /* Set up some global variables */
global_init(); global_init();
shortcut_init(0); shortcut_init(0);
#ifndef DISABLE_HELP
init_help_msg(); init_help_msg();
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
help_init(); help_init();
#endif #endif
signal_init(); signal_init();

2
nano.h
View File

@ -247,7 +247,7 @@ know what you're doing */
#define HELP_LIST_LEN 3 #define HELP_LIST_LEN 3
#define SPELL_LIST_LEN 1 #define SPELL_LIST_LEN 1
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
#define WRITEFILE_LIST_LEN 2 #define WRITEFILE_LIST_LEN 2
#define BROWSER_LIST_LEN 3 #define BROWSER_LIST_LEN 3
#else #else

View File

@ -51,7 +51,7 @@ extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN];
extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN]; extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN];
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN]; extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN]; extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN];
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
extern shortcut browser_list[BROWSER_LIST_LEN]; extern shortcut browser_list[BROWSER_LIST_LEN];
#endif #endif
@ -154,7 +154,7 @@ int do_first_line(void), do_last_line(void);
int do_replace(void), do_help(void), do_enter_void(void); int do_replace(void), do_help(void), do_enter_void(void);
int keypad_on(WINDOW * win, int new); int keypad_on(WINDOW * win, int new);
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL) #ifndef DISABLE_BROWSER
char *do_browser(char *path); char *do_browser(char *path);
struct stat filestat(const char *path); struct stat filestat(const char *path);
char *do_browse_from(char *inpath); char *do_browse_from(char *inpath);

View File

@ -1178,7 +1178,7 @@ int do_cursorpos(void)
But hey, it's better than nothing, and it's dynamic! */ But hey, it's better than nothing, and it's dynamic! */
int do_help(void) int do_help(void)
{ {
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP) #ifndef DISABLE_HELP
char *ptr = help_text, *end; char *ptr = help_text, *end;
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp; int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp;
int no_help_flag = 0; int no_help_flag = 0;
@ -1284,8 +1284,6 @@ int do_help(void)
edit_refresh(); edit_refresh();
kp = keypad_on(edit, kp); kp = keypad_on(edit, kp);
#elif defined(NANO_SMALL)
nano_small_msg();
#elif defined(DISABLE_HELP) #elif defined(DISABLE_HELP)
nano_disabled_msg(); nano_disabled_msg();
#endif #endif