diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cat.c | 2 | ||||
-rw-r--r-- | src/cksum.c | 8 | ||||
-rw-r--r-- | src/comm.c | 5 | ||||
-rw-r--r-- | src/csplit.c | 2 | ||||
-rw-r--r-- | src/cut.c | 6 | ||||
-rw-r--r-- | src/fmt.c | 2 | ||||
-rw-r--r-- | src/fold.c | 6 | ||||
-rw-r--r-- | src/head.c | 2 | ||||
-rw-r--r-- | src/join.c | 4 | ||||
-rw-r--r-- | src/md5sum.c | 6 | ||||
-rw-r--r-- | src/nl.c | 4 | ||||
-rw-r--r-- | src/paste.c | 6 | ||||
-rw-r--r-- | src/pr.c | 4 | ||||
-rw-r--r-- | src/split.c | 2 | ||||
-rw-r--r-- | src/sum.c | 12 | ||||
-rw-r--r-- | src/tac.c | 2 | ||||
-rw-r--r-- | src/uniq.c | 6 | ||||
-rw-r--r-- | src/wc.c | 2 |
18 files changed, 40 insertions, 41 deletions
@@ -722,7 +722,7 @@ main (int argc, char **argv) free (inbuf); contin: - if (strcmp (infile, "-") && close (input_desc) < 0) + if (!STREQ (infile, "-") && close (input_desc) < 0) { error (0, errno, "%s", infile); exit_status = 1; diff --git a/src/cksum.c b/src/cksum.c index 77588fd03..e34499f59 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -1,5 +1,5 @@ /* cksum -- calculate and print POSIX.2 checksums and sizes of files - Copyright (C) 92, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 92, 95, 96, 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -202,7 +202,7 @@ cksum (char *file, int print_name) long bytes_read; register FILE *fp; - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { fp = stdin; have_read_stdin = 1; @@ -229,12 +229,12 @@ cksum (char *file, int print_name) if (ferror (fp)) { error (0, errno, "%s", file); - if (strcmp (file, "-")) + if (!STREQ (file, "-")) fclose (fp); return -1; } - if (strcmp (file, "-") && fclose (fp) == EOF) + if (!STREQ (file, "-") && fclose (fp) == EOF) { error (0, errno, "%s", file); return -1; diff --git a/src/comm.c b/src/comm.c index 777551e05..20e232a26 100644 --- a/src/comm.c +++ b/src/comm.c @@ -1,5 +1,5 @@ /* comm -- compare two sorted files line by line. - Copyright (C) 86, 90, 91, 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 86, 90, 91, 95, 96, 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -148,8 +148,7 @@ compare_files (char **infiles) { initbuffer (&lb1[i]); thisline[i] = &lb1[i]; - streams[i] = strcmp (infiles[i], "-") - ? fopen (infiles[i], "r") : stdin; + streams[i] = (STREQ (infiles[i], "-") ? stdin : fopen (infiles[i], "r")); if (!streams[i]) { error (0, errno, "%s", infiles[i]); diff --git a/src/csplit.c b/src/csplit.c index d56ab7481..0e3d1068a 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -689,7 +689,7 @@ no_more_lines (void) static void set_input_file (const char *name) { - if (!strcmp (name, "-")) + if (STREQ (name, "-")) input_desc = 0; else { @@ -1,5 +1,5 @@ /* cut - remove parts of lines of files - Copyright (C) 1984, 1997 by David M. Ihnat + Copyright (C) 1984, 1997, 1998 by David M. Ihnat This program is a total rewrite of the Bell Laboratories Unix(Tm) command of the same name, as of System V. It contains no proprietary @@ -644,7 +644,7 @@ cut_file (char *file) { FILE *stream; - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { have_read_stdin = 1; stream = stdin; @@ -666,7 +666,7 @@ cut_file (char *file) error (0, errno, "%s", file); return 1; } - if (!strcmp (file, "-")) + if (STREQ (file, "-")) clearerr (stream); /* Also clear EOF. */ else if (fclose (stream) == EOF) { @@ -400,7 +400,7 @@ main (register int argc, register char **argv) for (; optind < argc; optind++) { char *file = argv[optind]; - if (strcmp (file, "-") == 0) + if (STREQ (file, "-")) fmt (stdin); else { diff --git a/src/fold.c b/src/fold.c index 7e4cb57aa..44233d502 100644 --- a/src/fold.c +++ b/src/fold.c @@ -123,7 +123,7 @@ fold_file (char *filename, int width) static char *line_out = NULL; static int allocated_out = 0; - if (!strcmp (filename, "-")) + if (STREQ (filename, "-")) { istream = stdin; have_read_stdin = 1; @@ -212,11 +212,11 @@ fold_file (char *filename, int width) if (ferror (istream)) { error (0, errno, "%s", filename); - if (strcmp (filename, "-")) + if (!STREQ (filename, "-")) fclose (istream); return 1; } - if (strcmp (filename, "-") && fclose (istream) == EOF) + if (!STREQ (filename, "-") && fclose (istream) == EOF) { error (0, errno, "%s", filename); return 1; diff --git a/src/head.c b/src/head.c index 42f76e423..3052df197 100644 --- a/src/head.c +++ b/src/head.c @@ -184,7 +184,7 @@ head_file (const char *filename, U_LONG_LONG n_units, int count_lines) { int fd; - if (!strcmp (filename, "-")) + if (STREQ (filename, "-")) { have_read_stdin = 1; filename = _("standard input"); diff --git a/src/join.c b/src/join.c index 0c1207ddf..7e0e1205a 100644 --- a/src/join.c +++ b/src/join.c @@ -843,10 +843,10 @@ main (int argc, char **argv) usage (1); } - fp1 = strcmp (names[0], "-") ? fopen (names[0], "r") : stdin; + fp1 = STREQ (names[0], "-") ? stdin : fopen (names[0], "r"); if (!fp1) error (EXIT_FAILURE, errno, "%s", names[0]); - fp2 = strcmp (names[1], "-") ? fopen (names[1], "r") : stdin; + fp2 = STREQ (names[1], "-") ? stdin : fopen (names[1], "r"); if (!fp2) error (EXIT_FAILURE, errno, "%s", names[1]); if (fp1 == fp2) diff --git a/src/md5sum.c b/src/md5sum.c index 11cd0c1fa..1700563fd 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -1,6 +1,6 @@ /* Compute MD5 checksum of files or strings according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 95, 96, 1997 Free Software Foundation, Inc. + Copyright (C) 95, 96, 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -240,7 +240,7 @@ md5_file (const char *filename, int binary, unsigned char *md5_result) FILE *fp; int err; - if (strcmp (filename, "-") == 0) + if (STREQ (filename, "-")) { have_read_stdin = 1; fp = stdin; @@ -289,7 +289,7 @@ md5_check (const char *checkfile_name) char *line; size_t line_chars_allocated; - if (strcmp (checkfile_name, "-") == 0) + if (STREQ (checkfile_name, "-")) { have_read_stdin = 1; checkfile_name = _("standard input"); @@ -414,7 +414,7 @@ nl_file (const char *file) { FILE *stream; - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { have_read_stdin = 1; stream = stdin; @@ -436,7 +436,7 @@ nl_file (const char *file) error (0, errno, "%s", file); return 1; } - if (!strcmp (file, "-")) + if (STREQ (file, "-")) clearerr (stream); /* Also clear EOF. */ else if (fclose (stream) == EOF) { diff --git a/src/paste.c b/src/paste.c index a623966d1..9f9850972 100644 --- a/src/paste.c +++ b/src/paste.c @@ -1,5 +1,5 @@ /* paste - merge lines of files - Copyright (C) 1984, 1997 by David M. Ihnat + Copyright (C) 1984, 1997, 1998 by David M. Ihnat This program is a total rewrite of the Bell Laboratories Unix(Tm) command of the same name, as of System V. It contains no proprietary @@ -194,7 +194,7 @@ paste_parallel (int nfiles, char **fnamptr) fileptr = (FILE **) xrealloc ((char *) fileptr, (file_list_size + 1) * sizeof (FILE *)); } - if (!strcmp (fnamptr[files_open], "-")) + if (STREQ (fnamptr[files_open], "-")) { have_read_stdin = 1; fileptr[files_open] = stdin; @@ -332,7 +332,7 @@ paste_serial (int nfiles, char **fnamptr) for (; nfiles; nfiles--, fnamptr++) { - if (!strcmp (*fnamptr, "-")) + if (STREQ (*fnamptr, "-")) { have_read_stdin = 1; fileptr = stdin; @@ -1192,7 +1192,7 @@ init_funcs (void) static int open_file (char *name, COLUMN *p) { - if (!strcmp (name, "-")) + if (STREQ (name, "-")) { p->name = _("standard input"); p->fp = stdin; @@ -1376,7 +1376,7 @@ init_header (char *filename, int desc) char t_buf[T_BUF_SIZE]; /* If parallel files or standard input, use current time. */ - if (desc < 0 || !strcmp (filename, "-") || fstat (desc, &st)) + if (desc < 0 || STREQ (filename, "-") || fstat (desc, &st)) st.st_mtime = time (NULL); tmptr = localtime (&st.st_mtime); diff --git a/src/split.c b/src/split.c index bce8b8d3c..a6624d943 100644 --- a/src/split.c +++ b/src/split.c @@ -486,7 +486,7 @@ main (int argc, char **argv) } /* Open the input file. */ - if (!strcmp (infile, "-")) + if (STREQ (infile, "-")) input_desc = 0; else { @@ -92,7 +92,7 @@ bsd_sum_file (const char *file, int print_name) register long total_bytes = 0; /* The number of bytes. */ register int ch; /* Each character read. */ - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { fp = stdin; have_read_stdin = 1; @@ -118,12 +118,12 @@ bsd_sum_file (const char *file, int print_name) if (ferror (fp)) { error (0, errno, "%s", file); - if (strcmp (file, "-")) + if (!STREQ (file, "-")) fclose (fp); return -1; } - if (strcmp (file, "-") && fclose (fp) == EOF) + if (!STREQ (file, "-") && fclose (fp) == EOF) { error (0, errno, "%s", file); return -1; @@ -151,7 +151,7 @@ sysv_sum_file (const char *file, int print_name) register unsigned long checksum = 0; long total_bytes = 0; - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { fd = 0; have_read_stdin = 1; @@ -178,12 +178,12 @@ sysv_sum_file (const char *file, int print_name) if (bytes_read < 0) { error (0, errno, "%s", file); - if (strcmp (file, "-")) + if (!STREQ (file, "-")) close (fd); return -1; } - if (strcmp (file, "-") && close (fd) == -1) + if (!STREQ (file, "-") && close (fd) == -1) { error (0, errno, "%s", file); return -1; @@ -638,7 +638,7 @@ main (int argc, char **argv) else for (; optind < argc; ++optind) { - if (strcmp (argv[optind], "-") == 0) + if (STREQ (argv[optind], "-")) { have_read_stdin = 1; errors |= tac_stdin_to_mem (); diff --git a/src/uniq.c b/src/uniq.c index 176c86571..27395afd3 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -216,14 +216,14 @@ check_file (const char *infile, const char *outfile) int prevlen, thislen; int match_count = 0; - if (!strcmp (infile, "-")) + if (STREQ (infile, "-")) istream = stdin; else istream = fopen (infile, "r"); if (istream == NULL) error (EXIT_FAILURE, errno, "%s", infile); - if (!strcmp (outfile, "-")) + if (STREQ (outfile, "-")) ostream = stdout; else ostream = fopen (outfile, "w"); @@ -379,7 +379,7 @@ main (int argc, char **argv) if (show_help) usage (0); - if (optind >= 2 && strcmp (argv[optind - 1], "--") != 0) + if (optind >= 2 && !STREQ (argv[optind - 1], "--")) { /* Interpret non-option arguments with leading `+' only if we haven't seen `--'. */ @@ -267,7 +267,7 @@ wc (int fd, const char *file) static void wc_file (const char *file) { - if (!strcmp (file, "-")) + if (STREQ (file, "-")) { have_read_stdin = 1; wc (0, file); |