1
1

tweaks: complete the exclusion of backups and such from the tiny version

File formats, appending and prepending, and backups are not available
when --enable-tiny is used, so prevent all relevant pieces of code from
getting compiled.  And correct two misspelled ENABLE_TINY to NANO_TINY.
Этот коммит содержится в:
Benno Schulenberg 2017-04-19 13:24:41 +02:00
родитель 700c5c9399
Коммит 3c875f9b59
2 изменённых файлов: 15 добавлений и 10 удалений

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

@ -583,7 +583,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
if (!old_no_newlines)
UNSET(NO_NEWLINES);
}
#endif /* !ENABLE_TINY */
#endif /* !NANO_TINY */
#endif /* !DISABLE_SPELLER */
/* Update the screen to account for the current buffer. */
@ -2200,15 +2200,15 @@ int do_writeout(bool exiting)
} else if (func == backup_file_void) {
TOGGLE(BACKUP_FILE);
continue;
} else
#endif /* !NANO_TINY */
if (func == prepend_void) {
} else if (func == prepend_void) {
method = (method == PREPEND) ? OVERWRITE : PREPEND;
continue;
} else if (func == append_void) {
method = (method == APPEND) ? OVERWRITE : APPEND;
continue;
} else if (func == do_help_void) {
} else
#endif /* !NANO_TINY */
if (func == do_help_void) {
continue;
}

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

@ -1258,19 +1258,24 @@ void shortcut_init(void)
#endif
if (ISSET(TEMP_FILE))
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
#ifndef NANO_TINY
add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0);
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
/* In restricted mode, don't allow Appending, Prepending, nor making
* backups, nor executing a command, nor opening a new buffer. */
if (!ISSET(RESTRICTED)) {
/* Don't allow Appending, Prepending, nor Backups in restricted mode. */
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
#ifndef DISABLE_BROWSER
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
#endif
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0);
}
#endif
#ifndef DISABLE_BROWSER
/* In restricted mode, don't allow entering the file browser. */
if (!ISSET(RESTRICTED))
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
#endif
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
/* Allow exiting from the file browser and the help viewer with
* the same key as they were entered. */
@ -1560,6 +1565,7 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "nexthistory"))
s->scfunc = get_history_newer_void;
#endif
#ifndef NANO_TINY
else if (!strcasecmp(input, "dosformat"))
s->scfunc = dos_format_void;
else if (!strcasecmp(input, "macformat"))
@ -1570,7 +1576,6 @@ sc *strtosc(const char *input)
s->scfunc = prepend_void;
else if (!strcasecmp(input, "backup"))
s->scfunc = backup_file_void;
#ifndef ENABLE_TINY
else if (!strcasecmp(input, "flipexecute"))
s->scfunc = flip_execute_void;
#endif