diff options
author | Jim Meyering <jim@meyering.net> | 2004-01-21 22:53:49 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-01-21 22:53:49 +0000 |
commit | b74d9dcfade2452b986a89f3932514d8c47654ac (patch) | |
tree | 5bbe89c853270e963c8a34d7bce4246c0a57faa2 /src | |
parent | 8abeccf9d479656951ff5733444d94ba9eee59e0 (diff) | |
download | coreutils-b74d9dcfade2452b986a89f3932514d8c47654ac.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/dd.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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); } } |