tweaks: use a symbol instead of zero to refer to standard input

master
Benno Schulenberg 2019-05-28 12:31:16 +02:00
parent 33e1bf1435
commit b75563b88e
3 changed files with 5 additions and 3 deletions

View File

@ -827,7 +827,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
/* When reading from stdin, restore the terminal and reenter curses mode. */
if (isendwin()) {
if (!isatty(0))
if (!isatty(STANDARD_INPUT))
reconnect_and_store_state();
terminal_init();
doupdate();

View File

@ -1078,7 +1078,7 @@ void reconnect_and_store_state(void)
if (thetty < 1)
die(_("Could not reconnect stdin to keyboard\n"));
dup2(thetty, 0);
dup2(thetty, STANDARD_INPUT);
close(thetty);
/* If input was not cut short, store the current state of the terminal. */
@ -1096,7 +1096,7 @@ bool scoop_stdin(void)
tcsetattr(0, TCSANOW, &oldterm);
/* When input comes from a terminal, show a helpful message. */
if (isatty(0))
if (isatty(STANDARD_INPUT))
fprintf(stderr, _("Reading data from keyboard; "
"type ^D or ^D^D to finish.\n"));

View File

@ -146,6 +146,8 @@
#define BAD_COLOR -2
#endif
#define STANDARD_INPUT 0
/* Enumeration types. */
typedef enum {
NIX_FILE, DOS_FILE, MAC_FILE