aboutsummaryrefslogtreecommitdiff
path: root/grab.c
diff options
context:
space:
mode:
Diffstat (limited to 'grab.c')
-rw-r--r--grab.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/grab.c b/grab.c
index f42521d..7c8fdc9 100644
--- a/grab.c
+++ b/grab.c
@@ -27,6 +27,7 @@
warn(__VA_ARGS__); \
rv = EXIT_FAILURE; \
} while (0)
+#define streq(a, b) (!strcmp(a, b))
#define EEARLY "Input string terminated prematurely"
@@ -133,7 +134,7 @@ main(int argc, char **argv)
filecnt = argc - 1;
if (isatty(STDOUT_FILENO) == 1 && !env_or_default("NO_COLOR", nullptr))
- color = strcmp(env_or_default("TERM", ""), "dumb");
+ color = !streq(env_or_default("TERM", ""), "dumb");
ops = comppat(argv[0]);
if (argc == 1)
@@ -142,7 +143,7 @@ main(int argc, char **argv)
for (int i = 1; i < argc; i++) {
FILE *fp;
- if (strcmp(argv[i], "-") == 0) {
+ if (streq(argv[i], "-")) {
grab(ops, stdin, "-");
} else if ((fp = fopen(argv[i], "r")) == nullptr) {
warn("fopen: %s", argv[i]);