summaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko2006-12-16 23:49:13 +0000
committerDenis Vlasenko2006-12-16 23:49:13 +0000
commit9f739445cd3deddd0343c3a8d5a981ede26bef30 (patch)
tree6dc013e44d2281eb1e6f61c4bca1ae7546001f79 /archival
parenta597aaddfa76d589d3e1a37b1f1c3401c2decffd (diff)
downloadbusybox-9f739445cd3deddd0343c3a8d5a981ede26bef30.zip
busybox-9f739445cd3deddd0343c3a8d5a981ede26bef30.tar.gz
inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]
Diffstat (limited to 'archival')
-rw-r--r--archival/bunzip2.c2
-rw-r--r--archival/gunzip.c2
-rw-r--r--archival/gzip.c2
-rw-r--r--archival/tar.c2
-rw-r--r--archival/uncompress.c2
-rw-r--r--archival/unlzma.c2
-rw-r--r--archival/unzip.c3
7 files changed, 7 insertions, 8 deletions
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 @@ int bunzip2_main(int argc, char **argv)
/* 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 @@ int gunzip_main(int argc, char **argv)
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 @@ int gzip_main(int argc, char **argv)
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 @@ int tar_main(int argc, char **argv)
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 uncompress_main(int argc, char **argv)
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 @@ int unlzma_main(int argc, char **argv)
/* 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 @@ int unzip_main(int argc, char **argv)
}
/* 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);