From b74d9dcfade2452b986a89f3932514d8c47654ac Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 21 Jan 2004 22:53:49 +0000 Subject: (usage): Use EXIT_SUCCESS, not 0, for clarity. (dd_copy): Exit with status EXIT_FAILURE, not 2, on errors. (write_output, skip, dd_copy): Don't assume EXIT_FAILURE == 1, as POSIX doesn't require it. --- src/dd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dd.c b/src/dd.c index 129ab6ab9..c49183187 100644 --- a/src/dd.c +++ b/src/dd.c @@ -1,5 +1,5 @@ /* dd -- convert a file while copying it. - Copyright (C) 85, 90, 91, 1995-2003 Free Software Foundation, Inc. + Copyright (C) 85, 90, 91, 1995-2004 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 @@ -279,7 +279,7 @@ static char const ebcdic_to_ascii[] = void usage (int status) { - if (status != 0) + if (status != EXIT_SUCCESS) fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else @@ -479,7 +479,7 @@ write_output (void) error (0, errno, _("writing to %s"), quote (output_file)); if (nwritten != 0) w_partial++; - quit (1); + quit (EXIT_FAILURE); } else w_full++; @@ -823,7 +823,7 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize, if (nread == SAFE_READ_ERROR) { error (0, errno, _("reading %s"), quote (file)); - quit (1); + quit (EXIT_FAILURE); } /* POSIX doesn't say what to do when dd detects it has been asked to skip past EOF, so I assume it's non-fatal. @@ -937,7 +937,7 @@ dd_copy (void) char *real_buf; /* real buffer address before alignment */ char *real_obuf; size_t nread; /* Bytes read in the current block. */ - int exit_status = 0; + int exit_status = EXIT_SUCCESS; size_t page_size = getpagesize (); size_t n_bytes_read; @@ -1032,7 +1032,7 @@ dd_copy (void) else { /* Write any partial block. */ - exit_status = 2; + exit_status = EXIT_FAILURE; break; } } @@ -1061,7 +1061,7 @@ dd_copy (void) if (nwritten != n_bytes_read) { error (0, errno, _("writing %s"), quote (output_file)); - quit (1); + quit (EXIT_FAILURE); } else if (n_bytes_read == input_blocksize) w_full++; @@ -1122,7 +1122,7 @@ dd_copy (void) if (nwritten != oc) { error (0, errno, _("writing %s"), quote (output_file)); - quit (1); + quit (EXIT_FAILURE); } } -- cgit v1.2.3-70-g09d2