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).
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 -
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);
if (i != -1) {
-#if !defined(DISABLE_BROWSER) && !defined(NANO_SMALL)
+#ifndef DISABLE_BROWSER
if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(answer);
}
#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) {
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
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
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);
/* 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
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 "
"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)
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(_
#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"));
(" 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
int do_mark()
{
#ifdef NANO_SMALL
- nano_small_msg();
+ nano_disabled_msg();
#else
if (!ISSET(MARK_ISSET)) {
statusbar(_("Mark Set"));
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)
{
UNSET(SAMELINEWRAP);
}
-#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
+#ifndef DISABLE_SPELLER
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)
return TRUE;
}
-#endif
-
-#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
/* External spell checking */
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
return 1;
}
-#if !defined(NANO_SMALL) && !defined(DISABLE_JUSTIFY)
+#ifndef DISABLE_JUSTIFY
int empty_line(const char *data)
{
while (*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
#endif
}
-#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
+#ifndef DISABLE_HELP
void help_init(void)
{
int i, sofar = 0;
void do_toggle(int which)
{
-#ifndef NANO_SMALL
+#ifdef NANO_SMALL
+ nano_disabled_msg();
+#else
char *enabled = _("enabled");
char *disabled = _("disabled");
}
SET(DISABLE_CURPOS);
-#else
- nano_small_msg();
#endif
}
#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'},
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;
/* 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();
#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
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
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);
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;
edit_refresh();
kp = keypad_on(edit, kp);
-#elif defined(NANO_SMALL)
- nano_small_msg();
#elif defined(DISABLE_HELP)
nano_disabled_msg();
#endif