Make IS_INTERACTIVE() macro.

This commit is contained in:
Dianne Skoll
2025-08-19 21:39:31 -04:00
parent 4661b454c0
commit 71bfe31002

View File

@@ -278,6 +278,8 @@ int ReadLine(void)
return ReadLineFromFile(0);
}
#define IS_INTERACTIVE() (fp && fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO))
/***************************************************************/
/* */
/* ReadLineFromFile */
@@ -304,7 +306,7 @@ static int ReadLineFromFile(int use_pclose)
LineNoStart = LineNo+1;
while(fp) {
#ifdef USE_READLINE
if (fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
if (IS_INTERACTIVE()) {
char *lin;
if (should_ignore_line()) {
if (read_some) {
@@ -410,7 +412,7 @@ static int ReadLineFromFile(int use_pclose)
}
#ifdef USE_READLINE_HISTORY
if (fp && fileno(fp) == STDIN_FILENO && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) {
if (IS_INTERACTIVE()) {
add_history(CurLine);
}
#endif