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.
master
Benno Schulenberg 2020-09-12 11:40:08 +02:00
parent ba049fcaf8
commit f883465263
3 changed files with 11 additions and 2 deletions

View File

@ -719,7 +719,6 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
#ifndef NANO_TINY #ifndef NANO_TINY
block_sigwinch(FALSE); block_sigwinch(FALSE);
#endif
/* When reading from stdin, restore the terminal and reenter curses mode. */ /* When reading from stdin, restore the terminal and reenter curses mode. */
if (isendwin()) { if (isendwin()) {
@ -728,6 +727,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
terminal_init(); terminal_init();
doupdate(); doupdate();
} }
#endif
/* If there was a real error during the reading, let the user know. */ /* If there was a real error during the reading, let the user know. */
if (ferror(f) && errornumber != EINTR && errornumber != 0) if (ferror(f) && errornumber != EINTR && errornumber != 0)

View File

@ -491,11 +491,13 @@ void print_opt(const char *shortflag, const char *longflag, const char *desc)
void usage(void) void usage(void)
{ {
printf(_("Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...\n\n")); printf(_("Usage: nano [OPTIONS] [[+LINE[,COLUMN]] FILE]...\n\n"));
#ifndef NANO_TINY
/* TRANSLATORS: The next two strings are part of the --help output. /* TRANSLATORS: The next two strings are part of the --help output.
* It's best to keep its lines within 80 characters. */ * 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" 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")); "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")); 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. */ /* TRANSLATORS: The next three are column headers of the --help output. */
print_opt(_("Option"), _("Long option"), N_("Meaning")); print_opt(_("Option"), _("Long option"), N_("Meaning"));
#ifndef NANO_TINY #ifndef NANO_TINY
@ -803,6 +805,7 @@ void restore_handler_for_Ctrl_C(void)
disable_kb_interrupt(); disable_kb_interrupt();
} }
#ifndef NANO_TINY
/* Reconnect standard input to the tty, and store its state. */ /* Reconnect standard input to the tty, and store its state. */
void reconnect_and_store_state(void) void reconnect_and_store_state(void)
{ {
@ -860,6 +863,7 @@ bool scoop_stdin(void)
return TRUE; return TRUE;
} }
#endif
/* Register half a dozen signal handlers. */ /* Register half a dozen signal handlers. */
void signal_init(void) void signal_init(void)
@ -2411,13 +2415,16 @@ int main(int argc, char **argv)
statusline(ALERT, _("Invalid line or column number")); statusline(ALERT, _("Invalid line or column number"));
} }
#ifndef NANO_TINY
/* If the filename is a dash, read from standard input; otherwise, /* If the filename is a dash, read from standard input; otherwise,
* open the file; skip positioning the cursor if either failed. */ * open the file; skip positioning the cursor if either failed. */
if (strcmp(argv[optind], "-") == 0) { if (strcmp(argv[optind], "-") == 0) {
optind++; optind++;
if (!scoop_stdin()) if (!scoop_stdin())
continue; continue;
} else if (!open_buffer(argv[optind++], TRUE)) } else
#endif
if (!open_buffer(argv[optind++], TRUE))
continue; continue;
/* If a position was given on the command line, go there. */ /* If a position was given on the command line, go there. */

View File

@ -400,7 +400,9 @@ void die(const char *msg, ...);
void window_init(void); void window_init(void);
void install_handler_for_Ctrl_C(void); void install_handler_for_Ctrl_C(void);
void restore_handler_for_Ctrl_C(void); void restore_handler_for_Ctrl_C(void);
#ifndef NANO_TINY
void reconnect_and_store_state(void); void reconnect_and_store_state(void);
#endif
RETSIGTYPE handle_hupterm(int signal); RETSIGTYPE handle_hupterm(int signal);
#ifndef DEBUG #ifndef DEBUG
RETSIGTYPE handle_crash(int signal); RETSIGTYPE handle_crash(int signal);