tweaks: use a symbol instead of zero to refer to standard input
Этот коммит содержится в:
родитель
33e1bf1435
Коммит
b75563b88e
@ -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();
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -146,6 +146,8 @@
|
||||
#define BAD_COLOR -2
|
||||
#endif
|
||||
|
||||
#define STANDARD_INPUT 0
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user