1
1

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
Этот коммит содержится в:
Rocco Corsi 2001-01-12 07:51:05 +00:00
родитель 4ee0b41b41
Коммит af5c302b48
7 изменённых файлов: 72 добавлений и 59 удалений

Просмотреть файл

@ -2,9 +2,10 @@ CVS code -
General
- Changed #ifdefs to check for both DISABLE_TABCOMP and
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
back.
back. (Rocco)
- Various #ifdef & #ifndef cleanups. (Rocco)
- configure.in:
- Fix for _use_keypad check breaking slang support (Christian
Weisgerber).
@ -19,6 +20,21 @@ General
Neil Parks).
do_browser()
- 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
General -

Просмотреть файл

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

Просмотреть файл

@ -79,7 +79,7 @@ shortcut goto_list[GOTO_LIST_LEN];
shortcut writefile_list[WRITEFILE_LIST_LEN];
shortcut help_list[HELP_LIST_LEN];
shortcut spell_list[SPELL_LIST_LEN];
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL)
#ifndef DISABLE_BROWSER
shortcut browser_list[BROWSER_LIST_LEN];
#endif
@ -410,7 +410,7 @@ void shortcut_init(int unjustify)
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"),
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
#endif
@ -421,7 +421,7 @@ void shortcut_init(int unjustify)
sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
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"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);

89
nano.c
Просмотреть файл

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

2
nano.h
Просмотреть файл

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

Просмотреть файл

@ -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 writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_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];
#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 keypad_on(WINDOW * win, int new);
#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL)
#ifndef DISABLE_BROWSER
char *do_browser(char *path);
struct stat filestat(const char *path);
char *do_browse_from(char *inpath);

Просмотреть файл

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