inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
diff --git a/archival/bunzip2.c b/archival/bunzip2.c
index 757001f..a6cd176 100644
--- a/archival/bunzip2.c
+++ b/archival/bunzip2.c
@@ -23,7 +23,7 @@
/* Set input filename and number */
filename = argv[optind];
- if ((filename) && (filename[0] != '-') && (filename[1] != '\0')) {
+ if (filename && NOT_LONE_DASH(filename)) {
/* Open input file */
src_fd = xopen(filename, O_RDONLY);
} else {
diff --git a/archival/gunzip.c b/archival/gunzip.c
index e24401c..c5deec3 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -58,7 +58,7 @@
optind++;
- if (old_path == NULL || strcmp(old_path, "-") == 0) {
+ if (old_path == NULL || LONE_DASH(old_path)) {
src_fd = STDIN_FILENO;
opt |= GUNZIP_OPT_STDOUT;
USE_DESKTOP(opt &= ~GUNZIP_OPT_VERBOSE;)
diff --git a/archival/gzip.c b/archival/gzip.c
index c9b6753..7124e9b 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1201,7 +1201,7 @@
char *path = NULL;
clear_bufs();
- if (strcmp(argv[i], "-") == 0) {
+ if (LONE_DASH(argv[i])) {
time_stamp = 0;
inFileNum = STDIN_FILENO;
outFileNum = STDOUT_FILENO;
diff --git a/archival/tar.c b/archival/tar.c
index 79c3595..ba7cb0f 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -851,7 +851,7 @@
flags = O_RDONLY;
}
- if (tar_filename[0] == '-' && !tar_filename[1]) {
+ if (LONE_DASH(tar_filename)) {
tar_handle->src_fd = fileno(tar_stream);
tar_handle->seek = seek_by_read;
} else {
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 3c78961..4611790 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -25,7 +25,7 @@
int src_fd;
int dst_fd;
- if (strcmp(compressed_file, "-") == 0) {
+ if (LONE_DASH(compressed_file)) {
src_fd = STDIN_FILENO;
flags |= GUNZIP_TO_STDOUT;
} else {
diff --git a/archival/unlzma.c b/archival/unlzma.c
index 46fbefd..20c4ff2 100644
--- a/archival/unlzma.c
+++ b/archival/unlzma.c
@@ -26,7 +26,7 @@
/* Set input filename and number */
filename = argv[optind];
- if (filename && (filename[0] != '-') && (filename[1] != '\0')) {
+ if (filename && NOT_LONE_DASH(filename)) {
/* Open input file */
src_fd = xopen(filename, O_RDONLY);
} else {
diff --git a/archival/unzip.c b/archival/unzip.c
index 8b1c281..f553eef 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -187,11 +187,10 @@
}
/* Open input file */
- if (strcmp("-", src_fn) == 0) {
+ if (LONE_DASH(src_fn)) {
src_fd = STDIN_FILENO;
/* Cannot use prompt mode since zip data is arriving on STDIN */
overwrite = (overwrite == o_prompt) ? o_never : overwrite;
-
} else {
static const char *const extn[] = {"", ".zip", ".ZIP"};
int orig_src_fn_len = strlen(src_fn);