commit f8834652630027c07bfe7d95980e8da0e8ffaac8
parent ba049fcaf8154b22d58c4d8d26a810b1330c6edc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 12 Sep 2020 11:40:08 +0200
build: exclude reading a file from standard input from the tiny version
The tiny version is about being small, not about convenience features
that hardly anyone uses anyway.
Also exclude the description of the "+line[,column]" feature -- it is
unneeded verbosity.
This addresses https://savannah.gnu.org/bugs/?59101.
Diffstat:
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -719,7 +719,6 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
#ifndef NANO_TINY
block_sigwinch(FALSE);
-#endif
/* When reading from stdin, restore the terminal and reenter curses mode. */
if (isendwin()) {
@@ -728,6 +727,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
terminal_init();
doupdate();
}
+#endif
/* If there was a real error during the reading, let the user know. */
if (ferror(f) && errornumber != EINTR && errornumber != 0)
diff --git a/src/nano.c b/src/nano.c
@@ -491,11 +491,13 @@ void print_opt(const char *shortflag, const char *longflag, const char *desc)
void usage(void)
{
printf(_("Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...\n\n"));
+#ifndef NANO_TINY
/* TRANSLATORS: The next two strings are part of the --help output.
* It's best to keep its lines within 80 characters. */
printf(_("To place the cursor on a specific line of a file, put the line number with\n"
"a '+' before the filename. The column number can be added after a comma.\n"));
printf(_("When a filename is '-', nano reads data from standard input.\n\n"));
+#endif
/* TRANSLATORS: The next three are column headers of the --help output. */
print_opt(_("Option"), _("Long option"), N_("Meaning"));
#ifndef NANO_TINY
@@ -803,6 +805,7 @@ void restore_handler_for_Ctrl_C(void)
disable_kb_interrupt();
}
+#ifndef NANO_TINY
/* Reconnect standard input to the tty, and store its state. */
void reconnect_and_store_state(void)
{
@@ -860,6 +863,7 @@ bool scoop_stdin(void)
return TRUE;
}
+#endif
/* Register half a dozen signal handlers. */
void signal_init(void)
@@ -2411,13 +2415,16 @@ int main(int argc, char **argv)
statusline(ALERT, _("Invalid line or column number"));
}
+#ifndef NANO_TINY
/* If the filename is a dash, read from standard input; otherwise,
* open the file; skip positioning the cursor if either failed. */
if (strcmp(argv[optind], "-") == 0) {
optind++;
if (!scoop_stdin())
continue;
- } else if (!open_buffer(argv[optind++], TRUE))
+ } else
+#endif
+ if (!open_buffer(argv[optind++], TRUE))
continue;
/* If a position was given on the command line, go there. */
diff --git a/src/prototypes.h b/src/prototypes.h
@@ -400,7 +400,9 @@ void die(const char *msg, ...);
void window_init(void);
void install_handler_for_Ctrl_C(void);
void restore_handler_for_Ctrl_C(void);
+#ifndef NANO_TINY
void reconnect_and_store_state(void);
+#endif
RETSIGTYPE handle_hupterm(int signal);
#ifndef DEBUG
RETSIGTYPE handle_crash(int signal);