Skip to content

Commit

Permalink
Corrected bug with stdin input.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-manske committed Apr 15, 2024
1 parent 1f95d72 commit f9a8e5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xd.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ int main(int argc, char **argv)
}
}

if (!(hexfl->hex_flags & HEXDFL_MASK_COLOR) && isatty(STDOUT_FILENO) && !getenv("NO_COLOR"))
if (!(hexfl->hex_flags & HEXDFL_MASK_COLOR) && isatty(STDOUT_FILENO) && !getenv("$NO_COLOR"))
hexfl->hex_flags |= HEXDFL_COLORED;

if (!argv[optind]) argv[optind] = "-";
Expand All @@ -318,7 +318,7 @@ int main(int argc, char **argv)
continue;
}

if (isatty(fileno(input))) { /* saves input to a temporary file */
if (isatty(fileno(input)) || input == stdin) { /* saves input to a temporary file */
int ch;
FILE *tmp = tmpfile();
while ((ch = fgetc(input)) != EOF) fputc(ch, tmp);
Expand Down

0 comments on commit f9a8e5a

Please sign in to comment.