diff --git a/src/global.c b/src/global.c index 11f4e2a3..2a30bdc5 100644 --- a/src/global.c +++ b/src/global.c @@ -326,7 +326,9 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h void add_to_sclist(int menus, const char *scstring, void (*func)(void), int toggle) { static sc *tailsc; +#ifndef NANO_TINY static int counter = 0; +#endif sc *s = (sc *)nmalloc(sizeof(sc)); /* Start the list, or tack on the next item. */ @@ -340,9 +342,11 @@ void add_to_sclist(int menus, const char *scstring, void (*func)(void), int togg /* Fill in the data. */ s->menus = menus; s->scfunc = func; +#ifndef NANO_TINY s->toggle = toggle; if (toggle) s->ordinal = ++counter; +#endif assign_keyinfo(s, scstring); #ifdef DEBUG @@ -1362,10 +1366,11 @@ const char *flagtostr(int flag) * shortcut struct with the corresponding function filled in. */ sc *strtosc(const char *input) { - sc *s; + sc *s = nmalloc(sizeof(sc)); - s = (sc *)nmalloc(sizeof(sc)); +#ifndef NANO_TINY s->toggle = 0; +#endif #ifndef DISABLE_HELP if (!strcasecmp(input, "help")) diff --git a/src/nano.c b/src/nano.c index db371af3..1065b604 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1434,13 +1434,13 @@ void do_toggle(int flag) statusline(HUSH, "%s %s", _(flagtostr(flag)), enabled ? _("enabled") : _("disabled")); } -#endif /* !NANO_TINY */ /* Bleh. */ void do_toggle_void(void) { ; } +#endif /* !NANO_TINY */ /* Disable extended input and output processing in our terminal * settings. */ diff --git a/src/nano.h b/src/nano.h index 013296fe..7f0560d2 100644 --- a/src/nano.h +++ b/src/nano.h @@ -451,11 +451,13 @@ typedef struct sc { /* Which menus this applies to. */ void (*scfunc)(void); /* The function we're going to run. */ +#ifndef NANO_TINY int toggle; /* If a toggle, what we're toggling. */ int ordinal; /* The how-manieth toggle this is, in order to be able to * keep them in sequence. */ +#endif struct sc *next; /* Next in the list. */ } sc; diff --git a/src/proto.h b/src/proto.h index 85f7b10a..85e1db0f 100644 --- a/src/proto.h +++ b/src/proto.h @@ -482,13 +482,7 @@ RETSIGTYPE handle_sigwinch(int signal); void regenerate_screen(void); void allow_sigwinch(bool allow); void do_toggle(int flag); -#endif void do_toggle_void(void); -void disable_extended_io(void); -#ifdef USE_SLANG -void disable_signals(void); -#endif -#ifndef NANO_TINY void enable_signals(void); #endif void disable_flow_control(void); diff --git a/src/rcfile.c b/src/rcfile.c index c34af92b..1b1b5d31 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -455,9 +455,11 @@ void parse_binding(char *ptr, bool dobind) if (f->scfunc == newsc->scfunc) mask = mask | f->menus; +#ifndef NANO_TINY /* Handle the special case of the toggles. */ if (newsc->scfunc == do_toggle_void) mask = MMAIN; +#endif /* Now limit the given menu to those where the function exists. */ if (is_universal(newsc->scfunc)) @@ -497,6 +499,7 @@ void parse_binding(char *ptr, bool dobind) } if (dobind) { +#ifndef NANO_TINY /* If this is a toggle, copy its sequence number. */ if (newsc->scfunc == do_toggle_void) { for (s = sclist; s != NULL; s = s->next) @@ -504,6 +507,7 @@ void parse_binding(char *ptr, bool dobind) newsc->ordinal = s->ordinal; } else newsc->ordinal = 0; +#endif /* Add the new shortcut at the start of the list. */ newsc->next = sclist; sclist = newsc;