inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid]

This commit is contained in:
Denis Vlasenko
2006-12-16 23:49:13 +00:00
parent a597aaddfa
commit 9f739445cd
28 changed files with 69 additions and 63 deletions

View File

@@ -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 {

View File

@@ -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;)

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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);