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;
/* 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
long bytes_read;
register FILE *fp;
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
{
fp = stdin;
have_read_stdin = 1;
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;
/* 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
{
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]);
static void
set_input_file (const char *name)
{
- if (!strcmp (name, "-"))
+ if (STREQ (name, "-"))
input_desc = 0;
else
{
/* 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
{
FILE *stream;
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
{
have_read_stdin = 1;
stream = stdin;
error (0, errno, "%s", file);
return 1;
}
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
clearerr (stream); /* Also clear EOF. */
else if (fclose (stream) == EOF)
{
for (; optind < argc; optind++)
{
char *file = argv[optind];
- if (strcmp (file, "-") == 0)
+ if (STREQ (file, "-"))
fmt (stdin);
else
{
static char *line_out = NULL;
static int allocated_out = 0;
- if (!strcmp (filename, "-"))
+ if (STREQ (filename, "-"))
{
istream = stdin;
have_read_stdin = 1;
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;
{
int fd;
- if (!strcmp (filename, "-"))
+ if (STREQ (filename, "-"))
{
have_read_stdin = 1;
filename = _("standard input");
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)
/* 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
FILE *fp;
int err;
- if (strcmp (filename, "-") == 0)
+ if (STREQ (filename, "-"))
{
have_read_stdin = 1;
fp = stdin;
char *line;
size_t line_chars_allocated;
- if (strcmp (checkfile_name, "-") == 0)
+ if (STREQ (checkfile_name, "-"))
{
have_read_stdin = 1;
checkfile_name = _("standard input");
{
FILE *stream;
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
{
have_read_stdin = 1;
stream = stdin;
error (0, errno, "%s", file);
return 1;
}
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
clearerr (stream); /* Also clear EOF. */
else if (fclose (stream) == EOF)
{
/* 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
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;
for (; nfiles; nfiles--, fnamptr++)
{
- if (!strcmp (*fnamptr, "-"))
+ if (STREQ (*fnamptr, "-"))
{
have_read_stdin = 1;
fileptr = stdin;
static int
open_file (char *name, COLUMN *p)
{
- if (!strcmp (name, "-"))
+ if (STREQ (name, "-"))
{
p->name = _("standard input");
p->fp = stdin;
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);
}
/* Open the input file. */
- if (!strcmp (infile, "-"))
+ if (STREQ (infile, "-"))
input_desc = 0;
else
{
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;
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;
register unsigned long checksum = 0;
long total_bytes = 0;
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
{
fd = 0;
have_read_stdin = 1;
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;
else
for (; optind < argc; ++optind)
{
- if (strcmp (argv[optind], "-") == 0)
+ if (STREQ (argv[optind], "-"))
{
have_read_stdin = 1;
errors |= tac_stdin_to_mem ();
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");
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 `--'. */
static void
wc_file (const char *file)
{
- if (!strcmp (file, "-"))
+ if (STREQ (file, "-"))
{
have_read_stdin = 1;
wc (0, file);