From 713c315978828f693f84e10302cdf895816b4c5e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 14 Apr 1998 15:17:32 +0000 Subject: Use STREQ in string equality tests, not strcmp. --- src/df.c | 2 +- src/dircolors.c | 6 +++--- src/du.c | 2 +- src/ls.c | 2 +- src/remove.c | 2 +- src/touch.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/df.c b/src/df.c index c14e89ce3..82cb419e8 100644 --- a/src/df.c +++ b/src/df.c @@ -583,7 +583,7 @@ main (int argc, char **argv) human_readable_base = 1024; output_units = 1; } - else if (bs && strcmp (bs, "SI") == 0) + else if (bs && STREQ (bs, "SI")) { human_readable_base = 1000; output_units = 1; diff --git a/src/dircolors.c b/src/dircolors.c index 336c0580c..6f0a3c8f8 100644 --- a/src/dircolors.c +++ b/src/dircolors.c @@ -1,5 +1,5 @@ /* dircolors - output commands to set the LS_COLOR environment variable - Copyright (C) 1994, 1995, 1997 H. Peter Anvin + Copyright (C) 1994, 1995, 1997, 1998 H. Peter Anvin Copyright (C) 96, 97, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -295,7 +295,7 @@ dc_parse_stream (FILE *fp, const char *filename) unrecognized = 0; if (strcasecmp (keywd, "TERM") == 0) { - if (strcmp (arg, term) == 0) + if (STREQ (arg, term)) state = ST_TERMSURE; else if (state != ST_TERMSURE) state = ST_TERMNO; @@ -376,7 +376,7 @@ dc_parse_file (const char *filename) FILE *fp; int err; - if (strcmp (filename, "-") == 0) + if (STREQ (filename, "-")) { have_read_stdin = 1; fp = stdin; diff --git a/src/du.c b/src/du.c index 165d0dfd8..b8a4c9aff 100644 --- a/src/du.c +++ b/src/du.c @@ -274,7 +274,7 @@ main (int argc, char **argv) human_readable_base = 1024; output_units = 1; } - else if (bs && strcmp (bs, "SI") == 0) + else if (bs && STREQ (bs, "SI")) { human_readable_base = 1000; output_units = 1; diff --git a/src/ls.c b/src/ls.c index 66489ad06..126496641 100644 --- a/src/ls.c +++ b/src/ls.c @@ -860,7 +860,7 @@ decode_switches (int argc, char **argv) if ((p = getenv ("BLOCKSIZE")) && strncmp (p, "HUMAN", sizeof ("HUMAN") - 1) == 0) human_readable_base = 1024; - else if (p && strcmp (p, "SI") == 0) + else if (p && STREQ (p, "SI")) human_readable_base = 1000; line_length = 80; diff --git a/src/remove.c b/src/remove.c index 6d9f57538..1bb3b5d8a 100644 --- a/src/remove.c +++ b/src/remove.c @@ -206,7 +206,7 @@ hash_pjw (const void *x, unsigned int tablesize) static bool hash_compare_strings (void const *x, void const *y) { - return strcmp (x, y) == 0; + return STREQ (x, y); } static inline void diff --git a/src/touch.c b/src/touch.c index 7f90b5f52..8bb24b8d5 100644 --- a/src/touch.c +++ b/src/touch.c @@ -366,7 +366,7 @@ main (int argc, char **argv) date_set++; } - if (!date_set && optind < argc && strcmp (argv[optind - 1], "--")) + if (!date_set && optind < argc && !STREQ (argv[optind - 1], "--")) { newtime = posixtime (argv[optind]); if (newtime != (time_t) -1) -- cgit v1.2.3-70-g09d2