]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: go back to using ‘error’
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 1 Jul 2023 18:31:40 +0000 (11:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 1 Jul 2023 18:51:16 +0000 (11:51 -0700)
Now that Gnulib’s ‘error’ module does proper static checking
for not returning, we need no longer use the ‘die’ macro.
This makes code easier to read for people that are used to ‘error’.
* cfg.mk (error_fns, exclude_file_name_regexp): Remove ‘die’.
(sc_die_EXIT_FAILURE): Remove.
* src/die.h: Remove.  All includes removed.  All calls to ‘die’
changed back to calls to ‘error’.
* src/install.c (get_ids): Use quoteaf (problem found with
make syntax-check).
* src/system.h: Include error.h, since some of our macros call ‘error’.
Stop including error.h elsewhere.

106 files changed:
cfg.mk
src/basename.c
src/basenc.c
src/cat.c
src/chcon.c
src/chgrp.c
src/chmod.c
src/chown-core.c
src/chown.c
src/chroot.c
src/cksum.c
src/comm.c
src/copy.c
src/coreutils.c
src/cp.c
src/csplit.c
src/cut.c
src/date.c
src/dd.c
src/df.c
src/die.h [deleted file]
src/digest.c
src/dircolors.c
src/dirname.c
src/du.c
src/env.c
src/expand-common.c
src/expand.c
src/expr.c
src/factor.c
src/find-mount-point.c
src/fmt.c
src/fold.c
src/group-list.c
src/groups.c
src/head.c
src/hostid.c
src/hostname.c
src/id.c
src/install.c
src/join.c
src/kill.c
src/link.c
src/ln.c
src/local.mk
src/logname.c
src/ls.c
src/mkdir.c
src/mkfifo.c
src/mknod.c
src/mktemp.c
src/mv.c
src/nice.c
src/nl.c
src/nohup.c
src/nproc.c
src/numfmt.c
src/od.c
src/operand2sig.c
src/paste.c
src/pathchk.c
src/pinky.c
src/pr.c
src/printf.c
src/ptx.c
src/pwd.c
src/readlink.c
src/realpath.c
src/relpath.c
src/remove.c
src/rm.c
src/rmdir.c
src/runcon.c
src/seq.c
src/set-fields.c
src/shred.c
src/shuf.c
src/sleep.c
src/sort.c
src/split.c
src/stat.c
src/stdbuf.c
src/stty.c
src/sync.c
src/system.h
src/tac-pipe.c
src/tac.c
src/tail.c
src/tee.c
src/timeout.c
src/touch.c
src/tr.c
src/truncate.c
src/tsort.c
src/tty.c
src/uname.c
src/unexpand.c
src/uniq.c
src/unlink.c
src/uptime.c
src/users.c
src/wc.c
src/wc_avx2.c
src/who.c
src/whoami.c
src/yes.c

diff --git a/cfg.mk b/cfg.mk
index 6ba8981abc502527e8b2fae23d65818ccbfb4e81..e7b0519c407224d960f658eec9328ffc9a5ee18a 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -190,7 +190,7 @@ sc_prohibit_quotes_notation:
               exit 1; }  \
          || :
 
-error_fns = (error|die|diagnose)
+error_fns = (error|diagnose)
 
 # Files in src/ should quote all strings in error() output, so that
 # unexpected input chars like \r etc. don't corrupt the error.
@@ -235,16 +235,6 @@ sc_error_shell_always_quotes:
               exit 1; }  \
          || :
 
-# Usage of error() with an exit constant, should instead use die(),
-# as that avoids warnings and may generate better code, due to being apparent
-# to the compiler that it doesn't return.
-sc_die_EXIT_FAILURE:
-       @cd $(srcdir)/src && GIT_PAGER= git grep -E \
-           'error \([^?]*EXIT_' \
-         && { echo '$(ME): '"Use die() instead of error" 1>&2; \
-              exit 1; }  \
-         || :
-
 # Avoid unstyled quoting to internal slots and thus destined for diagnostics
 # as that can leak unescaped control characters to the output, when using
 # the default "literal" quoting style.
@@ -846,7 +836,7 @@ exclude_file_name_regexp--sc_bindtextdomain = \
 exclude_file_name_regexp--sc_trailing_blank = \
   ^(tests/pr/|gl/.*\.diff$$|man/help2man)
 exclude_file_name_regexp--sc_system_h_headers = \
-  ^src/((die|system|copy|chown-core|find-mount-point)\.h|make-prime-list\.c)$$
+  ^src/((system|copy|chown-core|find-mount-point)\.h|make-prime-list\.c)$$
 
 _src = (false|lbracket|ls-(dir|ls|vdir)|tac-pipe|uname-(arch|uname))
 _gl_src = (xdecto.max|cl-strtold)
index e5c0ace19aa897d34080c2c79be3c7edf8ce3b63..479815bebc341d75c7f4bf34bdc64e60e04ee34c 100644 (file)
@@ -20,7 +20,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "error.h"
 #include "quote.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
index dd1e4266435fa963e86405a8bd852284c182942e..9152ad0deb68a16996e83a131654e0e948362d65 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "system.h"
 #include "c-ctype.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "idx.h"
 #include "quote.h"
@@ -614,8 +612,8 @@ z85_encode (char const *restrict in, idx_t inlen,
             return;
 
           /* currently, there's no way to return an error in encoding.  */
-          die (EXIT_FAILURE, 0,
-               _("invalid input (length must be multiple of 4 characters)"));
+          error (EXIT_FAILURE, 0,
+                 _("invalid input (length must be multiple of 4 characters)"));
         }
       else
         {
@@ -926,7 +924,7 @@ wrap_write (char const *buffer, idx_t len,
     {
       /* Simple write. */
       if (fwrite (buffer, 1, len, stdout) < len)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
     }
   else
     for (idx_t written = 0; written < len; )
@@ -936,13 +934,13 @@ wrap_write (char const *buffer, idx_t len,
         if (to_write == 0)
           {
             if (fputc ('\n', out) == EOF)
-              die (EXIT_FAILURE, errno, _("write error"));
+              error (EXIT_FAILURE, errno, _("write error"));
             *current_column = 0;
           }
         else
           {
             if (fwrite (buffer + written, 1, to_write, stdout) < to_write)
-              die (EXIT_FAILURE, errno, _("write error"));
+              error (EXIT_FAILURE, errno, _("write error"));
             *current_column += to_write;
             written += to_write;
           }
@@ -955,9 +953,9 @@ finish_and_exit (FILE *in, char const *infile)
   if (fclose (in) != 0)
     {
       if (STREQ (infile, "-"))
-        die (EXIT_FAILURE, errno, _("closing standard input"));
+        error (EXIT_FAILURE, errno, _("closing standard input"));
       else
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
     }
 
   exit (EXIT_SUCCESS);
@@ -999,10 +997,10 @@ do_encode (FILE *in, char const *infile, FILE *out, idx_t wrap_column)
 
   /* When wrapping, terminate last line. */
   if (wrap_column && current_column > 0 && fputc ('\n', out) == EOF)
-    die (EXIT_FAILURE, errno, _("write error"));
+    error (EXIT_FAILURE, errno, _("write error"));
 
   if (ferror (in))
-    die (EXIT_FAILURE, errno, _("read error"));
+    error (EXIT_FAILURE, errno, _("read error"));
 
   finish_and_exit (in, infile);
 }
@@ -1046,7 +1044,7 @@ do_decode (FILE *in, char const *infile, FILE *out, bool ignore_garbage)
           sum += n;
 
           if (ferror (in))
-            die (EXIT_FAILURE, errno, _("read error"));
+            error (EXIT_FAILURE, errno, _("read error"));
         }
       while (sum < BASE_LENGTH (DEC_BLOCKSIZE) && !feof (in));
 
@@ -1062,10 +1060,10 @@ do_decode (FILE *in, char const *infile, FILE *out, bool ignore_garbage)
           ok = base_decode_ctx (&ctx, inbuf, (k == 0 ? sum : 0), outbuf, &n);
 
           if (fwrite (outbuf, 1, n, out) < n)
-            die (EXIT_FAILURE, errno, _("write error"));
+            error (EXIT_FAILURE, errno, _("write error"));
 
           if (!ok)
-            die (EXIT_FAILURE, 0, _("invalid input"));
+            error (EXIT_FAILURE, 0, _("invalid input"));
         }
     }
   while (!feof (in));
@@ -1111,8 +1109,8 @@ main (int argc, char **argv)
           intmax_t w;
           strtol_error s_err = xstrtoimax (optarg, nullptr, 10, &w, "");
           if (LONGINT_OVERFLOW < s_err || w < 0)
-            die (EXIT_FAILURE, 0, "%s: %s",
-                 _("invalid wrap size"), quote (optarg));
+            error (EXIT_FAILURE, 0, "%s: %s",
+                   _("invalid wrap size"), quote (optarg));
           wrap_column = s_err == LONGINT_OVERFLOW || IDX_MAX < w ? 0 : w;
         }
         break;
@@ -1236,7 +1234,7 @@ main (int argc, char **argv)
     {
       input_fh = fopen (infile, "rb");
       if (input_fh == nullptr)
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
     }
 
   fadvise (input_fh, FADVISE_SEQUENTIAL);
index 5107bf9b313ef5174879158b0a4a10f2f6531020..779bcc4dc019287e1687bd9264a8b9026f16b4f3 100644 (file)
--- a/src/cat.c
+++ b/src/cat.c
@@ -36,8 +36,6 @@
 #include "alignalloc.h"
 #include "idx.h"
 #include "ioblksize.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "full-write.h"
 #include "safe-read.h"
@@ -179,7 +177,7 @@ simple_cat (char *buf, idx_t bufsize)
       /* Write this block out.  */
 
       if (full_write (STDOUT_FILENO, buf, n_read) != n_read)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
     }
 }
 
@@ -194,7 +192,7 @@ write_pending (char *outbuf, char **bpout)
   if (0 < n_write)
     {
       if (full_write (STDOUT_FILENO, outbuf, n_write) != n_write)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
       *bpout = outbuf;
     }
 }
@@ -258,7 +256,7 @@ cat (char *inbuf, idx_t insize, char *outbuf, idx_t outsize,
               do
                 {
                   if (full_write (STDOUT_FILENO, wp, outsize) != outsize)
-                    die (EXIT_FAILURE, errno, _("write error"));
+                    error (EXIT_FAILURE, errno, _("write error"));
                   wp += outsize;
                   remaining_bytes = bpout - wp;
                 }
@@ -643,7 +641,7 @@ main (int argc, char **argv)
   /* Get device, i-node number, and optimal blocksize of output.  */
 
   if (fstat (STDOUT_FILENO, &stat_buf) < 0)
-    die (EXIT_FAILURE, errno, _("standard output"));
+    error (EXIT_FAILURE, errno, _("standard output"));
 
   /* Optimal size of i/o operations of output.  */
   idx_t outsize = io_blksize (stat_buf);
@@ -795,11 +793,11 @@ main (int argc, char **argv)
   if (pending_cr)
     {
       if (full_write (STDOUT_FILENO, "\r", 1) != 1)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
     }
 
   if (have_read_stdin && close (STDIN_FILENO) < 0)
-    die (EXIT_FAILURE, errno, _("closing standard input"));
+    error (EXIT_FAILURE, errno, _("closing standard input"));
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index cc516da633de36d6a3146943fe9f37c80105d3fe..41419b844076484e0eb29f77cb58d64cd1943f98 100644 (file)
@@ -22,8 +22,6 @@
 
 #include "system.h"
 #include "dev-ino.h"
-#include "die.h"
-#include "error.h"
 #include "ignore-value.h"
 #include "quote.h"
 #include "root-dev-ino.h"
@@ -515,14 +513,14 @@ main (int argc, char **argv)
       if (bit_flags == FTS_PHYSICAL)
         {
           if (dereference == 1)
-            die (EXIT_FAILURE, 0,
-                 _("-R --dereference requires either -H or -L"));
+            error (EXIT_FAILURE, 0,
+                   _("-R --dereference requires either -H or -L"));
           affect_symlink_referent = false;
         }
       else
         {
           if (dereference == 0)
-            die (EXIT_FAILURE, 0, _("-R -h requires -P"));
+            error (EXIT_FAILURE, 0, _("-R -h requires -P"));
           affect_symlink_referent = true;
         }
     }
@@ -546,8 +544,8 @@ main (int argc, char **argv)
       char *ref_context = nullptr;
 
       if (getfilecon (reference_file, &ref_context) < 0)
-        die (EXIT_FAILURE, errno, _("failed to get security context of %s"),
-             quoteaf (reference_file));
+        error (EXIT_FAILURE, errno, _("failed to get security context of %s"),
+               quoteaf (reference_file));
 
       specified_context = ref_context;
     }
@@ -561,8 +559,8 @@ main (int argc, char **argv)
       specified_context = argv[optind++];
       if (0 < is_selinux_enabled ()
           && security_check_context (specified_context) < 0)
-        die (EXIT_FAILURE, errno, _("invalid context: %s"),
-             quote (specified_context));
+        error (EXIT_FAILURE, errno, _("invalid context: %s"),
+               quote (specified_context));
     }
 
   if (reference_file && component_specified)
@@ -576,8 +574,8 @@ main (int argc, char **argv)
       static struct dev_ino dev_ino_buf;
       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
       if (root_dev_ino == nullptr)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf ("/"));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf ("/"));
     }
   else
     {
index 4533473ea54f66b5a8c1b1204cd406fe62bdf9e6..6ec3b4d998c8112e6c531242b0705458aa248bed 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "system.h"
 #include "chown-core.h"
-#include "die.h"
-#include "error.h"
 #include "fts_.h"
 #include "quote.h"
 #include "root-dev-ino.h"
@@ -90,8 +88,8 @@ parse_group (char const *name)
           uintmax_t tmp;
           if (! (xstrtoumax (name, nullptr, 10, &tmp, "") == LONGINT_OK
                  && tmp <= GID_T_MAX))
-            die (EXIT_FAILURE, 0, _("invalid group: %s"),
-                 quote (name));
+            error (EXIT_FAILURE, 0, _("invalid group: %s"),
+                   quote (name));
           gid = tmp;
         }
       endgrent ();             /* Save a file descriptor. */
@@ -262,8 +260,8 @@ main (int argc, char **argv)
       if (bit_flags == FTS_PHYSICAL)
         {
           if (dereference == 1)
-            die (EXIT_FAILURE, 0,
-                 _("-R --dereference requires either -H or -L"));
+            error (EXIT_FAILURE, 0,
+                   _("-R --dereference requires either -H or -L"));
           dereference = 0;
         }
     }
@@ -286,8 +284,8 @@ main (int argc, char **argv)
     {
       struct stat ref_stats;
       if (stat (reference_file, &ref_stats))
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf (reference_file));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf (reference_file));
 
       gid = ref_stats.st_gid;
       chopt.group_name = gid_to_name (ref_stats.st_gid);
@@ -304,8 +302,8 @@ main (int argc, char **argv)
       static struct dev_ino dev_ino_buf;
       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
       if (chopt.root_dev_ino == nullptr)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf ("/"));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf ("/"));
     }
 
   bit_flags |= FTS_DEFER_STAT;
index 25111c399ebb44ea8e2825c64777cb4e3f3cc5b5..66d1a61c7488656ed4748cd117990a3a2dde83cd 100644 (file)
@@ -24,8 +24,6 @@
 #include "system.h"
 #include "assure.h"
 #include "dev-ino.h"
-#include "die.h"
-#include "error.h"
 #include "filemode.h"
 #include "ignore-value.h"
 #include "modechange.h"
@@ -539,8 +537,8 @@ main (int argc, char **argv)
     {
       change = mode_create_from_ref (reference_file);
       if (!change)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf (reference_file));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf (reference_file));
     }
   else
     {
@@ -558,8 +556,8 @@ main (int argc, char **argv)
       static struct dev_ino dev_ino_buf;
       root_dev_ino = get_root_dev_ino (&dev_ino_buf);
       if (root_dev_ino == nullptr)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf ("/"));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf ("/"));
     }
   else
     {
index 3aa0390b7a0004b5a3d79eabb1dc3de1f59d7497..be86072da3bec8ce62834dd742f9fcbcaba1d910 100644 (file)
@@ -25,7 +25,6 @@
 #include "system.h"
 #include "assure.h"
 #include "chown-core.h"
-#include "error.h"
 #include "ignore-value.h"
 #include "root-dev-ino.h"
 #include "xfts.h"
index 33dd93b44ad3ec30374dbf094346712ab4012c09..4e0e1c3fc0916913a4b43f2d6c5beb73e2fb0e0b 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "chown-core.h"
-#include "die.h"
-#include "error.h"
 #include "fts_.h"
 #include "quote.h"
 #include "root-dev-ino.h"
@@ -264,8 +262,8 @@ main (int argc, char **argv)
       if (bit_flags == FTS_PHYSICAL)
         {
           if (dereference == 1)
-            die (EXIT_FAILURE, 0,
-                 _("-R --dereference requires either -H or -L"));
+            error (EXIT_FAILURE, 0,
+                   _("-R --dereference requires either -H or -L"));
           dereference = 0;
         }
     }
@@ -288,8 +286,8 @@ main (int argc, char **argv)
     {
       struct stat ref_stats;
       if (stat (reference_file, &ref_stats))
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf (reference_file));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf (reference_file));
 
       uid = ref_stats.st_uid;
       gid = ref_stats.st_gid;
@@ -319,8 +317,8 @@ main (int argc, char **argv)
       static struct dev_ino dev_ino_buf;
       chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
       if (chopt.root_dev_ino == nullptr)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf ("/"));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf ("/"));
     }
 
   bit_flags |= FTS_DEFER_STAT;
index a763d03548da05fce32bfb86d0785711f75211ab..6150af5cd34bca47f550a11768fb446368989e52 100644 (file)
@@ -24,8 +24,6 @@
 #include <grp.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "ignore-value.h"
 #include "mgetgroups.h"
 #include "quote.h"
@@ -329,11 +327,11 @@ main (int argc, char **argv)
     }
 
   if (chroot (newroot) != 0)
-    die (EXIT_CANCELED, errno, _("cannot change root directory to %s"),
-         quoteaf (newroot));
+    error (EXIT_CANCELED, errno, _("cannot change root directory to %s"),
+           quoteaf (newroot));
 
   if (! skip_chdir && chdir ("/"))
-    die (EXIT_CANCELED, errno, _("cannot chdir to root directory"));
+    error (EXIT_CANCELED, errno, _("cannot chdir to root directory"));
 
   if (argc == optind + 1)
     {
@@ -375,8 +373,8 @@ main (int argc, char **argv)
         }
       else if (gid_unset (gid))
         {
-          die (EXIT_CANCELED, errno,
-               _("no group specified for unknown uid: %d"), (int) uid);
+          error (EXIT_CANCELED, errno,
+                 _("no group specified for unknown uid: %d"), (int) uid);
         }
     }
 
@@ -400,8 +398,8 @@ main (int argc, char **argv)
       if (ngroups <= 0)
         {
           if (! n_gids)
-            die (EXIT_CANCELED, errno,
-                 _("failed to get supplemental groups"));
+            error (EXIT_CANCELED, errno,
+                   _("failed to get supplemental groups"));
           /* else look-up outside the chroot worked, then go with those.  */
         }
       else
@@ -413,16 +411,16 @@ main (int argc, char **argv)
 #endif
 
   if ((uid_set (uid) || groups) && setgroups (n_gids, gids) != 0)
-    die (EXIT_CANCELED, errno, _("failed to set supplemental groups"));
+    error (EXIT_CANCELED, errno, _("failed to set supplemental groups"));
 
   free (in_gids);
   free (out_gids);
 
   if (gid_set (gid) && setgid (gid))
-    die (EXIT_CANCELED, errno, _("failed to set group-ID"));
+    error (EXIT_CANCELED, errno, _("failed to set group-ID"));
 
   if (uid_set (uid) && setuid (uid))
-    die (EXIT_CANCELED, errno, _("failed to set user-ID"));
+    error (EXIT_CANCELED, errno, _("failed to set user-ID"));
 
   /* Execute the given command.  */
   execvp (argv[0], argv);
index 5b6a59c16e21991d4497d9334d8022d830d7d00c..c7e93fa74a563393a2cccdfd685e6a9e6cdaa834 100644 (file)
@@ -137,9 +137,6 @@ main (void)
 
 #else /* !CRCTAB */
 
-# include "die.h"
-# include "error.h"
-
 # include "cksum.h"
 
 /* Number of bytes to read at once.  */
index cb5fd4802ae05ef8529f63e0c6a0694fa406ff0b..12fa9c9eaa99d18ba77201ba98fc71a0e44f79fc 100644 (file)
@@ -22,8 +22,6 @@
 #include <sys/types.h>
 #include "system.h"
 #include "linebuffer.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "hard-locale.h"
 #include "quote.h"
@@ -290,14 +288,14 @@ compare_files (char **infiles)
       alt[i][2] = 0;
       streams[i] = (STREQ (infiles[i], "-") ? stdin : fopen (infiles[i], "r"));
       if (!streams[i])
-        die (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
+        error (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
 
       fadvise (streams[i], FADVISE_SEQUENTIAL);
 
       thisline[i] = readlinebuffer_delim (all_line[i][alt[i][0]], streams[i],
                                           delim);
       if (ferror (streams[i]))
-        die (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
+        error (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
     }
 
   while (thisline[0] || thisline[1])
@@ -379,7 +377,7 @@ compare_files (char **infiles)
                            all_line[i][alt[i][1]], i + 1);
 
             if (ferror (streams[i]))
-              die (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
+              error (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
 
             fill_up[i] = false;
           }
@@ -387,7 +385,7 @@ compare_files (char **infiles)
 
   for (i = 0; i < 2; i++)
     if (fclose (streams[i]) != 0)
-      die (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
+      error (EXIT_FAILURE, errno, "%s", quotef (infiles[i]));
 
   if (total_option)
     {
@@ -414,7 +412,7 @@ compare_files (char **infiles)
     }
 
   if (issued_disorder_warning[0] || issued_disorder_warning[1])
-    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
+    error (EXIT_FAILURE, 0, _("input is not in sorted order"));
 
   /* Exit here to pacify gcc -fsanitizer=leak.  */
   exit (EXIT_SUCCESS);
@@ -472,7 +470,7 @@ main (int argc, char **argv)
 
       case OUTPUT_DELIMITER_OPTION:
         if (col_sep_len && !STREQ (col_sep, optarg))
-          die (EXIT_FAILURE, 0, _("multiple output delimiters specified"));
+          error (EXIT_FAILURE, 0, _("multiple output delimiters specified"));
         col_sep = optarg;
         col_sep_len = *optarg ? strlen (optarg) : 1;
         break;
index 8d66099a5ae9de635ed7d9949ce40c893b00105c..c286228441de945580b485da70e5d4b8dc8225b2 100644 (file)
@@ -38,8 +38,6 @@
 #include "canonicalize.h"
 #include "copy.h"
 #include "cp-hash.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "fcntl--.h"
 #include "file-set.h"
@@ -2091,8 +2089,8 @@ static void
 restore_default_fscreatecon_or_die (void)
 {
   if (setfscreatecon (nullptr) != 0)
-    die (EXIT_FAILURE, errno,
-         _("failed to restore the default file creation context"));
+    error (EXIT_FAILURE, errno,
+           _("failed to restore the default file creation context"));
 }
 
 /* Return a newly-allocated string that is like STR
index 87308efaeadaf4f780c2d5028da9557acc44e19a..92ba41bc1338c7bbeb8cec17e47f3f7a19ea7fb0 100644 (file)
@@ -27,8 +27,6 @@
 #endif
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 
 #ifdef SINGLE_BINARY
@@ -176,8 +174,8 @@ main (int argc, char **argv)
         {
           argv[nskip] = arg_name; /* XXX: Discards any specified path.  */
           launch_program (prog_name, argc - nskip, argv + nskip);
-          die (EXIT_FAILURE, 0, _("unknown program %s"),
-               quote (prog_name));
+          error (EXIT_FAILURE, 0, _("unknown program %s"),
+                 quote (prog_name));
         }
     }
 
index c0e6c32d3f74f68a3626fd112fdc11f3286c762a..412ef500bc52a74bba430e85e53464de25818c49 100644 (file)
--- a/src/cp.c
+++ b/src/cp.c
@@ -28,8 +28,6 @@
 #include "backupfile.h"
 #include "copy.h"
 #include "cp-hash.h"
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "ignore-value.h"
 #include "quote.h"
@@ -629,9 +627,9 @@ do_copy (int n_files, char **file, char const *target_directory,
   if (no_target_directory)
     {
       if (target_directory)
-        die (EXIT_FAILURE, 0,
-             _("cannot combine --target-directory (-t) "
-               "and --no-target-directory (-T)"));
+        error (EXIT_FAILURE, 0,
+               _("cannot combine --target-directory (-t) "
+                 "and --no-target-directory (-T)"));
       if (2 < n_files)
         {
           error (0, 0, _("extra operand %s"), quoteaf (file[2]));
@@ -642,8 +640,8 @@ do_copy (int n_files, char **file, char const *target_directory,
     {
       target_dirfd = target_directory_operand (target_directory, &sb);
       if (! target_dirfd_valid (target_dirfd))
-        die (EXIT_FAILURE, errno, _("target directory %s"),
-             quoteaf (target_directory));
+        error (EXIT_FAILURE, errno, _("target directory %s"),
+               quoteaf (target_directory));
     }
   else
     {
@@ -674,7 +672,7 @@ do_copy (int n_files, char **file, char const *target_directory,
               || (O_PATHSEARCH == O_SEARCH && err == EACCES
                   && (sb.st_mode || stat (lastfile, &sb) == 0)
                   && S_ISDIR (sb.st_mode)))
-            die (EXIT_FAILURE, err, _("target %s"), quoteaf (lastfile));
+            error (EXIT_FAILURE, err, _("target %s"), quoteaf (lastfile));
         }
     }
 
@@ -1123,8 +1121,8 @@ main (int argc, char **argv)
 
         case 't':
           if (target_directory)
-            die (EXIT_FAILURE, 0,
-                 _("multiple target directories specified"));
+            error (EXIT_FAILURE, 0,
+                   _("multiple target directories specified"));
           target_directory = optarg;
           break;
 
@@ -1249,13 +1247,13 @@ main (int argc, char **argv)
     x.preserve_security_context = false;
 
   if (x.preserve_security_context && (x.set_security_context || scontext))
-    die (EXIT_FAILURE, 0,
-         _("cannot set target context and preserve it"));
+    error (EXIT_FAILURE, 0,
+           _("cannot set target context and preserve it"));
 
   if (x.require_preserve_context && ! selinux_enabled)
-    die (EXIT_FAILURE, 0,
-         _("cannot preserve security context "
-           "without an SELinux-enabled kernel"));
+    error (EXIT_FAILURE, 0,
+           _("cannot preserve security context "
+             "without an SELinux-enabled kernel"));
 
   /* FIXME: This handles new files.  But what about existing files?
      I.e., if updating a tree, new files would have the specified context,
@@ -1264,14 +1262,14 @@ main (int argc, char **argv)
           error (...);
    */
   if (scontext && setfscreatecon (scontext) < 0)
-    die (EXIT_FAILURE, errno,
-         _("failed to set default file creation context to %s"),
-         quote (scontext));
+    error (EXIT_FAILURE, errno,
+           _("failed to set default file creation context to %s"),
+           quote (scontext));
 
 #if !USE_XATTR
   if (x.require_preserve_xattr)
-    die (EXIT_FAILURE, 0, _("cannot preserve extended attributes, cp is "
-                            "built without xattr support"));
+    error (EXIT_FAILURE, 0, _("cannot preserve extended attributes, cp is "
+                              "built without xattr support"));
 #endif
 
   /* Allocate space for remembering copied and created files.  */
index 295bc8f62fa87efec5c67653899e3864cf41cbc9..a11298404f4ae7bc2a4d488e7feed60865dbf1d8 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <regex.h>
 
-#include "die.h"
-#include "error.h"
 #include "fd-reopen.h"
 #include "idx.h"
 #include "quote.h"
@@ -503,7 +501,7 @@ static intmax_t
 get_first_line_in_buffer (void)
 {
   if (head == nullptr && !load_buffer ())
-    die (EXIT_FAILURE, errno, _("input disappeared"));
+    error (EXIT_FAILURE, errno, _("input disappeared"));
 
   return head->first_available;
 }
@@ -611,8 +609,8 @@ static void
 set_input_file (char const *name)
 {
   if (! STREQ (name, "-") && fd_reopen (STDIN_FILENO, name, O_RDONLY, 0) < 0)
-    die (EXIT_FAILURE, errno, _("cannot open %s for reading"),
-         quoteaf (name));
+    error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+           quoteaf (name));
 }
 
 /* Write all lines from the beginning of the buffer up to, but
@@ -1043,8 +1041,8 @@ static void
 check_for_offset (struct control *p, char const *str, char const *num)
 {
   if (xstrtoimax (num, nullptr, 10, &p->offset, "") != LONGINT_OK)
-    die (EXIT_FAILURE, 0, _("%s: integer expected after delimiter"),
-         quote (str));
+    error (EXIT_FAILURE, 0, _("%s: integer expected after delimiter"),
+           quote (str));
 }
 
 /* Given that the first character of command line arg STR is '{',
@@ -1059,8 +1057,8 @@ parse_repeat_count (int argnum, struct control *p, char *str)
 
   end = str + strlen (str) - 1;
   if (*end != '}')
-    die (EXIT_FAILURE, 0, _("%s: '}' is required in repeat count"),
-         quote (str));
+    error (EXIT_FAILURE, 0, _("%s: '}' is required in repeat count"),
+           quote (str));
   *end = '\0';
 
   if (str + 1 == end - 1 && *(str + 1) == '*')
@@ -1071,9 +1069,9 @@ parse_repeat_count (int argnum, struct control *p, char *str)
       if (xstrtoumax (str + 1, nullptr, 10, &val, "") != LONGINT_OK
           || INTMAX_MAX < val)
         {
-          die (EXIT_FAILURE, 0,
-               _("%s}: integer required between '{' and '}'"),
-               quote (global_argv[argnum]));
+          error (EXIT_FAILURE, 0,
+                 _("%s}: integer required between '{' and '}'"),
+                 quote (global_argv[argnum]));
         }
       p->repeat = val;
     }
@@ -1098,8 +1096,8 @@ extract_regexp (int argnum, bool ignore, char const *str)
 
   closing_delim = strrchr (str + 1, delim);
   if (closing_delim == nullptr)
-    die (EXIT_FAILURE, 0,
-         _("%s: closing delimiter '%c' missing"), str, delim);
+    error (EXIT_FAILURE, 0,
+           _("%s: closing delimiter '%c' missing"), str, delim);
 
   len = closing_delim - str - 1;
   p = new_control_record ();
@@ -1149,16 +1147,17 @@ parse_patterns (int argc, int start, char **argv)
           uintmax_t val;
           if (xstrtoumax (argv[i], nullptr, 10, &val, "") != LONGINT_OK
               || INTMAX_MAX < val)
-            die (EXIT_FAILURE, 0, _("%s: invalid pattern"), quote (argv[i]));
+            error (EXIT_FAILURE, 0, _("%s: invalid pattern"), quote (argv[i]));
           if (val == 0)
-            die (EXIT_FAILURE, 0,
-                 _("%s: line number must be greater than zero"), argv[i]);
+            error (EXIT_FAILURE, 0,
+                   _("%s: line number must be greater than zero"), argv[i]);
           if (val < last_val)
             {
               char buf[INT_BUFSIZE_BOUND (intmax_t)];
-              die (EXIT_FAILURE, 0,
-               _("line number %s is smaller than preceding line number, %s"),
-                   quote (argv[i]), imaxtostr (last_val, buf));
+              error (EXIT_FAILURE, 0,
+                     _("line number %s is smaller than preceding line number,"
+                       " %s"),
+                     quote (argv[i]), imaxtostr (last_val, buf));
             }
 
           if (val == last_val)
@@ -1241,21 +1240,21 @@ check_format_conv_type (char *format, int flags)
       break;
 
     case 0:
-      die (EXIT_FAILURE, 0, _("missing conversion specifier in suffix"));
+      error (EXIT_FAILURE, 0, _("missing conversion specifier in suffix"));
 
     default:
       if (isprint (ch))
-        die (EXIT_FAILURE, 0,
-             _("invalid conversion specifier in suffix: %c"), ch);
+        error (EXIT_FAILURE, 0,
+               _("invalid conversion specifier in suffix: %c"), ch);
       else
-        die (EXIT_FAILURE, 0,
-             _("invalid conversion specifier in suffix: \\%.3o"), ch);
+        error (EXIT_FAILURE, 0,
+               _("invalid conversion specifier in suffix: \\%.3o"), ch);
     }
 
   if (flags & ~ compatible_flags)
-    die (EXIT_FAILURE, 0,
-         _("invalid flags in conversion specification: %%%c%c"),
-         (flags & ~ compatible_flags & FLAG_ALTERNATIVE ? '#' : '\''), ch);
+    error (EXIT_FAILURE, 0,
+           _("invalid flags in conversion specification: %%%c%c"),
+           (flags & ~ compatible_flags & FLAG_ALTERNATIVE ? '#' : '\''), ch);
 }
 
 /* Return the maximum number of bytes that can be generated by
@@ -1270,8 +1269,8 @@ max_out (char *format)
     if (*f == '%' && *++f != '%')
       {
         if (percent)
-          die (EXIT_FAILURE, 0,
-               _("too many %% conversion specifications in suffix"));
+          error (EXIT_FAILURE, 0,
+                 _("too many %% conversion specifications in suffix"));
         percent = true;
         int flags;
         f += get_format_flags (f, &flags);
@@ -1284,8 +1283,8 @@ max_out (char *format)
       }
 
   if (! percent)
-    die (EXIT_FAILURE, 0,
-         _("missing %% conversion specification in suffix"));
+    error (EXIT_FAILURE, 0,
+           _("missing %% conversion specification in suffix"));
 
   int maxlen = snprintf (nullptr, 0, format, INT_MAX);
   if (maxlen < 0)
index 27740ccc51f6c0d562ddc1f2ddf66bffa0ea2438..48ac0128057a1f54bbc2cd646cdaa4e441aaea4e 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -30,7 +30,6 @@
 #include "system.h"
 
 #include "assure.h"
-#include "error.h"
 #include "fadvise.h"
 #include "getndelim2.h"
 
index cb95ba4ec5a80e2ab338ef13dc669ac3f2039c4c..9b66d397e41a299cd560e1c70ee33758b4c42bff 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "system.h"
 #include "argmatch.h"
-#include "die.h"
-#include "error.h"
 #include "parse-datetime.h"
 #include "posixtm.h"
 #include "quote.h"
@@ -355,9 +353,7 @@ batch_convert (char const *input_filename, char const *format,
     {
       in_stream = fopen (input_filename, "r");
       if (in_stream == nullptr)
-        {
-          die (EXIT_FAILURE, errno, "%s", quotef (input_filename));
-        }
+        error (EXIT_FAILURE, errno, "%s", quotef (input_filename));
     }
 
   line = nullptr;
@@ -369,8 +365,8 @@ batch_convert (char const *input_filename, char const *format,
       if (line_length < 0)
         {
           if (ferror (in_stream))
-            die (EXIT_FAILURE, errno, _("%s: read error"),
-                 quotef (input_filename));
+            error (EXIT_FAILURE, errno, _("%s: read error"),
+                   quotef (input_filename));
           break;
         }
 
@@ -389,7 +385,7 @@ batch_convert (char const *input_filename, char const *format,
     }
 
   if (fclose (in_stream) == EOF)
-    die (EXIT_FAILURE, errno, "%s", quotef (input_filename));
+    error (EXIT_FAILURE, errno, "%s", quotef (input_filename));
 
   free (line);
 
@@ -502,7 +498,7 @@ main (int argc, char **argv)
       if (new_format)
         {
           if (format)
-            die (EXIT_FAILURE, 0, _("multiple output formats specified"));
+            error (EXIT_FAILURE, 0, _("multiple output formats specified"));
           format = new_format;
         }
     }
@@ -541,7 +537,7 @@ main (int argc, char **argv)
       if (argv[optind][0] == '+')
         {
           if (format)
-            die (EXIT_FAILURE, 0, _("multiple output formats specified"));
+            error (EXIT_FAILURE, 0, _("multiple output formats specified"));
           format = argv[optind++] + 1;
         }
       else if (set_date || option_specified_date)
@@ -613,7 +609,7 @@ main (int argc, char **argv)
           if (reference != nullptr)
             {
               if (stat (reference, &refstats) != 0)
-                die (EXIT_FAILURE, errno, "%s", quotef (reference));
+                error (EXIT_FAILURE, errno, "%s", quotef (reference));
               when = get_stat_mtime (&refstats);
             }
           else if (get_resolution)
@@ -633,7 +629,7 @@ main (int argc, char **argv)
         }
 
       if (! valid_date)
-        die (EXIT_FAILURE, 0, _("invalid date %s"), quote (datestr));
+        error (EXIT_FAILURE, 0, _("invalid date %s"), quote (datestr));
 
       if (set_date)
         {
index be1c27ee90440b5a70e7583b22d86aeea50d2788..8df93d521df435c5791af2af6ab5ec777142bb6d 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -24,7 +24,6 @@
 #include "system.h"
 #include "alignalloc.h"
 #include "close-stream.h"
-#include "die.h"
 #include "fd-reopen.h"
 #include "gethrxtime.h"
 #include "human.h"
@@ -674,11 +673,11 @@ alloc_ibuf (void)
   if (!ibuf)
     {
       char hbuf[LONGEST_HUMAN_READABLE + 1];
-      die (EXIT_FAILURE, 0,
-           _("memory exhausted by input buffer of size %td bytes (%s)"),
-           input_blocksize,
-           human_readable (input_blocksize, hbuf,
-                           human_opts | human_base_1024, 1, 1));
+      error (EXIT_FAILURE, 0,
+             _("memory exhausted by input buffer of size %td bytes (%s)"),
+             input_blocksize,
+             human_readable (input_blocksize, hbuf,
+                             human_opts | human_base_1024, 1, 1));
     }
 }
 
@@ -696,12 +695,12 @@ alloc_obuf (void)
       if (!obuf)
         {
           char hbuf[LONGEST_HUMAN_READABLE + 1];
-          die (EXIT_FAILURE, 0,
-               _("memory exhausted by output buffer of size %td"
-                 " bytes (%s)"),
-               output_blocksize,
-               human_readable (output_blocksize, hbuf,
-                               human_opts | human_base_1024, 1, 1));
+          error (EXIT_FAILURE, 0,
+                 _("memory exhausted by output buffer of size %td"
+                   " bytes (%s)"),
+                 output_blocksize,
+                 human_readable (output_blocksize, hbuf,
+                                 human_opts | human_base_1024, 1, 1));
         }
     }
   else
@@ -942,14 +941,15 @@ cleanup (void)
     }
 
   if (iclose (STDIN_FILENO) != 0)
-    die (EXIT_FAILURE, errno, _("closing input file %s"), quoteaf (input_file));
+    error (EXIT_FAILURE, errno, _("closing input file %s"),
+           quoteaf (input_file));
 
   /* Don't remove this call to close, even though close_stdout
      closes standard output.  This close is necessary when cleanup
      is called as a consequence of signal handling.  */
   if (iclose (STDOUT_FILENO) != 0)
-    die (EXIT_FAILURE, errno,
-         _("closing output file %s"), quoteaf (output_file));
+    error (EXIT_FAILURE, errno,
+           _("closing output file %s"), quoteaf (output_file));
 }
 
 /* Process any pending signals.  If signals are caught, this function
@@ -1585,8 +1585,8 @@ scanargs (int argc, char *const *argv)
             invalid = LONGINT_OVERFLOW;
 
           if (invalid != LONGINT_OK)
-            die (EXIT_FAILURE, invalid == LONGINT_OVERFLOW ? EOVERFLOW : 0,
-                 "%s: %s", _("invalid number"), quoteaf (val));
+            error (EXIT_FAILURE, invalid == LONGINT_OVERFLOW ? EOVERFLOW : 0,
+                   "%s: %s", _("invalid number"), quoteaf (val));
           else if (converted_idx)
             *converted_idx = n;
         }
@@ -1663,16 +1663,16 @@ scanargs (int argc, char *const *argv)
   input_flags &= ~O_FULLBLOCK;
 
   if (multiple_bits_set (conversions_mask & (C_ASCII | C_EBCDIC | C_IBM)))
-    die (EXIT_FAILURE, 0, _("cannot combine any two of {ascii,ebcdic,ibm}"));
+    error (EXIT_FAILURE, 0, _("cannot combine any two of {ascii,ebcdic,ibm}"));
   if (multiple_bits_set (conversions_mask & (C_BLOCK | C_UNBLOCK)))
-    die (EXIT_FAILURE, 0, _("cannot combine block and unblock"));
+    error (EXIT_FAILURE, 0, _("cannot combine block and unblock"));
   if (multiple_bits_set (conversions_mask & (C_LCASE | C_UCASE)))
-    die (EXIT_FAILURE, 0, _("cannot combine lcase and ucase"));
+    error (EXIT_FAILURE, 0, _("cannot combine lcase and ucase"));
   if (multiple_bits_set (conversions_mask & (C_EXCL | C_NOCREAT)))
-    die (EXIT_FAILURE, 0, _("cannot combine excl and nocreat"));
+    error (EXIT_FAILURE, 0, _("cannot combine excl and nocreat"));
   if (multiple_bits_set (input_flags & (O_DIRECT | O_NOCACHE))
       || multiple_bits_set (output_flags & (O_DIRECT | O_NOCACHE)))
-    die (EXIT_FAILURE, 0, _("cannot combine direct and nocache"));
+    error (EXIT_FAILURE, 0, _("cannot combine direct and nocache"));
 
   if (input_flags & O_NOCACHE)
     {
@@ -1811,7 +1811,7 @@ skip (int fdesc, char const *file, intmax_t records, idx_t blocksize,
         {
            struct stat st;
            if (ifstat (STDIN_FILENO, &st) != 0)
-             die (EXIT_FAILURE, errno, _("cannot fstat %s"), quoteaf (file));
+             error (EXIT_FAILURE, errno, _("cannot fstat %s"), quoteaf (file));
            if (usable_st_size (&st) && 0 <= input_offset
                && st.st_size - input_offset < offset)
              {
@@ -2088,7 +2088,7 @@ set_fd_flags (int fd, int add_flags, char const *name)
         }
 
       if (!ok)
-        die (EXIT_FAILURE, errno, _("setting flags for %s"), quoteaf (name));
+        error (EXIT_FAILURE, errno, _("setting flags for %s"), quoteaf (name));
     }
 }
 
@@ -2453,8 +2453,8 @@ main (int argc, char **argv)
   else
     {
       if (ifd_reopen (STDIN_FILENO, input_file, O_RDONLY | input_flags, 0) < 0)
-        die (EXIT_FAILURE, errno, _("failed to open %s"),
-             quoteaf (input_file));
+        error (EXIT_FAILURE, errno, _("failed to open %s"),
+               quoteaf (input_file));
     }
 
   offset = lseek (STDIN_FILENO, 0, SEEK_CUR);
@@ -2480,11 +2480,11 @@ main (int argc, char **argv)
       if ((INT_MULTIPLY_WRAPV (seek_records, output_blocksize, &size)
            || INT_ADD_WRAPV (seek_bytes, size, &size))
           && !(conversions_mask & C_NOTRUNC))
-        die (EXIT_FAILURE, 0,
-             _("offset too large: "
-               "cannot truncate to a length of seek=%"PRIdMAX""
-               " (%td-byte) blocks"),
-             seek_records, output_blocksize);
+        error (EXIT_FAILURE, 0,
+               _("offset too large: "
+                 "cannot truncate to a length of seek=%"PRIdMAX""
+                 " (%td-byte) blocks"),
+               seek_records, output_blocksize);
 
       /* Open the output file with *read* access only if we might
          need to read to satisfy a 'seek=' request.  If we can't read
@@ -2493,8 +2493,8 @@ main (int argc, char **argv)
            || ifd_reopen (STDOUT_FILENO, output_file, O_RDWR | opts, perms) < 0)
           && (ifd_reopen (STDOUT_FILENO, output_file, O_WRONLY | opts, perms)
               < 0))
-        die (EXIT_FAILURE, errno, _("failed to open %s"),
-             quoteaf (output_file));
+        error (EXIT_FAILURE, errno, _("failed to open %s"),
+               quoteaf (output_file));
 
       if (seek_records != 0 && !(conversions_mask & C_NOTRUNC))
         {
index 417791dd5ddcf11c25ae375f6f6a97c12a59d22a..4f7d18205db141bd5eedcb4ce3e66ed1952d74d8 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -29,8 +29,6 @@
 #include "system.h"
 #include "assure.h"
 #include "canonicalize.h"
-#include "die.h"
-#include "error.h"
 #include "fsusage.h"
 #include "human.h"
 #include "mbsalign.h"
@@ -1850,7 +1848,7 @@ main (int argc, char **argv)
       /* Print the "no FS processed" diagnostic only if there was no preceding
          diagnostic, e.g., if all have been excluded.  */
       if (exit_status == EXIT_SUCCESS)
-        die (EXIT_FAILURE, 0, _("no file systems processed"));
+        error (EXIT_FAILURE, 0, _("no file systems processed"));
     }
 
   main_exit (exit_status);
diff --git a/src/die.h b/src/die.h
deleted file mode 100644 (file)
index 5d917c7..0000000
--- a/src/die.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Report an error and exit.
-   Copyright 2016-2023 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
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-   02110-1301, USA.  */
-
-#ifndef DIE_H
-# define DIE_H
-
-# include <error.h>
-# include <stddef.h>
-
-/* Like 'error (STATUS, ...)', except STATUS must be a nonzero constant.
-   This may pacify the compiler or help it generate better code.  */
-# define die(status, ...) \
-  verify_expr (status, (error (status, __VA_ARGS__), unreachable ()))
-
-#endif /* DIE_H */
index 9d777185e23e6c417db7f88047b31aae3a6e60b9..bc8967e5671261e28e6662501b0f3f2b2f073689 100644 (file)
@@ -52,8 +52,6 @@
 #if HASH_ALGO_CKSUM
 # include "sm3.h"
 #endif
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "stdio--.h"
 #include "xbinary-io.h"
@@ -1174,8 +1172,8 @@ digest_check (char const *checkfile_name)
 
       ++line_number;
       if (line_number == 0)
-        die (EXIT_FAILURE, 0, _("%s: too many checksum lines"),
-             quotef (checkfile_name));
+        error (EXIT_FAILURE, 0, _("%s: too many checksum lines"),
+               quotef (checkfile_name));
 
       line_length = getline (&line, &line_chars_allocated, checkfile_stream);
       if (line_length <= 0)
@@ -1402,7 +1400,7 @@ main (int argc, char **argv)
         if (digest_length % 8 != 0)
           {
             error (0, 0, _("invalid length: %s"), quote (digest_length_str));
-            die (EXIT_FAILURE, 0, _("length is not a multiple of 8"));
+            error (EXIT_FAILURE, 0, _("length is not a multiple of 8"));
           }
         break;
 #endif
@@ -1477,16 +1475,16 @@ main (int argc, char **argv)
 #if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
 # if HASH_ALGO_CKSUM
   if (digest_length && cksum_algorithm != blake2b)
-    die (EXIT_FAILURE, 0,
-         _("--length is only supported with --algorithm=blake2b"));
+    error (EXIT_FAILURE, 0,
+           _("--length is only supported with --algorithm=blake2b"));
 # endif
   if (digest_length > BLAKE2B_MAX_LEN * 8)
     {
       error (0, 0, _("invalid length: %s"), quote (digest_length_str));
-      die (EXIT_FAILURE, 0,
-           _("maximum digest length for %s is %d bits"),
-           quote (DIGEST_TYPE_STRING),
-           BLAKE2B_MAX_LEN * 8);
+      error (EXIT_FAILURE, 0,
+             _("maximum digest length for %s is %d bits"),
+             quote (DIGEST_TYPE_STRING),
+             BLAKE2B_MAX_LEN * 8);
     }
   if (digest_length == 0)
     {
@@ -1508,8 +1506,8 @@ main (int argc, char **argv)
     case sysv:
     case crc:
         if (do_check && algorithm_specified)
-          die (EXIT_FAILURE, 0,
-              _("--check is not supported with --algorithm={bsd,sysv,crc}"));
+          error (EXIT_FAILURE, 0,
+                 _("--check is not supported with --algorithm={bsd,sysv,crc}"));
         break;
     default:
         break;
@@ -1600,10 +1598,8 @@ main (int argc, char **argv)
   if (optind == argc)
     *operand_lim++ = bad_cast ("-");
   else if (1 < argc - optind && raw_digest)
-    {
-       die (EXIT_FAILURE, 0,
-            _("the --raw option is not supported with multiple files"));
-    }
+    error (EXIT_FAILURE, 0,
+           _("the --raw option is not supported with multiple files"));
 
   for (char **operandp = argv + optind; operandp < operand_lim; operandp++)
     {
@@ -1627,7 +1623,7 @@ main (int argc, char **argv)
     }
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index 1185b79a3817226d4c6fcb09840f34743c3650ce..17b3c8b3fd51fac9cb161cf8410cc7d953031827 100644 (file)
@@ -24,8 +24,6 @@
 #include "system.h"
 #include "dircolors.h"
 #include "c-strcase.h"
-#include "die.h"
-#include "error.h"
 #include "obstack.h"
 #include "quote.h"
 #include "stdio--.h"
@@ -505,10 +503,9 @@ main (int argc, char **argv)
         {
           syntax = guess_shell_syntax ();
           if (syntax == SHELL_SYNTAX_UNKNOWN)
-            {
-              die (EXIT_FAILURE, 0,
-         _("no SHELL environment variable, and no shell type option given"));
-            }
+            error (EXIT_FAILURE, 0,
+                   _("no SHELL environment variable,"
+                     " and no shell type option given"));
         }
 
       obstack_init (&lsc_obstack);
index 73221de485f965b348646c60a7888a21e01e9de0..4ee6cd14e9dc9394a6c16b87d446ceedad971fd6 100644 (file)
@@ -23,7 +23,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "error.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
 #define PROGRAM_NAME "dirname"
index c858d9366bc7f90ad8ee9f950e50f3ccf80b1721..3d098bb326244d145f52b4e34246093feb4064fd 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -31,8 +31,6 @@
 #include "argv-iter.h"
 #include "assure.h"
 #include "di-set.h"
-#include "die.h"
-#include "error.h"
 #include "exclude.h"
 #include "fprintftime.h"
 #include "human.h"
@@ -847,7 +845,7 @@ main (int argc, char **argv)
             if (opt_threshold == 0 && *optarg == '-')
               {
                 /* Do not allow -0, as this wouldn't make sense anyway.  */
-                die (EXIT_FAILURE, 0, _("invalid --threshold argument '-0'"));
+                error (EXIT_FAILURE, 0, _("invalid --threshold argument '-0'"));
               }
           }
           break;
@@ -1024,8 +1022,8 @@ main (int argc, char **argv)
         }
 
       if (! (STREQ (files_from, "-") || freopen (files_from, "r", stdin)))
-        die (EXIT_FAILURE, errno, _("cannot open %s for reading"),
-             quoteaf (files_from));
+        error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+               quoteaf (files_from));
 
       ai = argv_iter_init_stream (stdin);
 
@@ -1132,7 +1130,7 @@ main (int argc, char **argv)
     di_set_free (di_mnt);
 
   if (files_from && (ferror (stdin) || fclose (stdin) != 0) && ok)
-    die (EXIT_FAILURE, 0, _("error reading %s"), quoteaf (files_from));
+    error (EXIT_FAILURE, 0, _("error reading %s"), quoteaf (files_from));
 
   if (print_grand_total)
     print_size (&tot_dui, _("total"));
index dfce47a641bf4de93bf032bba723c83195a34d04..58879737ba8c4d286b0fb9c7659d1646832aa792 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -24,8 +24,6 @@
 #include <signal.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "idx.h"
 #include "operand2sig.h"
 #include "quote.h"
@@ -182,8 +180,8 @@ unset_envvars (void)
       devmsg ("unset:    %s\n", usvars[i]);
 
       if (unsetenv (usvars[i]))
-        die (EXIT_CANCELED, errno, _("cannot unset %s"),
-             quote (usvars[i]));
+        error (EXIT_CANCELED, errno, _("cannot unset %s"),
+               quote (usvars[i]));
     }
 }
 
@@ -424,8 +422,8 @@ build_argv (char const *str, int extra_argc, int *argc)
 
             case 'c':
               if (dq)
-                die (EXIT_CANCELED, 0,
-                     _("'\\c' must not appear in double-quoted -S string"));
+                error (EXIT_CANCELED, 0,
+                       _("'\\c' must not appear in double-quoted -S string"));
               goto eos; /* '\c' terminates the string.  */
 
             case 'f': newc = '\f'; break;
@@ -435,11 +433,12 @@ build_argv (char const *str, int extra_argc, int *argc)
             case 'v': newc = '\v'; break;
 
             case '\0':
-              die (EXIT_CANCELED, 0,
-                   _("invalid backslash at end of string in -S"));
+              error (EXIT_CANCELED, 0,
+                     _("invalid backslash at end of string in -S"));
 
             default:
-              die (EXIT_CANCELED, 0, _("invalid sequence '\\%c' in -S"), newc);
+              error (EXIT_CANCELED, 0,
+                     _("invalid sequence '\\%c' in -S"), newc);
             }
           break;
 
@@ -452,9 +451,9 @@ build_argv (char const *str, int extra_argc, int *argc)
           {
             char *n = extract_varname (str);
             if (!n)
-              die (EXIT_CANCELED, 0,
-                   _("only ${VARNAME} expansion is supported, error at: %s"),
-                   str);
+              error (EXIT_CANCELED, 0,
+                     _("only ${VARNAME} expansion is supported, error at: %s"),
+                     str);
 
             char *v = getenv (n);
             if (v)
@@ -478,7 +477,7 @@ build_argv (char const *str, int extra_argc, int *argc)
     }
 
   if (dq || sq)
-    die (EXIT_CANCELED, 0, _("no terminating quote in -S string"));
+    error (EXIT_CANCELED, 0, _("no terminating quote in -S string"));
 
  eos:
   splitbuf_append_byte (&ss, '\0');
@@ -594,16 +593,16 @@ reset_signal_handlers (void)
       int sig_err = sigaction (i, nullptr, &act);
 
       if (sig_err && !ignore_errors)
-        die (EXIT_CANCELED, errno,
-             _("failed to get signal action for signal %d"), i);
+        error (EXIT_CANCELED, errno,
+               _("failed to get signal action for signal %d"), i);
 
       if (! sig_err)
         {
           act.sa_handler = set_to_default ? SIG_DFL : SIG_IGN;
           sig_err = sigaction (i, &act, nullptr);
           if (sig_err && !ignore_errors)
-            die (EXIT_CANCELED, errno,
-                 _("failed to set signal action for signal %d"), i);
+            error (EXIT_CANCELED, errno,
+                   _("failed to set signal action for signal %d"), i);
         }
 
       if (dev_debug)
@@ -675,7 +674,7 @@ set_signal_proc_mask (void)
   sigemptyset (&set);
 
   if (sigprocmask (0, nullptr, &set))
-    die (EXIT_CANCELED, errno, _("failed to get signal process mask"));
+    error (EXIT_CANCELED, errno, _("failed to get signal process mask"));
 
   for (int i = 1; i <= SIGNUM_BOUND; i++)
     {
@@ -704,7 +703,7 @@ set_signal_proc_mask (void)
     }
 
   if (sigprocmask (SIG_SETMASK, &set, nullptr))
-    die (EXIT_CANCELED, errno, _("failed to set signal process mask"));
+    error (EXIT_CANCELED, errno, _("failed to set signal process mask"));
 }
 
 static void
@@ -715,7 +714,7 @@ list_signal_handling (void)
 
   sigemptyset (&set);
   if (sigprocmask (0, nullptr, &set))
-    die (EXIT_CANCELED, errno, _("failed to get signal process mask"));
+    error (EXIT_CANCELED, errno, _("failed to get signal process mask"));
 
   for (int i = 1; i <= SIGNUM_BOUND; i++)
     {
@@ -840,8 +839,8 @@ main (int argc, char **argv)
       if (putenv (argv[optind]))
         {
           *eq = '\0';
-          die (EXIT_CANCELED, errno, _("cannot set %s"),
-               quote (argv[optind]));
+          error (EXIT_CANCELED, errno, _("cannot set %s"),
+                 quote (argv[optind]));
         }
       optind++;
     }
@@ -881,8 +880,8 @@ main (int argc, char **argv)
       devmsg ("chdir:    %s\n", quoteaf (newdir));
 
       if (chdir (newdir) != 0)
-        die (EXIT_CANCELED, errno, _("cannot change directory to %s"),
-             quoteaf (newdir));
+        error (EXIT_CANCELED, errno, _("cannot change directory to %s"),
+               quoteaf (newdir));
     }
 
   if (dev_debug)
index f5c64ba02d4a374a09a7abd136a1e2a8594bbc89..cc2a1955eaeff51bf6d87c708eb4f3ac231eb669 100644 (file)
@@ -19,8 +19,6 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "quote.h"
 
@@ -85,7 +83,7 @@ add_tab_stop (uintmax_t tabval)
   if (max_column_width < column_width)
     {
       if (SIZE_MAX < column_width)
-        die (EXIT_FAILURE, 0, _("tabs are too far apart"));
+        error (EXIT_FAILURE, 0, _("tabs are too far apart"));
       max_column_width = column_width;
     }
 }
@@ -239,14 +237,14 @@ validate_tab_stops (uintmax_t const *tabs, size_t entries)
   for (size_t i = 0; i < entries; i++)
     {
       if (tabs[i] == 0)
-        die (EXIT_FAILURE, 0, _("tab size cannot be 0"));
+        error (EXIT_FAILURE, 0, _("tab size cannot be 0"));
       if (tabs[i] <= prev_tab)
-        die (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
+        error (EXIT_FAILURE, 0, _("tab sizes must be ascending"));
       prev_tab = tabs[i];
     }
 
   if (increment_size && extend_size)
-    die (EXIT_FAILURE, 0, _("'/' specifier is mutually exclusive with '+'"));
+    error (EXIT_FAILURE, 0, _("'/' specifier is mutually exclusive with '+'"));
 }
 
 /* Called after all command-line options have been parsed,
@@ -376,7 +374,7 @@ extern void
 cleanup_file_list_stdin (void)
 {
     if (have_read_stdin && fclose (stdin) != 0)
-      die (EXIT_FAILURE, errno, "-");
+      error (EXIT_FAILURE, errno, "-");
 }
 
 
index 79752d39f1966dde39190c608ebfab822aaac133..adad9d9d824898654a148cc9df03fdc627a28c9c 100644 (file)
@@ -38,8 +38,6 @@
 #include <getopt.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-
 #include "expand-common.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
@@ -142,11 +140,11 @@ expand (void)
                     next_tab_column = column + 1;
 
                   if (next_tab_column < column)
-                    die (EXIT_FAILURE, 0, _("input line is too long"));
+                    error (EXIT_FAILURE, 0, _("input line is too long"));
 
                   while (++column < next_tab_column)
                     if (putchar (' ') < 0)
-                      die (EXIT_FAILURE, errno, _("write error"));
+                      error (EXIT_FAILURE, errno, _("write error"));
 
                   c = ' ';
                 }
@@ -161,7 +159,7 @@ expand (void)
                 {
                   column++;
                   if (!column)
-                    die (EXIT_FAILURE, 0, _("input line is too long"));
+                    error (EXIT_FAILURE, 0, _("input line is too long"));
                 }
 
               convert &= convert_entire_line || !! isblank (c);
@@ -171,7 +169,7 @@ expand (void)
             return;
 
           if (putchar (c) < 0)
-            die (EXIT_FAILURE, errno, _("write error"));
+            error (EXIT_FAILURE, errno, _("write error"));
         }
       while (c != '\n');
     }
index 6ae0fae79cbbbfac9b2ddeb02ceb6ce11b2ac10c..8a76cbf7ce30502e2146ea6299880ca1b3c5a811 100644 (file)
@@ -35,8 +35,6 @@
 
 #include <gmp.h>
 #include <regex.h>
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "mbuiter.h"
 #include "strnumcmp.h"
@@ -352,8 +350,8 @@ main (int argc, char **argv)
 
   v = eval (true);
   if (!nomoreargs ())
-    die (EXPR_INVALID, 0, _("syntax error: unexpected argument %s"),
-         quotearg_n_style (0, locale_quoting_style, *args));
+    error (EXPR_INVALID, 0, _("syntax error: unexpected argument %s"),
+           quotearg_n_style (0, locale_quoting_style, *args));
 
   printv (v);
 
@@ -499,7 +497,7 @@ toarith (VALUE *v)
         if (! looks_like_integer (s))
           return false;
         if (mpz_init_set_str (v->u.i, s, 10) != 0)
-          die (EXPR_FAILURE, ERANGE, "%s", (s));
+          error (EXPR_FAILURE, ERANGE, "%s", (s));
         free (s);
         v->type = integer;
         return true;
@@ -557,8 +555,8 @@ static void
 require_more_args (void)
 {
   if (nomoreargs ())
-    die (EXPR_INVALID, 0, _("syntax error: missing argument after %s"),
-         quotearg_n_style (0, locale_quoting_style, *(args - 1)));
+    error (EXPR_INVALID, 0, _("syntax error: missing argument after %s"),
+           quotearg_n_style (0, locale_quoting_style, *(args - 1)));
 }
 
 
@@ -607,7 +605,7 @@ docolon (VALUE *sv, VALUE *pv)
     RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
   errmsg = re_compile_pattern (pv->u.s, strlen (pv->u.s), &re_buffer);
   if (errmsg)
-    die (EXPR_INVALID, 0, "%s", (errmsg));
+    error (EXPR_INVALID, 0, "%s", (errmsg));
   re_buffer.newline_anchor = 0;
 
   matchlen = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
@@ -643,9 +641,9 @@ docolon (VALUE *sv, VALUE *pv)
         v = int_value (0);
     }
   else
-    die (EXPR_FAILURE,
-         (matchlen == -2 ? errno : EOVERFLOW),
-         _("error in regular expression matcher"));
+    error (EXPR_FAILURE,
+           matchlen == -2 ? errno : EOVERFLOW,
+           _("error in regular expression matcher"));
 
   if (0 < re_regs.num_regs)
     {
@@ -673,16 +671,16 @@ eval7 (bool evaluate)
     {
       v = eval (evaluate);
       if (nomoreargs ())
-        die (EXPR_INVALID, 0, _("syntax error: expecting ')' after %s"),
-             quotearg_n_style (0, locale_quoting_style, *(args - 1)));
+        error (EXPR_INVALID, 0, _("syntax error: expecting ')' after %s"),
+               quotearg_n_style (0, locale_quoting_style, *(args - 1)));
       if (!nextarg (")"))
-        die (EXPR_INVALID, 0, _("syntax error: expecting ')' instead of %s"),
-             quotearg_n_style (0, locale_quoting_style, *args));
+        error (EXPR_INVALID, 0, _("syntax error: expecting ')' instead of %s"),
+               quotearg_n_style (0, locale_quoting_style, *args));
       return v;
     }
 
   if (nextarg (")"))
-    die (EXPR_INVALID, 0, _("syntax error: unexpected ')'"));
+    error (EXPR_INVALID, 0, _("syntax error: unexpected ')'"));
 
   return str_value (*args++);
 }
@@ -828,9 +826,9 @@ eval4 (bool evaluate)
       if (evaluate)
         {
           if (!toarith (l) || !toarith (r))
-            die (EXPR_INVALID, 0, _("non-integer argument"));
+            error (EXPR_INVALID, 0, _("non-integer argument"));
           if (fxn != multiply && mpz_sgn (r->u.i) == 0)
-            die (EXPR_INVALID, 0, _("division by zero"));
+            error (EXPR_INVALID, 0, _("division by zero"));
           ((fxn == multiply ? mpz_mul
             : fxn == divide ? mpz_tdiv_q
             : mpz_tdiv_r)
@@ -865,7 +863,7 @@ eval3 (bool evaluate)
       if (evaluate)
         {
           if (!toarith (l) || !toarith (r))
-            die (EXPR_INVALID, 0, _("non-integer argument"));
+            error (EXPR_INVALID, 0, _("non-integer argument"));
           (fxn == plus ? mpz_add : mpz_sub) (l->u.i, l->u.i, r->u.i);
         }
       freev (r);
@@ -925,10 +923,10 @@ eval2 (bool evaluate)
                 {
                   error (0, errno, _("string comparison failed"));
                   error (0, 0, _("set LC_ALL='C' to work around the problem"));
-                  die (EXPR_INVALID, 0,
-                       _("the strings compared were %s and %s"),
-                       quotearg_n_style (0, locale_quoting_style, l->u.s),
-                       quotearg_n_style (1, locale_quoting_style, r->u.s));
+                  error (EXPR_INVALID, 0,
+                         _("the strings compared were %s and %s"),
+                         quotearg_n_style (0, locale_quoting_style, l->u.s),
+                         quotearg_n_style (1, locale_quoting_style, r->u.s));
                 }
             }
 
index 6f61a1e12ddb0b9883554e28a5fc6d6da78abfb6..8ea00a13eae196545669bb77817e8808406fd2a7 100644 (file)
 
 #include "system.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "full-write.h"
 #include "quote.h"
 #include "readtokens.h"
@@ -2096,7 +2094,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors)
               if (g <= L)
                 {
                   if (qpos >= QUEUE_SIZE)
-                    die (EXIT_FAILURE, 0, _("squfof queue overflow"));
+                    error (EXIT_FAILURE, 0, _("squfof queue overflow"));
                   queue[qpos].Q = g;
                   queue[qpos].P = P % g;
                   qpos++;
@@ -2363,7 +2361,7 @@ lbuf_flush (void)
 {
   size_t size = lbuf.end - lbuf.buf;
   if (full_write (STDOUT_FILENO, lbuf.buf, size) != size)
-    die (EXIT_FAILURE, errno, "%s", _("write error"));
+    error (EXIT_FAILURE, errno, "%s", _("write error"));
   lbuf.end = lbuf.buf;
 }
 
@@ -2587,7 +2585,7 @@ do_stdin (void)
       if (token_length == (size_t) -1)
         {
           if (ferror (stdin))
-            die (EXIT_FAILURE, errno, _("error reading input"));
+            error (EXIT_FAILURE, errno, _("error reading input"));
           break;
         }
 
index 3c87284e3b23b3288d0232204d6b1b603d36ee8f..30906de0326dbabba188abc5fab6ec759f2ca4d6 100644 (file)
@@ -18,8 +18,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "save-cwd.h"
 #include "xgetcwd.h"
 #include "find-mount-point.h"
@@ -103,8 +101,8 @@ done:
   {
     int save_errno = errno;
     if (restore_cwd (&cwd) != 0)
-      die (EXIT_FAILURE, errno,
-           _("failed to return to initial working directory"));
+      error (EXIT_FAILURE, errno,
+             _("failed to return to initial working directory"));
     free_cwd (&cwd);
     errno = save_errno;
   }
index 8973ada76e35daa9dca3deefb13e896b8d39846d..cfb4bcf7d5417acc4d1e6da1e898ed3cf8bccb57 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -27,8 +27,6 @@
 
 #include "c-ctype.h"
 #include "system.h"
-#include "error.h"
-#include "die.h"
 #include "fadvise.h"
 #include "xdectoint.h"
 
@@ -447,7 +445,7 @@ main (int argc, char **argv)
     }
 
   if (have_read_stdin && fclose (stdin) != 0)
-    die (EXIT_FAILURE, errno, "%s", _("closing standard input"));
+    error (EXIT_FAILURE, errno, "%s", _("closing standard input"));
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index f68382b833789d1a68808114cb38922018607e1d..5c0428d8084a7162a4ec28a3fe9e85a398ee19f0 100644 (file)
@@ -23,8 +23,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "xdectoint.h"
 
@@ -303,7 +301,7 @@ main (int argc, char **argv)
     }
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index 79d9ca6d10a0f315187f2651b586e2b4edca6149..d94d79e757c20355ce8e18cf9671d6e0e1b5c36f 100644 (file)
@@ -25,7 +25,6 @@
 #include <grp.h>
 
 #include "system.h"
-#include "error.h"
 #include "mgetgroups.h"
 #include "quote.h"
 #include "group-list.h"
index 09ef6fa82ccbc3b73806ff05acda962b2d501796..cc90694ebd5fd9ac65915464283660f2cd33c94d 100644 (file)
@@ -25,7 +25,6 @@
 #include <getopt.h>
 
 #include "system.h"
-#include "die.h"
 #include "group-list.h"
 #include "quote.h"
 
@@ -103,17 +102,17 @@ main (int argc, char **argv)
       errno = 0;
       ruid = getuid ();
       if (ruid == NO_UID && errno)
-        die (EXIT_FAILURE, errno, _("cannot get real UID"));
+        error (EXIT_FAILURE, errno, _("cannot get real UID"));
 
       errno = 0;
       egid = getegid ();
       if (egid == NO_GID && errno)
-        die (EXIT_FAILURE, errno, _("cannot get effective GID"));
+        error (EXIT_FAILURE, errno, _("cannot get effective GID"));
 
       errno = 0;
       rgid = getgid ();
       if (rgid == NO_GID && errno)
-        die (EXIT_FAILURE, errno, _("cannot get real GID"));
+        error (EXIT_FAILURE, errno, _("cannot get real GID"));
 
       if (!print_group_list (nullptr, ruid, rgid, egid, true, ' '))
         ok = false;
index ba66a5887c904677592c41ac829976ad702bae34..7bba1420c4290d3c82b4daa17d5c54baa9b7372b 100644 (file)
@@ -32,8 +32,6 @@
 #include "system.h"
 
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "full-read.h"
 #include "quote.h"
 #include "safe-read.h"
@@ -183,8 +181,8 @@ xwrite_stdout (char const *buffer, size_t n_bytes)
   if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) < n_bytes)
     {
       clearerr (stdout); /* To avoid redundant close_stdout diagnostic.  */
-      die (EXIT_FAILURE, errno, _("error writing %s"),
-           quoteaf ("standard output"));
+      error (EXIT_FAILURE, errno, _("error writing %s"),
+             quoteaf ("standard output"));
     }
 }
 
@@ -273,8 +271,8 @@ elide_tail_bytes_pipe (char const *filename, int fd, uintmax_t n_elide_0,
   if (SIZE_MAX < n_elide_0 + READ_BUFSIZE)
     {
       char umax_buf[INT_BUFSIZE_BOUND (n_elide_0)];
-      die (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
-           umaxtostr (n_elide_0, umax_buf));
+      error (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
+             umaxtostr (n_elide_0, umax_buf));
     }
 
   /* Two cases to consider...
@@ -1078,8 +1076,8 @@ main (int argc, char **argv)
   if ( ! count_lines && elide_from_end && OFF_T_MAX < n_units)
     {
       char umax_buf[INT_BUFSIZE_BOUND (n_units)];
-      die (EXIT_FAILURE, EOVERFLOW, "%s: %s", _("invalid number of bytes"),
-           quote (umaxtostr (n_units, umax_buf)));
+      error (EXIT_FAILURE, EOVERFLOW, "%s: %s", _("invalid number of bytes"),
+             quote (umaxtostr (n_units, umax_buf)));
     }
 
   file_list = (optind < argc
@@ -1092,7 +1090,7 @@ main (int argc, char **argv)
     ok &= head_file (file_list[i], n_units, count_lines, elide_from_end);
 
   if (have_read_stdin && close (STDIN_FILENO) < 0)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index aefc2af04b773fea7ee4fac29ead2f5b11a02683..79f83b3ae5631895c71773d7871b4a53fceee193 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "system.h"
 #include "long-options.h"
-#include "error.h"
 #include "quote.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
index 177411a075bdb5efdd7a46a86ec311c3f25bdd56..115cac2899cea7029f8baaa1dea1f8e788e24fc3 100644 (file)
@@ -22,8 +22,6 @@
 
 #include "system.h"
 #include "long-options.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "xgethostname.h"
 
@@ -99,14 +97,14 @@ main (int argc, char **argv)
       /* Set hostname to operand.  */
       char const *name = argv[optind];
       if (sethostname (name, strlen (name)) != 0)
-        die (EXIT_FAILURE, errno, _("cannot set name to %s"),
-             quote (name));
+        error (EXIT_FAILURE, errno, _("cannot set name to %s"),
+               quote (name));
     }
   else
     {
       hostname = xgethostname ();
       if (hostname == nullptr)
-        die (EXIT_FAILURE, errno, _("cannot determine hostname"));
+        error (EXIT_FAILURE, errno, _("cannot determine hostname"));
       puts (hostname);
     }
 
index 4ae779a1af4aaff1d2f3876075e4b4d1cf265893..cf153aef51993fe63a33cb5bf0e9f356f5ed83c3 100644 (file)
--- a/src/id.c
+++ b/src/id.c
@@ -26,8 +26,6 @@
 #include <selinux/selinux.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "mgetgroups.h"
 #include "quote.h"
 #include "group-list.h"
@@ -148,13 +146,13 @@ main (int argc, char **argv)
           /* politely decline if we're not on a SELinux/SMACK-enabled kernel. */
 #ifdef HAVE_SMACK
           if (!selinux_enabled && !smack_enabled)
-            die (EXIT_FAILURE, 0,
-                 _("--context (-Z) works only on "
-                   "an SELinux/SMACK-enabled kernel"));
+            error (EXIT_FAILURE, 0,
+                   _("--context (-Z) works only on "
+                     "an SELinux/SMACK-enabled kernel"));
 #else
           if (!selinux_enabled)
-            die (EXIT_FAILURE, 0,
-                 _("--context (-Z) works only on an SELinux-enabled kernel"));
+            error (EXIT_FAILURE, 0,
+                   _("--context (-Z) works only on an SELinux-enabled kernel"));
 #endif
           just_context = true;
           break;
@@ -187,11 +185,11 @@ main (int argc, char **argv)
   size_t n_ids = argc - optind;
 
   if (n_ids && just_context)
-    die (EXIT_FAILURE, 0,
-         _("cannot print security context when user specified"));
+    error (EXIT_FAILURE, 0,
+           _("cannot print security context when user specified"));
 
   if (just_user + just_group + just_group_list + just_context > 1)
-    die (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice"));
+    error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice"));
 
   bool default_format = ! (just_user
                            || just_group
@@ -199,12 +197,12 @@ main (int argc, char **argv)
                            || just_context);
 
   if (default_format && (use_real || use_name))
-    die (EXIT_FAILURE, 0,
-         _("cannot print only names or real IDs in default format"));
+    error (EXIT_FAILURE, 0,
+           _("cannot print only names or real IDs in default format"));
 
   if (default_format && opt_zero)
-    die (EXIT_FAILURE, 0,
-         _("option --zero not permitted in default format"));
+    error (EXIT_FAILURE, 0,
+           _("option --zero not permitted in default format"));
 
   /* If we are on a SELinux/SMACK-enabled kernel, no user is specified, and
      either --context is specified or none of (-u,-g,-G) is specified,
@@ -220,7 +218,7 @@ main (int argc, char **argv)
           || (smack_enabled
               && smack_new_label_from_self (&context) < 0
               && just_context))
-        die (EXIT_FAILURE, 0, _("can't get process context"));
+        error (EXIT_FAILURE, 0, _("can't get process context"));
     }
 
   if (n_ids >= 1)
@@ -275,7 +273,7 @@ main (int argc, char **argv)
           errno = 0;
           euid = geteuid ();
           if (euid == NO_UID && errno)
-            die (EXIT_FAILURE, errno, _("cannot get effective UID"));
+            error (EXIT_FAILURE, errno, _("cannot get effective UID"));
         }
 
       if (just_user ? use_real
@@ -284,7 +282,7 @@ main (int argc, char **argv)
           errno = 0;
           ruid = getuid ();
           if (ruid == NO_UID && errno)
-            die (EXIT_FAILURE, errno, _("cannot get real UID"));
+            error (EXIT_FAILURE, errno, _("cannot get real UID"));
         }
 
       if (!just_user && (just_group || just_group_list || !just_context))
@@ -292,12 +290,12 @@ main (int argc, char **argv)
           errno = 0;
           egid = getegid ();
           if (egid == NO_GID && errno)
-            die (EXIT_FAILURE, errno, _("cannot get effective GID"));
+            error (EXIT_FAILURE, errno, _("cannot get effective GID"));
 
           errno = 0;
           rgid = getgid ();
           if (rgid == NO_GID && errno)
-            die (EXIT_FAILURE, errno, _("cannot get real GID"));
+            error (EXIT_FAILURE, errno, _("cannot get real GID"));
         }
         print_stuff (nullptr);
     }
index 73a3d1f0a3fc14c0afadfeb5d0f9ddf24422f76d..31a48f114d334287a6aa2232cbb1e10520400312 100644 (file)
 
 #include "system.h"
 #include "backupfile.h"
-#include "error.h"
 #include "cp-hash.h"
 #include "copy.h"
-#include "die.h"
 #include "filenamecat.h"
 #include "full-read.h"
 #include "mkancesdirs.h"
@@ -507,7 +505,8 @@ strip (char const *name)
         if (name && *name == '-')
           safe_name = file_name_concat (".", name, nullptr);
         execlp (strip_program, strip_program, safe_name, nullptr);
-        die (EXIT_FAILURE, errno, _("cannot run %s"), quoteaf (strip_program));
+        error (EXIT_FAILURE, errno, _("cannot run %s"),
+               quoteaf (strip_program));
       }
     default:                   /* Parent. */
       if (waitpid (pid, &status, 0) < 0)
@@ -537,8 +536,8 @@ get_ids (void)
           uintmax_t tmp;
           if (xstrtoumax (owner_name, nullptr, 0, &tmp, "") != LONGINT_OK
               || UID_T_MAX < tmp)
-            die (EXIT_FAILURE, 0, _("invalid user %s"),
-                 quote (owner_name));
+            error (EXIT_FAILURE, 0, _("invalid user %s"),
+                   quoteaf (owner_name));
           owner_id = tmp;
         }
       else
@@ -556,8 +555,8 @@ get_ids (void)
           uintmax_t tmp;
           if (xstrtoumax (group_name, nullptr, 0, &tmp, "") != LONGINT_OK
               || GID_T_MAX < tmp)
-            die (EXIT_FAILURE, 0, _("invalid group %s"),
-                 quote (group_name));
+            error (EXIT_FAILURE, 0, _("invalid group %s"),
+                   quoteaf (group_name));
           group_id = tmp;
         }
       else
@@ -668,7 +667,7 @@ install_file_in_file (char const *from, char const *to,
     if (! strip (to))
       {
         if (unlinkat (to_dirfd, to_relname, 0) != 0)  /* Cleanup.  */
-          die (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (to));
+          error (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (to));
         return false;
       }
   if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))
@@ -865,8 +864,8 @@ main (int argc, char **argv)
           break;
         case 't':
           if (target_directory)
-            die (EXIT_FAILURE, 0,
-                 _("multiple target directories specified"));
+            error (EXIT_FAILURE, 0,
+                   _("multiple target directories specified"));
           target_directory = optarg;
           break;
         case 'T':
@@ -915,11 +914,11 @@ main (int argc, char **argv)
 
   /* Check for invalid combinations of arguments. */
   if (dir_arg && strip_files)
-    die (EXIT_FAILURE, 0,
-         _("the strip option may not be used when installing a directory"));
+    error (EXIT_FAILURE, 0,
+           _("the strip option may not be used when installing a directory"));
   if (dir_arg && target_directory)
-    die (EXIT_FAILURE, 0,
-         _("target directory not allowed when installing a directory"));
+    error (EXIT_FAILURE, 0,
+           _("target directory not allowed when installing a directory"));
 
   x.backup_type = (make_backups
                    ? xget_version (_("backup type"),
@@ -928,12 +927,12 @@ main (int argc, char **argv)
   set_simple_backup_suffix (backup_suffix);
 
   if (x.preserve_security_context && (x.set_security_context || scontext))
-    die (EXIT_FAILURE, 0,
-         _("cannot set target context and preserve it"));
+    error (EXIT_FAILURE, 0,
+           _("cannot set target context and preserve it"));
 
   if (scontext && setfscreatecon (scontext) < 0)
-    die (EXIT_FAILURE, errno,
-         _("failed to set default file creation context to %s"),
+    error (EXIT_FAILURE, errno,
+           _("failed to set default file creation context to %s"),
          quote (scontext));
 
   n_files = argc - optind;
@@ -954,9 +953,9 @@ main (int argc, char **argv)
   if (no_target_directory)
     {
       if (target_directory)
-        die (EXIT_FAILURE, 0,
-             _("cannot combine --target-directory (-t) "
-               "and --no-target-directory (-T)"));
+        error (EXIT_FAILURE, 0,
+               _("cannot combine --target-directory (-t) "
+                 "and --no-target-directory (-T)"));
       if (2 < n_files)
         {
           error (0, 0, _("extra operand %s"), quoteaf (file[2]));
@@ -968,8 +967,8 @@ main (int argc, char **argv)
       target_dirfd = target_directory_operand (target_directory, &sb);
       if (! (target_dirfd_valid (target_dirfd)
              || (mkdir_and_install && errno == ENOENT)))
-        die (EXIT_FAILURE, errno, _("failed to access %s"),
-             quoteaf (target_directory));
+        error (EXIT_FAILURE, errno, _("failed to access %s"),
+               quoteaf (target_directory));
     }
   else if (!dir_arg)
     {
@@ -982,14 +981,14 @@ main (int argc, char **argv)
           n_files--;
         }
       else if (2 < n_files)
-        die (EXIT_FAILURE, errno, _("target %s"), quoteaf (lastfile));
+        error (EXIT_FAILURE, errno, _("target %s"), quoteaf (lastfile));
     }
 
   if (specified_mode)
     {
       struct mode_change *change = mode_compile (specified_mode);
       if (!change)
-        die (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
+        error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
       mode = mode_adjust (0, false, 0, change, nullptr);
       dir_mode = mode_adjust (0, true, 0, change, &dir_mode_bits);
       free (change);
index 1a236141008c22c176b14ea34599af4a9bcb738b..5b58ed4d5963955383b363ea2e1a666bb8072f88 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "hard-locale.h"
 #include "linebuffer.h"
@@ -466,7 +464,7 @@ get_line (FILE *fp, struct line **linep, int which)
   if (! readlinebuffer_delim (&line->buf, fp, eolchar))
     {
       if (ferror (fp))
-        die (EXIT_FAILURE, errno, _("read error"));
+        error (EXIT_FAILURE, errno, _("read error"));
       freeline (line);
       return false;
     }
@@ -849,7 +847,7 @@ string_to_join_field (char const *str)
   if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && SIZE_MAX < val))
     val = SIZE_MAX;
   else if (s_err != LONGINT_OK || val == 0)
-    die (EXIT_FAILURE, 0, _("invalid field number: %s"), quote (str));
+    error (EXIT_FAILURE, 0, _("invalid field number: %s"), quote (str));
 
   result = val - 1;
 
@@ -870,7 +868,7 @@ decode_field_spec (char const *s, int *file_index, size_t *field_index)
       if (s[1])
         {
           /* '0' must be all alone -- no '.FIELD'.  */
-          die (EXIT_FAILURE, 0, _("invalid field specifier: %s"), quote (s));
+          error (EXIT_FAILURE, 0, _("invalid field specifier: %s"), quote (s));
         }
       *file_index = 0;
       *field_index = 0;
@@ -879,14 +877,14 @@ decode_field_spec (char const *s, int *file_index, size_t *field_index)
     case '1':
     case '2':
       if (s[1] != '.')
-        die (EXIT_FAILURE, 0, _("invalid field specifier: %s"), quote (s));
+        error (EXIT_FAILURE, 0, _("invalid field specifier: %s"), quote (s));
       *file_index = s[0] - '0';
       *field_index = string_to_join_field (s + 2);
       break;
 
     default:
-      die (EXIT_FAILURE, 0,
-           _("invalid file number in field spec: %s"), quote (s));
+      error (EXIT_FAILURE, 0,
+             _("invalid file number in field spec: %s"), quote (s));
     }
 }
 
@@ -922,8 +920,8 @@ set_join_field (size_t *var, size_t val)
     {
       unsigned long int var1 = *var + 1;
       unsigned long int val1 = val + 1;
-      die (EXIT_FAILURE, 0,
-           _("incompatible join fields %lu, %lu"), var1, val1);
+      error (EXIT_FAILURE, 0,
+             _("incompatible join fields %lu, %lu"), var1, val1);
     }
   *var = val;
 }
@@ -1039,8 +1037,8 @@ main (int argc, char **argv)
             unsigned long int val;
             if (xstrtoul (optarg, nullptr, 10, &val, "") != LONGINT_OK
                 || (val != 1 && val != 2))
-              die (EXIT_FAILURE, 0,
-                   _("invalid field number: %s"), quote (optarg));
+              error (EXIT_FAILURE, 0,
+                     _("invalid field number: %s"), quote (optarg));
             if (val == 1)
               print_unpairables_1 = true;
             else
@@ -1050,8 +1048,8 @@ main (int argc, char **argv)
 
         case 'e':
           if (empty_filler && ! STREQ (empty_filler, optarg))
-            die (EXIT_FAILURE, 0,
-                 _("conflicting empty-field replacement strings"));
+            error (EXIT_FAILURE, 0,
+                   _("conflicting empty-field replacement strings"));
           empty_filler = optarg;
           break;
 
@@ -1103,11 +1101,11 @@ main (int argc, char **argv)
                 if (STREQ (optarg, "\\0"))
                   newtab = '\0';
                 else
-                  die (EXIT_FAILURE, 0, _("multi-character tab %s"),
-                       quote (optarg));
+                  error (EXIT_FAILURE, 0, _("multi-character tab %s"),
+                         quote (optarg));
               }
             if (0 <= tab && tab != newtab)
-              die (EXIT_FAILURE, 0, _("incompatible tabs"));
+              error (EXIT_FAILURE, 0, _("incompatible tabs"));
             tab = newtab;
           }
           break;
@@ -1175,21 +1173,21 @@ main (int argc, char **argv)
 
   fp1 = STREQ (g_names[0], "-") ? stdin : fopen (g_names[0], "r");
   if (!fp1)
-    die (EXIT_FAILURE, errno, "%s", quotef (g_names[0]));
+    error (EXIT_FAILURE, errno, "%s", quotef (g_names[0]));
   fp2 = STREQ (g_names[1], "-") ? stdin : fopen (g_names[1], "r");
   if (!fp2)
-    die (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
+    error (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
   if (fp1 == fp2)
-    die (EXIT_FAILURE, errno, _("both files cannot be standard input"));
+    error (EXIT_FAILURE, errno, _("both files cannot be standard input"));
   join (fp1, fp2);
 
   if (fclose (fp1) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (g_names[0]));
+    error (EXIT_FAILURE, errno, "%s", quotef (g_names[0]));
   if (fclose (fp2) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
+    error (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
 
   if (issued_disorder_warning[0] || issued_disorder_warning[1])
-    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
+    error (EXIT_FAILURE, 0, _("input is not in sorted order"));
   else
     return EXIT_SUCCESS;
 }
index 10d0bd4e17c1967d45f04747ddd3574406ec33e7..ba448d995c55fecaade59673e455018dd949aac5 100644 (file)
@@ -23,7 +23,6 @@
 #include <signal.h>
 
 #include "system.h"
-#include "error.h"
 #include "sig2str.h"
 #include "operand2sig.h"
 #include "quote.h"
index 298a0235fc9c8c76b10c49ac3d5d67e55acc72bc..1f92773a0a80e39ec58c2544d0c3ec19fa821fb5 100644 (file)
@@ -25,8 +25,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 
@@ -86,8 +84,8 @@ main (int argc, char **argv)
     }
 
   if (link (argv[optind], argv[optind + 1]) != 0)
-    die (EXIT_FAILURE, errno, _("cannot create link %s to %s"),
-         quoteaf_n (0, argv[optind + 1]), quoteaf_n (1, argv[optind]));
+    error (EXIT_FAILURE, errno, _("cannot create link %s to %s"),
+           quoteaf_n (0, argv[optind + 1]), quoteaf_n (1, argv[optind]));
 
   return EXIT_SUCCESS;
 }
index 379e3f752c7777d140137cc92674073411bfc48d..5ff6e58071aef7e81aa55dd75d9bed9b09282972 100644 (file)
--- a/src/ln.c
+++ b/src/ln.c
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "backupfile.h"
-#include "die.h"
-#include "error.h"
 #include "fcntl-safer.h"
 #include "filenamecat.h"
 #include "file-set.h"
@@ -530,16 +528,16 @@ main (int argc, char **argv)
           break;
         case 't':
           if (target_directory)
-            die (EXIT_FAILURE, 0, _("multiple target directories specified"));
+            error (EXIT_FAILURE, 0, _("multiple target directories specified"));
           else
             {
               struct stat st;
               if (stat (optarg, &st) != 0)
-                die (EXIT_FAILURE, errno, _("failed to access %s"),
-                     quoteaf (optarg));
+                error (EXIT_FAILURE, errno, _("failed to access %s"),
+                       quoteaf (optarg));
               if (! S_ISDIR (st.st_mode))
-                die (EXIT_FAILURE, 0, _("target %s is not a directory"),
-                     quoteaf (optarg));
+                error (EXIT_FAILURE, 0, _("target %s is not a directory"),
+                       quoteaf (optarg));
             }
           target_directory = optarg;
           break;
@@ -571,7 +569,7 @@ main (int argc, char **argv)
     }
 
   if (relative && !symbolic_link)
-    die (EXIT_FAILURE, 0, _("cannot do --relative without --symbolic"));
+    error (EXIT_FAILURE, 0, _("cannot do --relative without --symbolic"));
 
   if (!hard_dir_link)
     {
@@ -582,9 +580,9 @@ main (int argc, char **argv)
   if (no_target_directory)
     {
       if (target_directory)
-        die (EXIT_FAILURE, 0,
-             _("cannot combine --target-directory "
-               "and --no-target-directory"));
+        error (EXIT_FAILURE, 0,
+               _("cannot combine --target-directory "
+                 "and --no-target-directory"));
       if (n_files != 2)
         {
           if (n_files < 2)
@@ -631,7 +629,7 @@ main (int argc, char **argv)
               target_directory = d;
             }
           else if (! (n_files == 2 && !target_directory))
-            die (EXIT_FAILURE, err, _("target %s"), quoteaf (d));
+            error (EXIT_FAILURE, err, _("target %s"), quoteaf (d));
         }
     }
 
index 13eeea8e0f400005b057f44e0b38bf43a8799a09..3e3d3f69664b46c021d8697f8f6f6d8fd11ded89 100644 (file)
@@ -43,7 +43,6 @@ noinst_HEADERS =              \
   src/chown-core.h             \
   src/copy.h                   \
   src/cp-hash.h                        \
-  src/die.h                    \
   src/dircolors.h              \
   src/expand-common.h          \
   src/find-mount-point.h       \
index 7682e5cf5cebfa57a016c179fb13b83826222f94..1d74ad99252532b1582655c31e84ba5aadfec674 100644 (file)
@@ -19,8 +19,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 
@@ -75,7 +73,7 @@ main (int argc, char **argv)
      using a fallback technique.  */
   cp = getlogin ();
   if (! cp)
-    die (EXIT_FAILURE, 0, _("no login name"));
+    error (EXIT_FAILURE, 0, _("no login name"));
 
   puts (cp);
   return EXIT_SUCCESS;
index de07940a8d8043c300c6894217faac5ab24ddca0..6299f817fed2159392b2f6f1403a9b4868567077 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -88,8 +88,6 @@
 #include "assure.h"
 #include "c-strcase.h"
 #include "dev-ino.h"
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "hard-locale.h"
 #include "hash.h"
@@ -2025,8 +2023,8 @@ decode_switches (int argc, char **argv)
         case 'w':
           width_opt = decode_line_length (optarg);
           if (width_opt < 0)
-            die (LS_FAILURE, 0, "%s: %s", _("invalid line width"),
-                 quote (optarg));
+            error (LS_FAILURE, 0, "%s: %s", _("invalid line width"),
+                   quote (optarg));
           break;
 
         case 'x':
@@ -2376,7 +2374,7 @@ decode_switches (int argc, char **argv)
   dired &= (format == long_format) & !print_hyperlink;
 
   if (eolbyte < dired)
-    die (LS_FAILURE, 0, _("--dired and --zero are incompatible"));
+    error (LS_FAILURE, 0, _("--dired and --zero are incompatible"));
 
   /* If -c or -u is specified and not -l (or any other option that implies -l),
      and no sort-type was specified, then sort by the ctime (-c) or atime (-u).
@@ -2417,8 +2415,8 @@ decode_switches (int argc, char **argv)
           else
             {
               if (strchr (p1 + 1, '\n'))
-                die (LS_FAILURE, 0, _("invalid time style format %s"),
-                     quote (p0));
+                error (LS_FAILURE, 0, _("invalid time style format %s"),
+                       quote (p0));
               *p1++ = '\0';
             }
           long_time_format[0] = p0;
index 4fd54af1dd592d4d73684bdf2ec415ed805685b7..7e6a911c89fb178496cdd649c3fbb06afaaeed67 100644 (file)
@@ -23,8 +23,6 @@
 #include <selinux/label.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "mkdir-p.h"
 #include "modechange.h"
 #include "prog-fprintf.h"
@@ -274,9 +272,9 @@ main (int argc, char **argv)
         ret = setfscreatecon (scontext);
 
       if (ret < 0)
-        die (EXIT_FAILURE, errno,
-             _("failed to set default file creation context to %s"),
-             quote (scontext));
+        error (EXIT_FAILURE, errno,
+               _("failed to set default file creation context to %s"),
+               quote (scontext));
     }
 
 
@@ -289,8 +287,8 @@ main (int argc, char **argv)
         {
           struct mode_change *change = mode_compile (specified_mode);
           if (!change)
-            die (EXIT_FAILURE, 0, _("invalid mode %s"),
-                 quote (specified_mode));
+            error (EXIT_FAILURE, 0, _("invalid mode %s"),
+                   quote (specified_mode));
           options.mode = mode_adjust (S_IRWXUGO, true, umask_value, change,
                                       &options.mode_bits);
           options.umask_self = umask_value & ~options.mode;
index ac4ae28efadace1282b8f52b48eb3ac5c07d9bf8..67b9fae93a9197177e393db396f977b507ad032e 100644 (file)
@@ -23,8 +23,6 @@
 #include <selinux/label.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "modechange.h"
 #include "quote.h"
 #include "selinux.h"
@@ -145,9 +143,9 @@ main (int argc, char **argv)
         ret = setfscreatecon (scontext);
 
       if (ret < 0)
-        die (EXIT_FAILURE, errno,
-             _("failed to set default file creation context to %s"),
-             quote (scontext));
+        error (EXIT_FAILURE, errno,
+               _("failed to set default file creation context to %s"),
+               quote (scontext));
     }
 
   newmode = MODE_RW_UGO;
@@ -156,14 +154,14 @@ main (int argc, char **argv)
       mode_t umask_value;
       struct mode_change *change = mode_compile (specified_mode);
       if (!change)
-        die (EXIT_FAILURE, 0, _("invalid mode"));
+        error (EXIT_FAILURE, 0, _("invalid mode"));
       umask_value = umask (0);
       umask (umask_value);
       newmode = mode_adjust (newmode, false, umask_value, change, nullptr);
       free (change);
       if (newmode & ~S_IRWXUGO)
-        die (EXIT_FAILURE, 0,
-             _("mode must specify only file permission bits"));
+        error (EXIT_FAILURE, 0,
+               _("mode must specify only file permission bits"));
     }
 
   for (; optind < argc; ++optind)
index c8cc61166b5615831763070f0f8b87939b24765b..576d1b060090cf9e3ecbc36d4f932a9f883295ff 100644 (file)
@@ -23,8 +23,6 @@
 #include <selinux/label.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "modechange.h"
 #include "quote.h"
 #include "selinux.h"
@@ -153,14 +151,14 @@ main (int argc, char **argv)
       mode_t umask_value;
       struct mode_change *change = mode_compile (specified_mode);
       if (!change)
-        die (EXIT_FAILURE, 0, _("invalid mode"));
+        error (EXIT_FAILURE, 0, _("invalid mode"));
       umask_value = umask (0);
       umask (umask_value);
       newmode = mode_adjust (newmode, false, umask_value, change, nullptr);
       free (change);
       if (newmode & ~S_IRWXUGO)
-        die (EXIT_FAILURE, 0,
-             _("mode must specify only file permission bits"));
+        error (EXIT_FAILURE, 0,
+               _("mode must specify only file permission bits"));
     }
 
   /* If the number of arguments is 0 or 1,
@@ -201,9 +199,9 @@ main (int argc, char **argv)
         ret = setfscreatecon (scontext);
 
       if (ret < 0)
-        die (EXIT_FAILURE, errno,
-             _("failed to set default file creation context to %s"),
-             quote (scontext));
+        error (EXIT_FAILURE, errno,
+               _("failed to set default file creation context to %s"),
+               quote (scontext));
     }
 
   /* Only check the first character, to allow mnemonic usage like
@@ -213,7 +211,7 @@ main (int argc, char **argv)
     {
     case 'b':                  /* 'block' or 'buffered' */
 #ifndef S_IFBLK
-      die (EXIT_FAILURE, 0, _("block special files not supported"));
+      error (EXIT_FAILURE, 0, _("block special files not supported"));
 #else
       node_type = S_IFBLK;
 #endif
@@ -222,7 +220,7 @@ main (int argc, char **argv)
     case 'c':                  /* 'character' */
     case 'u':                  /* 'unbuffered' */
 #ifndef S_IFCHR
-      die (EXIT_FAILURE, 0, _("character special files not supported"));
+      error (EXIT_FAILURE, 0, _("character special files not supported"));
 #else
       node_type = S_IFCHR;
 #endif
@@ -237,26 +235,26 @@ main (int argc, char **argv)
 
         if (xstrtoumax (s_major, nullptr, 0, &i_major, "") != LONGINT_OK
             || i_major != (major_t) i_major)
-          die (EXIT_FAILURE, 0,
-               _("invalid major device number %s"), quote (s_major));
+          error (EXIT_FAILURE, 0,
+                 _("invalid major device number %s"), quote (s_major));
 
         if (xstrtoumax (s_minor, nullptr, 0, &i_minor, "") != LONGINT_OK
             || i_minor != (minor_t) i_minor)
-          die (EXIT_FAILURE, 0,
-               _("invalid minor device number %s"), quote (s_minor));
+          error (EXIT_FAILURE, 0,
+                 _("invalid minor device number %s"), quote (s_minor));
 
         device = makedev (i_major, i_minor);
 #ifdef NODEV
         if (device == NODEV)
-          die (EXIT_FAILURE, 0, _("invalid device %s %s"),
-               s_major, s_minor);
+          error (EXIT_FAILURE, 0, _("invalid device %s %s"),
+                 s_major, s_minor);
 #endif
 
         if (set_security_context)
           defaultcon (set_security_context, argv[optind], node_type);
 
         if (mknod (argv[optind], newmode | node_type, device) != 0)
-          die (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
+          error (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
       }
       break;
 
@@ -264,7 +262,7 @@ main (int argc, char **argv)
       if (set_security_context)
         defaultcon (set_security_context, argv[optind], S_IFIFO);
       if (mkfifo (argv[optind], newmode) != 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
+        error (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
       break;
 
     default:
@@ -273,8 +271,8 @@ main (int argc, char **argv)
     }
 
   if (specified_mode && lchmod (argv[optind], newmode) != 0)
-    die (EXIT_FAILURE, errno, _("cannot set permissions of %s"),
-         quoteaf (argv[optind]));
+    error (EXIT_FAILURE, errno, _("cannot set permissions of %s"),
+           quoteaf (argv[optind]));
 
   return EXIT_SUCCESS;
 }
index 83900a2a1e4a48e6dbf1ed47152e68e158ee6184..3ce3cf3a83fae40b9e361c2b9a21f32b99dec242 100644 (file)
@@ -23,8 +23,6 @@
 #include "system.h"
 
 #include "close-stream.h"
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "quote.h"
 #include "tempname.h"
@@ -227,9 +225,9 @@ main (int argc, char **argv)
       size_t len = strlen (template);
       if (!len || template[len - 1] != 'X')
         {
-          die (EXIT_FAILURE, 0,
-               _("with --suffix, template %s must end in X"),
-               quote (template));
+          error (EXIT_FAILURE, 0,
+                 _("with --suffix, template %s must end in X"),
+                 quote (template));
         }
       suffix_len = strlen (suffix);
       dest_name = xcharalloc (len + suffix_len + 1);
@@ -252,13 +250,13 @@ main (int argc, char **argv)
   /* At this point, template is malloc'd, and suffix points into template.  */
   if (suffix_len && last_component (suffix) != suffix)
     {
-      die (EXIT_FAILURE, 0,
-           _("invalid suffix %s, contains directory separator"),
-           quote (suffix));
+      error (EXIT_FAILURE, 0,
+             _("invalid suffix %s, contains directory separator"),
+             quote (suffix));
     }
   x_count = count_consecutive_X_s (template, suffix - template);
   if (x_count < 3)
-    die (EXIT_FAILURE, 0, _("too few X's in template %s"), quote (template));
+    error (EXIT_FAILURE, 0, _("too few X's in template %s"), quote (template));
 
   if (use_dest_dir)
     {
@@ -273,9 +271,9 @@ main (int argc, char **argv)
             dest_dir = "/tmp";
 
           if (last_component (template) != template)
-            die (EXIT_FAILURE, 0,
-                 _("invalid template, %s, contains directory separator"),
-                 quote (template));
+            error (EXIT_FAILURE, 0,
+                   _("invalid template, %s, contains directory separator"),
+                   quote (template));
         }
       else
         {
@@ -287,10 +285,10 @@ main (int argc, char **argv)
               dest_dir = (env && *env ? env : "/tmp");
             }
           if (IS_ABSOLUTE_FILE_NAME (template))
-            die (EXIT_FAILURE, 0,
-                 _("invalid template, %s; with --tmpdir,"
-                   " it may not be absolute"),
-                 quote (template));
+            error (EXIT_FAILURE, 0,
+                   _("invalid template, %s; with --tmpdir,"
+                     " it may not be absolute"),
+                   quote (template));
         }
 
       dest_name = file_name_concat (dest_dir, template, nullptr);
index 79354fc271ad2d78033a941b34269d1a4cc1f4c2..2824227b39e2e353f48664f16fcde8bb0c6c5555 100644 (file)
--- a/src/mv.c
+++ b/src/mv.c
@@ -28,8 +28,6 @@
 #include "backupfile.h"
 #include "copy.h"
 #include "cp-hash.h"
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "remove.h"
 #include "renameatu.h"
@@ -110,8 +108,8 @@ rm_option_init (struct rm_options *x)
     static struct dev_ino dev_ino_buf;
     x->root_dev_ino = get_root_dev_ino (&dev_ino_buf);
     if (x->root_dev_ino == nullptr)
-      die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-           quoteaf ("/"));
+      error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+             quoteaf ("/"));
   }
 
   x->preserve_all_root = false;
@@ -368,7 +366,7 @@ main (int argc, char **argv)
           break;
         case 't':
           if (target_directory)
-            die (EXIT_FAILURE, 0, _("multiple target directories specified"));
+            error (EXIT_FAILURE, 0, _("multiple target directories specified"));
           target_directory = optarg;
           break;
         case 'T':
@@ -445,9 +443,9 @@ main (int argc, char **argv)
   if (no_target_directory)
     {
       if (target_directory)
-        die (EXIT_FAILURE, 0,
-             _("cannot combine --target-directory (-t) "
-               "and --no-target-directory (-T)"));
+        error (EXIT_FAILURE, 0,
+               _("cannot combine --target-directory (-t) "
+                 "and --no-target-directory (-T)"));
       if (2 < n_files)
         {
           error (0, 0, _("extra operand %s"), quoteaf (file[2]));
@@ -458,8 +456,8 @@ main (int argc, char **argv)
     {
       target_dirfd = target_directory_operand (target_directory, &sb);
       if (! target_dirfd_valid (target_dirfd))
-        die (EXIT_FAILURE, errno, _("target directory %s"),
-             quoteaf (target_directory));
+        error (EXIT_FAILURE, errno, _("target directory %s"),
+               quoteaf (target_directory));
     }
   else
     {
@@ -494,7 +492,7 @@ main (int argc, char **argv)
                   || (O_PATHSEARCH == O_SEARCH && err == EACCES
                       && (sb.st_mode != 0 || stat (lastfile, &sb) == 0)
                       && S_ISDIR (sb.st_mode)))
-                die (EXIT_FAILURE, err, _("target %s"), quoteaf (lastfile));
+                error (EXIT_FAILURE, err, _("target %s"), quoteaf (lastfile));
             }
         }
     }
index 2df28a41a69ff60f89905ed7a7e91ed77ac6141f..e573c24252fd370a530f01b1985d17535907337d 100644 (file)
@@ -29,8 +29,6 @@
 # include <sys/resource.h>
 #endif
 
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "xstrtol.h"
 
@@ -171,8 +169,8 @@ main (int argc, char **argv)
       enum { MIN_ADJUSTMENT = 1 - 2 * NZERO, MAX_ADJUSTMENT = 2 * NZERO - 1 };
       long int tmp;
       if (LONGINT_OVERFLOW < xstrtol (adjustment_given, nullptr, 10, &tmp, ""))
-        die (EXIT_CANCELED, 0, _("invalid adjustment %s"),
-             quote (adjustment_given));
+        error (EXIT_CANCELED, 0, _("invalid adjustment %s"),
+               quote (adjustment_given));
       adjustment = MAX (MIN_ADJUSTMENT, MIN (tmp, MAX_ADJUSTMENT));
     }
 
@@ -187,7 +185,7 @@ main (int argc, char **argv)
       errno = 0;
       current_niceness = GET_NICENESS ();
       if (current_niceness == -1 && errno != 0)
-        die (EXIT_CANCELED, errno, _("cannot get niceness"));
+        error (EXIT_CANCELED, errno, _("cannot get niceness"));
       printf ("%d\n", current_niceness);
       return EXIT_SUCCESS;
     }
@@ -198,7 +196,7 @@ main (int argc, char **argv)
 #else
   current_niceness = GET_NICENESS ();
   if (current_niceness == -1 && errno != 0)
-    die (EXIT_CANCELED, errno, _("cannot get niceness"));
+    error (EXIT_CANCELED, errno, _("cannot get niceness"));
   ok = (setpriority (PRIO_PROCESS, 0, current_niceness + adjustment) == 0);
 #endif
   if (!ok)
index 4cbad8e32abc0426c06da308abf73c9d586df0b7..3c5a90b564123ff95abf8035ee198f19039f0c78 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -27,8 +27,6 @@
 
 #include <regex.h>
 
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "linebuffer.h"
 #include "quote.h"
@@ -266,7 +264,7 @@ build_type_arg (char const **typep,
         RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES;
       errmsg = re_compile_pattern (optarg, strlen (optarg), regexp);
       if (errmsg)
-        die (EXIT_FAILURE, 0, "%s", (errmsg));
+        error (EXIT_FAILURE, 0, "%s", (errmsg));
       break;
     default:
       rval = false;
@@ -281,7 +279,7 @@ static void
 print_lineno (void)
 {
   if (line_no_overflow)
-    die (EXIT_FAILURE, 0, _("line number overflow"));
+    error (EXIT_FAILURE, 0, _("line number overflow"));
 
   printf (lineno_format, lineno_width, line_no, separator_str);
 
@@ -369,7 +367,7 @@ proc_text (void)
                          0, line_buf.length - 1, nullptr))
         {
         case -2:
-          die (EXIT_FAILURE, errno, _("error in regular expression search"));
+          error (EXIT_FAILURE, errno, _("error in regular expression search"));
 
         case -1:
           fputs (print_no_line_fmt, stdout);
@@ -615,7 +613,7 @@ main (int argc, char **argv)
       ok &= nl_file (argv[optind]);
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index c62828c5d03620714e3a809a3ff0001b571d2fcb..a6486c0b3aabd6133833ad98fca4e821dcf7ca9b 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "system.h"
 
-#include "error.h"
 #include "filenamecat.h"
 #include "fd-reopen.h"
 #include "long-options.h"
index 8aa687edbae927270fce20ec08c2f4b105d46471..4092baaeb4f9947e4f1747eb59d25afe8de0f6ed 100644 (file)
@@ -22,7 +22,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "error.h"
 #include "nproc.h"
 #include "quote.h"
 #include "xdectoint.h"
index cc386c531d96e4c81c4465b8d11155234b33e569..59ec280f44daf3902d5f7d9028bdda6b73b91b01 100644 (file)
@@ -24,8 +24,6 @@
 #include "mbsalign.h"
 #include "argmatch.h"
 #include "c-ctype.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "system.h"
 #include "xstrtol.h"
@@ -768,8 +766,8 @@ double_to_human (long double val, int precision,
 
       num_size = snprintf (buf, buf_size, fmt, precision, val);
       if (num_size < 0 || num_size >= (int) buf_size)
-        die (EXIT_FAILURE, 0,
-             _("failed to prepare value '%Lf' for printing"), val);
+        error (EXIT_FAILURE, 0,
+               _("failed to prepare value '%Lf' for printing"), val);
       return;
     }
 
@@ -820,8 +818,8 @@ double_to_human (long double val, int precision,
   num_size = snprintf (buf, buf_size - 1, fmt, prec, val,
                        suffix_power_char (power));
   if (num_size < 0 || num_size >= (int) buf_size - 1)
-    die (EXIT_FAILURE, 0,
-         _("failed to prepare value '%Lf' for printing"), val);
+    error (EXIT_FAILURE, 0,
+           _("failed to prepare value '%Lf' for printing"), val);
 
   if (scale == scale_IEC_I && power > 0)
     strncat (buf, "i", buf_size - num_size - 1);
@@ -870,7 +868,7 @@ unit_to_umax (char const *n_string)
   if (s_err != LONGINT_OK || *end || n == 0)
     {
       free (t_string);
-      die (EXIT_FAILURE, 0, _("invalid unit size: %s"), quote (n_string));
+      error (EXIT_FAILURE, 0, _("invalid unit size: %s"), quote (n_string));
     }
 
   free (t_string);
@@ -1070,8 +1068,8 @@ parse_format_string (char const *fmt)
   for (i = 0; !(fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
     {
       if (!fmt[i])
-        die (EXIT_FAILURE, 0,
-             _("format %s has no %% directive"), quote (fmt));
+        error (EXIT_FAILURE, 0,
+               _("format %s has no %% directive"), quote (fmt));
       prefix_len++;
     }
 
@@ -1097,8 +1095,8 @@ parse_format_string (char const *fmt)
   errno = 0;
   pad = strtol (fmt + i, &endptr, 10);
   if (errno == ERANGE || pad < -LONG_MAX)
-    die (EXIT_FAILURE, 0,
-         _("invalid format %s (width overflow)"), quote (fmt));
+    error (EXIT_FAILURE, 0,
+           _("invalid format %s (width overflow)"), quote (fmt));
 
   if (endptr != (fmt + i) && pad != 0)
     {
@@ -1122,7 +1120,7 @@ parse_format_string (char const *fmt)
   i = endptr - fmt;
 
   if (fmt[i] == '\0')
-    die (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
+    error (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
 
   if (fmt[i] == '.')
     {
@@ -1137,23 +1135,23 @@ parse_format_string (char const *fmt)
              negative precision is only supported (and ignored)
              when used with '.*f'.  glibc at least will malform
              output when passed a direct negative precision.  */
-          die (EXIT_FAILURE, 0,
-               _("invalid precision in format %s"), quote (fmt));
+          error (EXIT_FAILURE, 0,
+                 _("invalid precision in format %s"), quote (fmt));
         }
       i = endptr - fmt;
     }
 
   if (fmt[i] != 'f')
-    die (EXIT_FAILURE, 0, _("invalid format %s,"
-                            " directive must be %%[0]['][-][N][.][N]f"),
+    error (EXIT_FAILURE, 0, _("invalid format %s,"
+                              " directive must be %%[0]['][-][N][.][N]f"),
          quote (fmt));
   i++;
   suffix_pos = i;
 
   for (; fmt[i] != '\0'; i += (fmt[i] == '%') + 1)
     if (fmt[i] == '%' && fmt[i + 1] != '%')
-      die (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
-           quote (fmt));
+      error (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
+             quote (fmt));
 
   if (prefix_len)
     format_str_prefix = ximemdup0 (fmt, prefix_len);
@@ -1513,8 +1511,8 @@ main (int argc, char **argv)
         case PADDING_OPTION:
           if (xstrtol (optarg, nullptr, 10, &padding_width, "") != LONGINT_OK
               || padding_width == 0 || padding_width < -LONG_MAX)
-            die (EXIT_FAILURE, 0, _("invalid padding value %s"),
-                 quote (optarg));
+            error (EXIT_FAILURE, 0, _("invalid padding value %s"),
+                   quote (optarg));
           if (padding_width < 0)
             {
               padding_alignment = MBS_ALIGN_LEFT;
@@ -1526,15 +1524,15 @@ main (int argc, char **argv)
 
         case FIELD_OPTION:
           if (n_frp)
-            die (EXIT_FAILURE, 0, _("multiple field specifications"));
+            error (EXIT_FAILURE, 0, _("multiple field specifications"));
           set_fields (optarg, SETFLD_ALLOW_DASH);
           break;
 
         case 'd':
           /* Interpret -d '' to mean 'use the NUL byte as the delimiter.'  */
           if (optarg[0] != '\0' && optarg[1] != '\0')
-            die (EXIT_FAILURE, 0,
-                 _("the delimiter must be a single character"));
+            error (EXIT_FAILURE, 0,
+                   _("the delimiter must be a single character"));
           delimiter = optarg[0];
           break;
 
@@ -1560,8 +1558,8 @@ main (int argc, char **argv)
             {
               if (xstrtoumax (optarg, nullptr, 10, &header, "") != LONGINT_OK
                   || header == 0)
-                die (EXIT_FAILURE, 0, _("invalid header value %s"),
-                     quote (optarg));
+                error (EXIT_FAILURE, 0, _("invalid header value %s"),
+                       quote (optarg));
             }
           else
             {
@@ -1587,7 +1585,7 @@ main (int argc, char **argv)
     }
 
   if (format_str != nullptr && grouping)
-    die (EXIT_FAILURE, 0, _("--grouping cannot be combined with --format"));
+    error (EXIT_FAILURE, 0, _("--grouping cannot be combined with --format"));
 
   if (debug && ! locale_ok)
     error (0, 0, _("failed to set locale"));
@@ -1603,7 +1601,7 @@ main (int argc, char **argv)
   if (grouping)
     {
       if (scale_to != scale_none)
-        die (EXIT_FAILURE, 0, _("grouping cannot be combined with --to"));
+        error (EXIT_FAILURE, 0, _("grouping cannot be combined with --to"));
       if (debug && (strlen (nl_langinfo (THOUSEP)) == 0))
         error (0, 0, _("grouping has no effect in this locale"));
     }
@@ -1643,7 +1641,7 @@ main (int argc, char **argv)
         }
 
       if (ferror (stdin))
-        die (EXIT_FAILURE, errno, _("error reading input"));
+        error (EXIT_FAILURE, errno, _("error reading input"));
     }
 
   if (debug && !valid_numbers)
index 8f84659240aca9d2889a06704b178950d2e28c14..6b66ceb4fb63d2a4515e125612984f1231e41f9b 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -24,8 +24,6 @@
 #include "system.h"
 #include "argmatch.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "ftoastr.h"
 #include "quote.h"
 #include "stat-size.h"
@@ -1101,7 +1099,7 @@ skip (uintmax_t n_skip)
     }
 
   if (n_skip != 0)
-    die (EXIT_FAILURE, 0, _("cannot skip past end of combined input"));
+    error (EXIT_FAILURE, 0, _("cannot skip past end of combined input"));
 
   return ok;
 }
@@ -1651,10 +1649,10 @@ main (int argc, char **argv)
               address_pad_len = 0;
               break;
             default:
-              die (EXIT_FAILURE, 0,
-                   _("invalid output address radix '%c';\
- it must be one character from [doxn]"),
-                   optarg[0]);
+              error (EXIT_FAILURE, 0,
+                     _("invalid output address radix '%c';"
                      " it must be one character from [doxn]"),
+                     optarg[0]);
               break;
             }
           break;
@@ -1690,7 +1688,7 @@ main (int argc, char **argv)
               /* The minimum string length may be no larger than SIZE_MAX,
                  since we may allocate a buffer of this size.  */
               if (SIZE_MAX < tmp)
-                die (EXIT_FAILURE, 0, _("%s is too large"), quote (optarg));
+                error (EXIT_FAILURE, 0, _("%s is too large"), quote (optarg));
 
               string_min = tmp;
             }
@@ -1771,7 +1769,7 @@ main (int argc, char **argv)
               if (s_err != LONGINT_OK)
                 xstrtol_fatal (s_err, oi, c, long_options, optarg);
               if (SIZE_MAX < w_tmp)
-                die (EXIT_FAILURE, 0, _("%s is too large"), quote (optarg));
+                error (EXIT_FAILURE, 0, _("%s is too large"), quote (optarg));
               desired_width = w_tmp;
             }
           break;
@@ -1790,8 +1788,8 @@ main (int argc, char **argv)
     return EXIT_FAILURE;
 
   if (flag_dump_strings && n_specs > 0)
-    die (EXIT_FAILURE, 0,
-         _("no type may be specified when dumping strings"));
+    error (EXIT_FAILURE, 0,
+           _("no type may be specified when dumping strings"));
 
   n_files = argc - optind;
 
@@ -1887,7 +1885,7 @@ main (int argc, char **argv)
     {
       end_offset = n_bytes_to_skip + max_bytes_to_format;
       if (end_offset < n_bytes_to_skip)
-        die (EXIT_FAILURE, 0, _("skip-bytes + read-bytes is too large"));
+        error (EXIT_FAILURE, 0, _("skip-bytes + read-bytes is too large"));
     }
 
   if (n_specs == 0)
@@ -1977,7 +1975,7 @@ main (int argc, char **argv)
 cleanup:
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index bbcb0f579a6a2a2469a492712c25f9736a4d3190..71341d9e570fb4df007422bd1ee888b6c04ff49a 100644 (file)
@@ -27,7 +27,6 @@
 #include <sys/wait.h>
 
 #include "system.h"
-#include "error.h"
 #include "quote.h"
 #include "sig2str.h"
 #include "operand2sig.h"
index 27b6a416e16dae4a8d75d01ac55db7dcce1b7c26..73ddd1de6310c3f2a9e14095abcad3ee3da86b11 100644 (file)
@@ -41,8 +41,6 @@
 #include <getopt.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
@@ -159,7 +157,7 @@ collapse_escapes (char const *strptr)
 static void
 write_error (void)
 {
-  die (EXIT_FAILURE, errno, _("write error"));
+  error (EXIT_FAILURE, errno, _("write error"));
 }
 
 /* Output a single byte, reporting any write errors.  */
@@ -210,7 +208,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
         {
           fileptr[files_open] = fopen (fnamptr[files_open], "r");
           if (fileptr[files_open] == nullptr)
-            die (EXIT_FAILURE, errno, "%s", quotef (fnamptr[files_open]));
+            error (EXIT_FAILURE, errno, "%s", quotef (fnamptr[files_open]));
           else if (fileno (fileptr[files_open]) == STDIN_FILENO)
             opened_stdin = true;
           fadvise (fileptr[files_open], FADVISE_SEQUENTIAL);
@@ -218,7 +216,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
     }
 
   if (opened_stdin && have_read_stdin)
-    die (EXIT_FAILURE, 0, _("standard input is closed"));
+    error (EXIT_FAILURE, 0, _("standard input is closed"));
 
   /* Read a line from each file and output it to stdout separated by a
      delimiter, until we go through the loop without successfully
@@ -511,9 +509,9 @@ main (int argc, char **argv)
     {
       /* Don't use the quote() quoting style, because that would double the
          number of displayed backslashes, making the diagnostic look bogus.  */
-      die (EXIT_FAILURE, 0,
-           _("delimiter list ends with an unescaped backslash: %s"),
-           quotearg_n_style_colon (0, c_maybe_quoting_style, delim_arg));
+      error (EXIT_FAILURE, 0,
+             _("delimiter list ends with an unescaped backslash: %s"),
+             quotearg_n_style_colon (0, c_maybe_quoting_style, delim_arg));
     }
 
   bool ok = ((serial_merge ? paste_serial : paste_parallel)
@@ -522,6 +520,6 @@ main (int argc, char **argv)
   free (delims);
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index f4d395cf62a39677e44fcb53be1127987f4ee37a..11c2b2cca98e85bdcd6d544657e516855e4b8b58 100644 (file)
@@ -21,7 +21,6 @@
 #include <wchar.h>
 
 #include "system.h"
-#include "error.h"
 #include "quote.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
index 578eb87c07ade31178ad3f0cd5424f0ee9322d23..e3e19968868f8e1d44b7cd5314a887b082a7b218 100644 (file)
@@ -25,8 +25,6 @@
 #include "system.h"
 
 #include "canon-host.h"
-#include "die.h"
-#include "error.h"
 #include "hard-locale.h"
 #include "readutmp.h"
 
@@ -466,7 +464,7 @@ short_pinky (char const *filename,
   STRUCT_UTMP *utmp_buf = nullptr;
 
   if (read_utmp (filename, &n_users, &utmp_buf, 0) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (filename));
+    error (EXIT_FAILURE, errno, "%s", quotef (filename));
 
   scan_entries (n_users, utmp_buf, argc_names, argv_names);
   exit (EXIT_SUCCESS);
index b927ca7e430eea80a651542b8fc371fbd4a81fb0..92072aba169bb58b9c340c8533ba282ed735f4ae 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
 #include <getopt.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "hard-locale.h"
 #include "mbswidth.h"
@@ -775,7 +773,7 @@ static struct option const long_options[] =
 static _Noreturn void
 integer_overflow (void)
 {
-  die (EXIT_FAILURE, 0, _("integer overflow"));
+  error (EXIT_FAILURE, 0, _("integer overflow"));
 }
 
 /* Return the number of columns that have either an open file or
@@ -914,11 +912,11 @@ main (int argc, char **argv)
         case PAGES_OPTION:     /* --pages=FIRST_PAGE[:LAST_PAGE] */
           {                    /* dominates old opt +... */
             if (! optarg)
-              die (EXIT_FAILURE, 0,
-                   _("'--pages=FIRST_PAGE[:LAST_PAGE]' missing argument"));
+              error (EXIT_FAILURE, 0,
+                     _("'--pages=FIRST_PAGE[:LAST_PAGE]' missing argument"));
             else if (! first_last_page (oi, 0, optarg))
-              die (EXIT_FAILURE, 0, _("invalid page range %s"),
-                   quote (optarg));
+              error (EXIT_FAILURE, 0, _("invalid page range %s"),
+                     quote (optarg));
             break;
           }
 
@@ -1070,12 +1068,12 @@ main (int argc, char **argv)
     first_page_number = 1;
 
   if (parallel_files && explicit_columns)
-    die (EXIT_FAILURE, 0,
-         _("cannot specify number of columns when printing in parallel"));
+    error (EXIT_FAILURE, 0,
+           _("cannot specify number of columns when printing in parallel"));
 
   if (parallel_files && print_across_flag)
-    die (EXIT_FAILURE, 0,
-       _("cannot specify both printing across and printing in parallel"));
+    error (EXIT_FAILURE, 0,
+           _("cannot specify both printing across and printing in parallel"));
 
 /* Translate some old short options to new/long options.
    To meet downward compatibility with other UNIX pr utilities
@@ -1146,7 +1144,7 @@ main (int argc, char **argv)
   cleanup ();
 
   if (have_read_stdin && fclose (stdin) == EOF)
-    die (EXIT_FAILURE, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
   main_exit (failed_opens ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
@@ -1294,7 +1292,7 @@ init_parameters (int number_of_files)
   chars_per_column = useful_chars / columns;
 
   if (chars_per_column < 1)
-    die (EXIT_FAILURE, 0, _("page width too narrow"));
+    error (EXIT_FAILURE, 0, _("page width too narrow"));
 
   if (numbered_lines)
     {
@@ -1528,7 +1526,7 @@ close_file (COLUMN *p)
   else if (fclose (p->fp) != 0 && !err)
     err = errno;
   if (err)
-    die (EXIT_FAILURE, err, "%s", quotef (p->name));
+    error (EXIT_FAILURE, err, "%s", quotef (p->name));
 
   if (!parallel_files)
     {
@@ -2383,7 +2381,7 @@ print_header (void)
   print_white_space ();
 
   if (page_number == 0)
-    die (EXIT_FAILURE, 0, _("page number overflow"));
+    error (EXIT_FAILURE, 0, _("page number overflow"));
 
   /* The translator must ensure that formatting the translation of
      "Page %"PRIuMAX does not generate more than (sizeof page_text - 1)
index 1c8a01bc45d2f36280b79e1e6eafbdba9552352b..063f077360e2e2b395675d9313457d114754810d 100644 (file)
@@ -57,8 +57,6 @@
 
 #include "system.h"
 #include "cl-strtod.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "unicodeio.h"
 #include "xprintf.h"
@@ -267,7 +265,7 @@ print_esc (char const *escstart, bool octal_0)
            ++esc_length, ++p)
         esc_value = esc_value * 16 + hextobin (*p);
       if (esc_length == 0)
-        die (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
+        error (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
       putchar (esc_value);
     }
   else if (isodigit (*p))
@@ -294,15 +292,15 @@ print_esc (char const *escstart, bool octal_0)
            --esc_length, ++p)
         {
           if (! isxdigit (to_uchar (*p)))
-            die (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
+            error (EXIT_FAILURE, 0, _("missing hexadecimal number in escape"));
           uni_value = uni_value * 16 + hextobin (*p);
         }
 
       /* Error for invalid code points 0000D800 through 0000DFFF inclusive.
          Note print_unicode_char() would print the literal \u.. in this case. */
       if (uni_value >= 0xd800 && uni_value <= 0xdfff)
-        die (EXIT_FAILURE, 0, _("invalid universal character name \\%c%0*x"),
-             esc_char, (esc_char == 'u' ? 4 : 8), uni_value);
+        error (EXIT_FAILURE, 0, _("invalid universal character name \\%c%0*x"),
+               esc_char, (esc_char == 'u' ? 4 : 8), uni_value);
 
       print_unicode_char (stdout, uni_value, 0);
     }
@@ -574,8 +572,8 @@ print_formatted (char const *format, int argc, char **argv)
                   if (INT_MIN <= width && width <= INT_MAX)
                     field_width = width;
                   else
-                    die (EXIT_FAILURE, 0, _("invalid field width: %s"),
-                         quote (*argv));
+                    error (EXIT_FAILURE, 0, _("invalid field width: %s"),
+                           quote (*argv));
                   ++argv;
                   --argc;
                 }
@@ -609,8 +607,8 @@ print_formatted (char const *format, int argc, char **argv)
                           precision = -1;
                         }
                       else if (INT_MAX < prec)
-                        die (EXIT_FAILURE, 0, _("invalid precision: %s"),
-                             quote (*argv));
+                        error (EXIT_FAILURE, 0, _("invalid precision: %s"),
+                               quote (*argv));
                       else
                         precision = prec;
                       ++argv;
@@ -634,10 +632,11 @@ print_formatted (char const *format, int argc, char **argv)
 
           {
             unsigned char conversion = *f;
+            int speclen = MIN (f + 1 - direc_start, INT_MAX);
             if (! ok[conversion])
-              die (EXIT_FAILURE, 0,
-                   _("%.*s: invalid conversion specification"),
-                   (int) (f + 1 - direc_start), direc_start);
+              error (EXIT_FAILURE, 0,
+                     _("%.*s: invalid conversion specification"),
+                     speclen, direc_start);
           }
 
           print_direc (direc_start, direc_length, *f,
index c4712e0c68a11cb1c3992d87f43bac3c48b6a07c..3c24f7321db5671b1d15400bf277a23434a355c8 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
 #include <getopt.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
 #include <regex.h>
 #include "argmatch.h"
-#include "error.h"
 #include "fadvise.h"
 #include "quote.h"
 #include "read-file.h"
@@ -286,7 +284,7 @@ static BLOCK reference;             /* reference field for input reference mode */
 static void
 matcher_error (void)
 {
-  die (EXIT_FAILURE, errno, _("error in regular expression matcher"));
+  error (EXIT_FAILURE, errno, _("error in regular expression matcher"));
 }
 
 /* Unescape STRING in-place.  */
@@ -414,7 +412,7 @@ compile_regex (struct regex_data *regex)
 
   message = re_compile_pattern (string, strlen (string), pattern);
   if (message)
-    die (EXIT_FAILURE, 0, _("%s (for regexp %s)"), message, quote (string));
+    error (EXIT_FAILURE, 0, _("%s (for regexp %s)"), message, quote (string));
 
   /* The fastmap should be compiled before 're_match'.  The following
      call is not mandatory, because 're_search' is always called sooner,
@@ -518,7 +516,7 @@ swallow_file_in_memory (char const *file_name, BLOCK *block)
     block->start = read_file (file_name, 0, &used_length);
 
   if (!block->start)
-    die (EXIT_FAILURE, errno, "%s", quotef (using_stdin ? "-" : file_name));
+    error (EXIT_FAILURE, errno, "%s", quotef (using_stdin ? "-" : file_name));
 
   if (using_stdin)
     clearerr (stdin);
@@ -816,9 +814,10 @@ find_occurs_in_text (int file_index)
             break;
 
           case 0:
-            die (EXIT_FAILURE, 0,
-                 _("error: regular expression has a match of length zero: %s"),
-                 quote (context_regex.string));
+            error (EXIT_FAILURE, 0,
+                   _("error: regular expression has a match of length zero:"
+                     " %s"),
+                   quote (context_regex.string));
 
           default:
             next_context_start = cursor + context_regs.end[0];
@@ -1836,8 +1835,8 @@ main (int argc, char **argv)
             intmax_t tmp;
             if (! (xstrtoimax (optarg, nullptr, 0, &tmp, "") == LONGINT_OK
                    && 0 < tmp && tmp <= PTRDIFF_MAX))
-              die (EXIT_FAILURE, 0, _("invalid gap width: %s"),
-                   quote (optarg));
+              error (EXIT_FAILURE, 0, _("invalid gap width: %s"),
+                     quote (optarg));
             gap_size = tmp;
             break;
           }
@@ -1863,8 +1862,8 @@ main (int argc, char **argv)
             intmax_t tmp;
             if (! (xstrtoimax (optarg, nullptr, 0, &tmp, "") == LONGINT_OK
                    && 0 < tmp && tmp <= PTRDIFF_MAX))
-              die (EXIT_FAILURE, 0, _("invalid line width: %s"),
-                   quote (optarg));
+              error (EXIT_FAILURE, 0, _("invalid line width: %s"),
+                     quote (optarg));
             line_width = tmp;
             break;
           }
@@ -1968,7 +1967,7 @@ main (int argc, char **argv)
       if (optind < argc)
         {
           if (! freopen (argv[optind], "w", stdout))
-            die (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
+            error (EXIT_FAILURE, errno, "%s", quotef (argv[optind]));
           optind++;
         }
 
index dc49225a31106fab15fd995eb1ed43b52292f0ee..7b2e7c73a35f99dbf76b87f553bf4196b54aac5a 100644 (file)
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -20,8 +20,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "root-dev-ino.h"
 #include "xgetcwd.h"
@@ -161,17 +159,17 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
 
   dirp = opendir ("..");
   if (dirp == nullptr)
-    die (EXIT_FAILURE, errno, _("cannot open directory %s"),
-         quote (nth_parent (parent_height)));
+    error (EXIT_FAILURE, errno, _("cannot open directory %s"),
+           quote (nth_parent (parent_height)));
 
   fd = dirfd (dirp);
   if ((0 <= fd ? fchdir (fd) : chdir ("..")) < 0)
-    die (EXIT_FAILURE, errno, _("failed to chdir to %s"),
-         quote (nth_parent (parent_height)));
+    error (EXIT_FAILURE, errno, _("failed to chdir to %s"),
+           quote (nth_parent (parent_height)));
 
   if ((0 <= fd ? fstat (fd, &parent_sb) : stat (".", &parent_sb)) < 0)
-    die (EXIT_FAILURE, errno, _("failed to stat %s"),
-         quote (nth_parent (parent_height)));
+    error (EXIT_FAILURE, errno, _("failed to stat %s"),
+           quote (nth_parent (parent_height)));
 
   /* If parent and child directory are on different devices, then we
      can't rely on d_ino for useful i-node numbers; use lstat instead.  */
@@ -229,14 +227,14 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
     {
       /* Note that this diagnostic serves for both readdir
          and closedir failures.  */
-      die (EXIT_FAILURE, errno, _("reading directory %s"),
-           quote (nth_parent (parent_height)));
+      error (EXIT_FAILURE, errno, _("reading directory %s"),
+             quote (nth_parent (parent_height)));
     }
 
   if ( ! found)
-    die (EXIT_FAILURE, 0,
-         _("couldn't find directory entry in %s with matching i-node"),
-         quote (nth_parent (parent_height)));
+    error (EXIT_FAILURE, 0,
+           _("couldn't find directory entry in %s with matching i-node"),
+           quote (nth_parent (parent_height)));
 
   *dot_sb = parent_sb;
 }
@@ -273,11 +271,11 @@ robust_getcwd (struct file_name *file_name)
   struct stat dot_sb;
 
   if (root_dev_ino == nullptr)
-    die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-         quoteaf ("/"));
+    error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+           quoteaf ("/"));
 
   if (stat (".", &dot_sb) < 0)
-    die (EXIT_FAILURE, errno, _("failed to stat %s"), quoteaf ("."));
+    error (EXIT_FAILURE, errno, _("failed to stat %s"), quoteaf ("."));
 
   while (true)
     {
index 7c8f1cfd3d5e5f26fef8b56340a90c02d624d072..aa339911424011e350279302f5a8b5cc58463b83 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "system.h"
 #include "canonicalize.h"
-#include "error.h"
 #include "areadlink.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
index bea08d2872bfaea27cc7ad114ba2f66adc9e7b4a..c4ca5f0686015cd88a8e3d57f3db94463fd73ec2 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "canonicalize.h"
-#include "die.h"
-#include "error.h"
 #include "relpath.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
@@ -143,7 +141,7 @@ isdir (char const *path)
 {
   struct stat sb;
   if (stat (path, &sb) != 0)
-    die (EXIT_FAILURE, errno, _("cannot stat %s"), quoteaf (path));
+    error (EXIT_FAILURE, errno, _("cannot stat %s"), quoteaf (path));
   return S_ISDIR (sb.st_mode);
 }
 
@@ -246,9 +244,9 @@ main (int argc, char **argv)
     {
       can_relative_to = realpath_canon (relative_to, can_mode);
       if (!can_relative_to)
-        die (EXIT_FAILURE, errno, "%s", quotef (relative_to));
+        error (EXIT_FAILURE, errno, "%s", quotef (relative_to));
       if (need_dir && !isdir (can_relative_to))
-        die (EXIT_FAILURE, ENOTDIR, "%s", quotef (relative_to));
+        error (EXIT_FAILURE, ENOTDIR, "%s", quotef (relative_to));
     }
   if (relative_base == relative_to)
     can_relative_base = can_relative_to;
@@ -256,9 +254,9 @@ main (int argc, char **argv)
     {
       char *base = realpath_canon (relative_base, can_mode);
       if (!base)
-        die (EXIT_FAILURE, errno, "%s", quotef (relative_base));
+        error (EXIT_FAILURE, errno, "%s", quotef (relative_base));
       if (need_dir && !isdir (base))
-        die (EXIT_FAILURE, ENOTDIR, "%s", quotef (relative_base));
+        error (EXIT_FAILURE, ENOTDIR, "%s", quotef (relative_base));
       /* --relative-to is a no-op if it does not have --relative-base
            as a prefix */
       if (path_prefix (base, can_relative_to))
index b8ea20d42cdeac36e747606e4a700ea497829566..2edbb4be8059fe17e34bf4a42c763ad98f380191 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <config.h>
 
-#include "error.h"
 #include "system.h"
 #include "relpath.h"
 
index 1cc4230d19c9fb427e9d931887def602223d459b..d569e8b0a92469c0984c5c5f63301fbe874750b8 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "system.h"
 #include "assure.h"
-#include "error.h"
 #include "file-type.h"
 #include "filenamecat.h"
 #include "ignore-value.h"
index 2ad1fa8fb276dd9e92b6f2b2f060baaa7b9e259d..ecd7699c31f70b81f8e8d30a67b2b70a4a8ddf8f 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -26,8 +26,6 @@
 #include "system.h"
 #include "argmatch.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "remove.h"
 #include "root-dev-ino.h"
 #include "yesno.h"
@@ -293,8 +291,8 @@ main (int argc, char **argv)
 
         case NO_PRESERVE_ROOT:
           if (! STREQ (argv[optind - 1], "--no-preserve-root"))
-            die (EXIT_FAILURE, 0,
-                 _("you may not abbreviate the --no-preserve-root option"));
+            error (EXIT_FAILURE, 0,
+                   _("you may not abbreviate the --no-preserve-root option"));
           preserve_root = false;
           break;
 
@@ -304,11 +302,9 @@ main (int argc, char **argv)
               if STREQ (optarg, "all")
                 x.preserve_all_root = true;
               else
-                {
-                  die (EXIT_FAILURE, 0,
+                error (EXIT_FAILURE, 0,
                        _("unrecognized --preserve-root argument: %s"),
                        quoteaf (optarg));
-                }
             }
           preserve_root = true;
           break;
@@ -345,8 +341,8 @@ main (int argc, char **argv)
       static struct dev_ino dev_ino_buf;
       x.root_dev_ino = get_root_dev_ino (&dev_ino_buf);
       if (x.root_dev_ino == nullptr)
-        die (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
-             quoteaf ("/"));
+        error (EXIT_FAILURE, errno, _("failed to get attributes of %s"),
+               quoteaf ("/"));
     }
 
   uintmax_t n_files = argc - optind;
index c24676ad776e2dac8855e1084ac1408aa0084a52..1a95869d0cba6b433c89a8a25198edcc618ed7d3 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "error.h"
 #include "prog-fprintf.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
index a0c04059e5a552e425479debb205b95a25dca1bd..0487451539a0f6be5fda9df3df1deb206dadd226 100644 (file)
@@ -47,8 +47,6 @@
 #include <selinux/context.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
@@ -137,22 +135,22 @@ main (int argc, char **argv)
         {
         case 'r':
           if (role)
-            die (EXIT_CANCELED, 0, _("multiple roles"));
+            error (EXIT_CANCELED, 0, _("multiple roles"));
           role = optarg;
           break;
         case 't':
           if (type)
-            die (EXIT_CANCELED, 0, _("multiple types"));
+            error (EXIT_CANCELED, 0, _("multiple types"));
           type = optarg;
           break;
         case 'u':
           if (user)
-            die (EXIT_CANCELED, 0, _("multiple users"));
+            error (EXIT_CANCELED, 0, _("multiple users"));
           user = optarg;
           break;
         case 'l':
           if (range)
-            die (EXIT_CANCELED, 0, _("multiple levelranges"));
+            error (EXIT_CANCELED, 0, _("multiple levelranges"));
           range = optarg;
           break;
         case 'c':
@@ -170,7 +168,7 @@ main (int argc, char **argv)
   if (argc - optind == 0)
     {
       if (getcon (&cur_context) < 0)
-        die (EXIT_CANCELED, errno, _("failed to get current context"));
+        error (EXIT_CANCELED, errno, _("failed to get current context"));
       fputs (cur_context, stdout);
       fputc ('\n', stdout);
       return EXIT_SUCCESS;
@@ -193,34 +191,34 @@ main (int argc, char **argv)
     }
 
   if (is_selinux_enabled () != 1)
-    die (EXIT_CANCELED, 0, _("%s may be used only on a SELinux kernel"),
-         program_name);
+    error (EXIT_CANCELED, 0, _("%s may be used only on a SELinux kernel"),
+           program_name);
 
   if (context)
     {
       con = context_new (context);
       if (!con)
-        die (EXIT_CANCELED, errno, _("failed to create security context: %s"),
-             quote (context));
+        error (EXIT_CANCELED, errno, _("failed to create security context: %s"),
+               quote (context));
     }
   else
     {
       if (getcon (&cur_context) < 0)
-        die (EXIT_CANCELED, errno, _("failed to get current context"));
+        error (EXIT_CANCELED, errno, _("failed to get current context"));
 
       /* We will generate context based on process transition */
       if (compute_trans)
         {
           /* Get context of file to be executed */
           if (getfilecon (argv[optind], &file_context) == -1)
-            die (EXIT_CANCELED, errno,
-                 _("failed to get security context of %s"),
-                 quoteaf (argv[optind]));
+            error (EXIT_CANCELED, errno,
+                   _("failed to get security context of %s"),
+                   quoteaf (argv[optind]));
           /* compute result of process transition */
           if (security_compute_create (cur_context, file_context,
                                        string_to_security_class ("process"),
                                        &new_context) != 0)
-            die (EXIT_CANCELED, errno, _("failed to compute a new context"));
+            error (EXIT_CANCELED, errno, _("failed to compute a new context"));
           /* free contexts */
           freecon (file_context);
           freecon (cur_context);
@@ -231,29 +229,29 @@ main (int argc, char **argv)
 
       con = context_new (cur_context);
       if (!con)
-        die (EXIT_CANCELED, errno, _("failed to create security context: %s"),
-             quote (cur_context));
+        error (EXIT_CANCELED, errno, _("failed to create security context: %s"),
+               quote (cur_context));
       if (user && context_user_set (con, user))
-        die (EXIT_CANCELED, errno, _("failed to set new user: %s"),
-             quote (user));
+        error (EXIT_CANCELED, errno, _("failed to set new user: %s"),
+               quote (user));
       if (type && context_type_set (con, type))
-        die (EXIT_CANCELED, errno, _("failed to set new type: %s"),
-             quote (type));
+        error (EXIT_CANCELED, errno, _("failed to set new type: %s"),
+               quote (type));
       if (range && context_range_set (con, range))
-        die (EXIT_CANCELED, errno, _("failed to set new range: %s"),
-             quote (range));
+        error (EXIT_CANCELED, errno, _("failed to set new range: %s"),
+               quote (range));
       if (role && context_role_set (con, role))
-        die (EXIT_CANCELED, errno, _("failed to set new role: %s"),
-             quote (role));
+        error (EXIT_CANCELED, errno, _("failed to set new role: %s"),
+               quote (role));
     }
 
   if (security_check_context (context_str (con)) < 0)
-    die (EXIT_CANCELED, errno, _("invalid context: %s"),
-         quote (context_str (con)));
+    error (EXIT_CANCELED, errno, _("invalid context: %s"),
+           quote (context_str (con)));
 
   if (setexeccon (context_str (con)) != 0)
-    die (EXIT_CANCELED, errno, _("unable to set security context %s"),
-         quote (context_str (con)));
+    error (EXIT_CANCELED, errno, _("unable to set security context %s"),
+           quote (context_str (con)));
   if (cur_context != nullptr)
     freecon (cur_context);
 
index ee5220a9b8b491babbaaf7fe0a8902c73e656f65..633189c405be8f5fb323b71bd16e5fe7351dc25c 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -22,9 +22,7 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
 #include "cl-strtod.h"
-#include "error.h"
 #include "quote.h"
 #include "xstrtod.h"
 
@@ -244,8 +242,8 @@ long_double_format (char const *fmt, struct layout *layout)
   for (i = 0; ! (fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1)
     {
       if (!fmt[i])
-        die (EXIT_FAILURE, 0,
-             _("format %s has no %% directive"), quote (fmt));
+        error (EXIT_FAILURE, 0,
+               _("format %s has no %% directive"), quote (fmt));
       prefix_len++;
     }
 
@@ -262,15 +260,15 @@ long_double_format (char const *fmt, struct layout *layout)
   has_L = (fmt[i] == 'L');
   i += has_L;
   if (fmt[i] == '\0')
-    die (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
+    error (EXIT_FAILURE, 0, _("format %s ends in %%"), quote (fmt));
   if (! strchr ("efgaEFGA", fmt[i]))
-    die (EXIT_FAILURE, 0,
-         _("format %s has unknown %%%c directive"), quote (fmt), fmt[i]);
+    error (EXIT_FAILURE, 0,
+           _("format %s has unknown %%%c directive"), quote (fmt), fmt[i]);
 
   for (i++; ; i += (fmt[i] == '%') + 1)
     if (fmt[i] == '%' && fmt[i + 1] != '%')
-      die (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
-           quote (fmt));
+      error (EXIT_FAILURE, 0, _("format %s has too many %% directives"),
+             quote (fmt));
     else if (fmt[i])
       suffix_len++;
     else
@@ -292,7 +290,7 @@ io_error (void)
 {
   /* FIXME: consider option to silently ignore errno=EPIPE */
   clearerr (stdout);
-  die (EXIT_FAILURE, errno, _("write error"));
+  error (EXIT_FAILURE, errno, _("write error"));
 }
 
 /* Actually print the sequence of numbers in the specified range, with the
index 0f4f61ec367f45082654698d898724edf84429bb..b299280c0fea48bac1626b05bd3d5faa89c97075 100644 (file)
@@ -19,7 +19,6 @@
 #include <config.h>
 
 #include "system.h"
-#include "error.h"
 #include "quote.h"
 #include "set-fields.h"
 
index a3f4a4ea0320315d2f1b364c50fa91b25fd0b01a..9e8ba84abfba059c4870ce80f621145e8207f85f 100644 (file)
@@ -88,8 +88,6 @@
 #include "argmatch.h"
 #include "assure.h"
 #include "xdectoint.h"
-#include "die.h"
-#include "error.h"
 #include "fcntl--.h"
 #include "human.h"
 #include "randint.h"
@@ -1202,7 +1200,7 @@ main (int argc, char **argv)
 
         case RANDOM_SOURCE_OPTION:
           if (random_source && !STREQ (random_source, optarg))
-            die (EXIT_FAILURE, 0, _("multiple random sources specified"));
+            error (EXIT_FAILURE, 0, _("multiple random sources specified"));
           random_source = optarg;
           break;
 
@@ -1251,8 +1249,8 @@ main (int argc, char **argv)
 
   randint_source = randint_all_new (random_source, SIZE_MAX);
   if (! randint_source)
-    die (EXIT_FAILURE, errno, "%s",
-         quotef (random_source ? random_source : "getrandom"));
+    error (EXIT_FAILURE, errno, "%s",
+           quotef (random_source ? random_source : "getrandom"));
   atexit (clear_random_data);
 
   for (i = 0; i < n_files; i++)
index 2338cdb78e3de1f74e6b77c1d5b2d0a583a6f23a..436f327e1b277ddde5bf15d3c52dbeb38c9b40bf 100644 (file)
@@ -22,8 +22,6 @@
 #include <sys/types.h>
 #include "system.h"
 
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "getopt.h"
 #include "linebuffer.h"
@@ -222,14 +220,14 @@ read_input_reservoir_sampling (FILE *in, char eolbyte, size_t k,
       while (readlinebuffer_delim (line, in, eolbyte) != nullptr && n_lines++);
 
       if (! n_lines)
-        die (EXIT_FAILURE, EOVERFLOW, _("too many input lines"));
+        error (EXIT_FAILURE, EOVERFLOW, _("too many input lines"));
 
       freebuffer (&dummy);
     }
 
   /* no more input lines, or an input error.  */
   if (ferror (in))
-    die (EXIT_FAILURE, errno, _("read error"));
+    error (EXIT_FAILURE, errno, _("read error"));
 
   *out_rsrv = rsrv;
   return MIN (k, n_lines);
@@ -275,7 +273,7 @@ read_input (FILE *in, char eolbyte, char ***pline)
      avoiding the reservoir CPU overhead when reading < RESERVOIR_MIN_INPUT
      from a pipe, and allow us to dispense with the input_size() function.  */
   if (!(buf = fread_file (in, 0, &used)))
-    die (EXIT_FAILURE, errno, _("read error"));
+    error (EXIT_FAILURE, errno, _("read error"));
 
   if (used && buf[used - 1] != eolbyte)
     buf[used++] = eolbyte;
@@ -411,7 +409,7 @@ main (int argc, char **argv)
       case 'i':
         {
           if (input_range)
-            die (EXIT_FAILURE, 0, _("multiple -i options specified"));
+            error (EXIT_FAILURE, 0, _("multiple -i options specified"));
           input_range = true;
 
           uintmax_t u;
@@ -439,8 +437,8 @@ main (int argc, char **argv)
           n_lines = hi_input - lo_input + 1;
 
           if (err != LONGINT_OK || (lo_input <= hi_input) == (n_lines == 0))
-            die (EXIT_FAILURE, err == LONGINT_OVERFLOW ? EOVERFLOW : 0,
-                 "%s: %s", _("invalid input range"), quote (optarg));
+            error (EXIT_FAILURE, err == LONGINT_OVERFLOW ? EOVERFLOW : 0,
+                   "%s: %s", _("invalid input range"), quote (optarg));
         }
         break;
 
@@ -452,20 +450,20 @@ main (int argc, char **argv)
           if (e == LONGINT_OK)
             head_lines = MIN (head_lines, argval);
           else if (e != LONGINT_OVERFLOW)
-            die (EXIT_FAILURE, 0, _("invalid line count: %s"),
-                 quote (optarg));
+            error (EXIT_FAILURE, 0, _("invalid line count: %s"),
+                   quote (optarg));
         }
         break;
 
       case 'o':
         if (outfile && !STREQ (outfile, optarg))
-          die (EXIT_FAILURE, 0, _("multiple output files specified"));
+          error (EXIT_FAILURE, 0, _("multiple output files specified"));
         outfile = optarg;
         break;
 
       case RANDOM_SOURCE_OPTION:
         if (random_source && !STREQ (random_source, optarg))
-          die (EXIT_FAILURE, 0, _("multiple random sources specified"));
+          error (EXIT_FAILURE, 0, _("multiple random sources specified"));
         random_source = optarg;
         break;
 
@@ -521,7 +519,7 @@ main (int argc, char **argv)
       if (n_operands == 1
           && ! (STREQ (operand[0], "-")
                 || freopen (operand[0], "r", stdin)))
-        die (EXIT_FAILURE, errno, "%s", quotef (operand[0]));
+        error (EXIT_FAILURE, errno, "%s", quotef (operand[0]));
 
       fadvise (stdin, FADVISE_SEQUENTIAL);
 
@@ -547,8 +545,8 @@ main (int argc, char **argv)
                                      ? SIZE_MAX
                                      : randperm_bound (ahead_lines, n_lines)));
   if (! randint_source)
-    die (EXIT_FAILURE, errno, "%s",
-         quotef (random_source ? random_source : "getrandom"));
+    error (EXIT_FAILURE, errno, "%s",
+           quotef (random_source ? random_source : "getrandom"));
 
   if (use_reservoir_sampling)
     {
@@ -563,13 +561,13 @@ main (int argc, char **argv)
      doesn't have to worry about opening something other than
      stdin.  */
   if (! (head_lines == 0 || echo || input_range || fclose (stdin) == 0))
-    die (EXIT_FAILURE, errno, _("read error"));
+    error (EXIT_FAILURE, errno, _("read error"));
 
   if (!repeat)
     permutation = randperm_new (randint_source, ahead_lines, n_lines);
 
   if (outfile && ! freopen (outfile, "w", stdout))
-    die (EXIT_FAILURE, errno, "%s", quotef (outfile));
+    error (EXIT_FAILURE, errno, "%s", quotef (outfile));
 
   /* Generate output according to requested method */
   if (repeat)
@@ -579,7 +577,7 @@ main (int argc, char **argv)
       else
         {
           if (n_lines == 0)
-            die (EXIT_FAILURE, 0, _("no lines to repeat"));
+            error (EXIT_FAILURE, 0, _("no lines to repeat"));
           if (input_range)
             i = write_random_numbers (randint_source, ahead_lines,
                                       lo_input, hi_input, eolbyte);
@@ -599,7 +597,7 @@ main (int argc, char **argv)
     }
 
   if (i != 0)
-    die (EXIT_FAILURE, errno, _("write error"));
+    error (EXIT_FAILURE, errno, _("write error"));
 
   main_exit (EXIT_SUCCESS);
 }
index a9ff5f20d107e189cba2cf69f0b0db28b02f121b..22b47934ece44d1c4cc80bfc63d047cb71cfeff0 100644 (file)
@@ -20,8 +20,6 @@
 
 #include "system.h"
 #include "cl-strtod.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 #include "xnanosleep.h"
@@ -140,7 +138,7 @@ main (int argc, char **argv)
     usage (EXIT_FAILURE);
 
   if (xnanosleep (seconds))
-    die (EXIT_FAILURE, errno, _("cannot read realtime clock"));
+    error (EXIT_FAILURE, errno, _("cannot read realtime clock"));
 
   return EXIT_SUCCESS;
 }
index b3a1342133b368e83ebb43d50197edb8151e16ed..a7002d170b4a47cf580f0451547d0dcd86e7965b 100644 (file)
@@ -31,8 +31,6 @@
 #include "system.h"
 #include "argmatch.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "filevercmp.h"
 #include "flexmember.h"
@@ -404,8 +402,8 @@ async_safe_die (int errnum, char const *errstr)
 static void
 sort_die (char const *message, char const *file)
 {
-  die (SORT_FAILURE, errno, "%s: %s", message,
-       quotef (file ? file : _("standard output")));
+  error (SORT_FAILURE, errno, "%s: %s", message,
+         quotef (file ? file : _("standard output")));
 }
 
 void
@@ -716,13 +714,13 @@ reap (pid_t pid)
   pid_t cpid = waitpid ((pid ? pid : -1), &status, (pid ? 0 : WNOHANG));
 
   if (cpid < 0)
-    die (SORT_FAILURE, errno, _("waiting for %s [-d]"),
-         quoteaf (compress_program));
+    error (SORT_FAILURE, errno, _("waiting for %s [-d]"),
+           quoteaf (compress_program));
   else if (0 < cpid && (0 < pid || delete_proc (cpid)))
     {
       if (! WIFEXITED (status) || WEXITSTATUS (status))
-        die (SORT_FAILURE, 0, _("%s [-d] terminated abnormally"),
-             quoteaf (compress_program));
+        error (SORT_FAILURE, 0, _("%s [-d] terminated abnormally"),
+               quoteaf (compress_program));
       --nprocs;
     }
 
@@ -876,8 +874,8 @@ create_temp_file (int *pfd, bool survive_fd_exhaustion)
   if (fd < 0)
     {
       if (! (survive_fd_exhaustion && errno == EMFILE))
-        die (SORT_FAILURE, errno, _("cannot create temporary file in %s"),
-             quoteaf (temp_dir));
+        error (SORT_FAILURE, errno, _("cannot create temporary file in %s"),
+               quoteaf (temp_dir));
       free (node);
       node = nullptr;
     }
@@ -972,8 +970,8 @@ stream_open (char const *file, char const *how)
           int ftruncate_errno = errno;
           struct stat *outst = get_outstatus ();
           if (!outst || S_ISREG (outst->st_mode) || S_TYPEISSHM (outst))
-            die (SORT_FAILURE, ftruncate_errno, _("%s: error truncating"),
-                 quotef (file));
+            error (SORT_FAILURE, ftruncate_errno, _("%s: error truncating"),
+                   quotef (file));
         }
       fp = stdout;
     }
@@ -1193,8 +1191,8 @@ open_temp (struct tempnode *temp)
     {
     case -1:
       if (errno != EMFILE)
-        die (SORT_FAILURE, errno, _("couldn't create process for %s -d"),
-             quoteaf (compress_program));
+        error (SORT_FAILURE, errno, _("couldn't create process for %s -d"),
+               quoteaf (compress_program));
       close (tempfd);
       errno = EMFILE;
       break;
@@ -1354,9 +1352,9 @@ specify_nmerge (int oi, char c, char const *s)
             {
               error (0, 0, _("invalid --%s argument %s"),
                      long_options[oi].name, quote (s));
-              die (SORT_FAILURE, 0,
-                   _("minimum --%s argument is %s"),
-                   long_options[oi].name, quote ("2"));
+              error (SORT_FAILURE, 0,
+                     _("minimum --%s argument is %s"),
+                     long_options[oi].name, quote ("2"));
             }
           else if (max_nmerge < nmerge)
             {
@@ -1372,10 +1370,10 @@ specify_nmerge (int oi, char c, char const *s)
       char max_nmerge_buf[INT_BUFSIZE_BOUND (max_nmerge)];
       error (0, 0, _("--%s argument %s too large"),
              long_options[oi].name, quote (s));
-      die (SORT_FAILURE, 0,
-           _("maximum --%s argument with current rlimit is %s"),
-           long_options[oi].name,
-           uinttostr (max_nmerge, max_nmerge_buf));
+      error (SORT_FAILURE, 0,
+             _("maximum --%s argument with current rlimit is %s"),
+             long_options[oi].name,
+             uinttostr (max_nmerge, max_nmerge_buf));
     }
   else
     xstrtol_fatal (e, oi, c, long_options, s);
@@ -1455,7 +1453,7 @@ specify_nthreads (int oi, char c, char const *s)
   if (SIZE_MAX < nthreads)
     nthreads = SIZE_MAX;
   if (nthreads == 0)
-    die (SORT_FAILURE, 0, _("number in parallel must be nonzero"));
+    error (SORT_FAILURE, 0, _("number in parallel must be nonzero"));
   return nthreads;
 }
 
@@ -2116,9 +2114,9 @@ xstrxfrm (char *restrict dest, char const *restrict src, size_t destsize)
     {
       error (0, errno, _("string transformation failed"));
       error (0, 0, _("set LC_ALL='C' to work around the problem"));
-      die (SORT_FAILURE, 0,
-           _("the untransformed string was %s"),
-           quotearg_n_style (0, locale_quoting_style, src));
+      error (SORT_FAILURE, 0,
+             _("the untransformed string was %s"),
+             quotearg_n_style (0, locale_quoting_style, src));
     }
 
   return translated_size;
@@ -4118,8 +4116,8 @@ insertkey (struct keyfield *key_arg)
 static void
 badfieldspec (char const *spec, char const *msgid)
 {
-  die (SORT_FAILURE, 0, _("%s: invalid field specification %s"),
-       _(msgid), quote (spec));
+  error (SORT_FAILURE, 0, _("%s: invalid field specification %s"),
+         _(msgid), quote (spec));
 }
 
 /* Report incompatible options.  */
@@ -4127,7 +4125,7 @@ badfieldspec (char const *spec, char const *msgid)
 static void
 incompatible_options (char const *opts)
 {
-  die (SORT_FAILURE, 0, _("options '-%s' are incompatible"), (opts));
+  error (SORT_FAILURE, 0, _("options '-%s' are incompatible"), (opts));
 }
 
 /* Check compatibility of ordering options.  */
@@ -4177,8 +4175,8 @@ parse_field_count (char const *string, size_t *val, char const *msgid)
 
     case LONGINT_INVALID:
       if (msgid)
-        die (SORT_FAILURE, 0, _("%s: invalid count at start of %s"),
-             _(msgid), quote (string));
+        error (SORT_FAILURE, 0, _("%s: invalid count at start of %s"),
+               _(msgid), quote (string));
       return nullptr;
     }
 
@@ -4501,7 +4499,7 @@ main (int argc, char **argv)
 
         case COMPRESS_PROGRAM_OPTION:
           if (compress_program && !STREQ (compress_program, optarg))
-            die (SORT_FAILURE, 0, _("multiple compress programs specified"));
+            error (SORT_FAILURE, 0, _("multiple compress programs specified"));
           compress_program = optarg;
           break;
 
@@ -4574,13 +4572,13 @@ main (int argc, char **argv)
 
         case 'o':
           if (outfile && !STREQ (outfile, optarg))
-            die (SORT_FAILURE, 0, _("multiple output files specified"));
+            error (SORT_FAILURE, 0, _("multiple output files specified"));
           outfile = optarg;
           break;
 
         case RANDOM_SOURCE_OPTION:
           if (random_source && !STREQ (random_source, optarg))
-            die (SORT_FAILURE, 0, _("multiple random sources specified"));
+            error (SORT_FAILURE, 0, _("multiple random sources specified"));
           random_source = optarg;
           break;
 
@@ -4596,7 +4594,7 @@ main (int argc, char **argv)
           {
             char newtab = optarg[0];
             if (! newtab)
-              die (SORT_FAILURE, 0, _("empty tab"));
+              error (SORT_FAILURE, 0, _("empty tab"));
             if (optarg[1])
               {
                 if (STREQ (optarg, "\\0"))
@@ -4607,12 +4605,12 @@ main (int argc, char **argv)
                        "multi-character tab" instead of "multibyte tab", so
                        that the diagnostic's wording does not need to be
                        changed once multibyte characters are supported.  */
-                    die (SORT_FAILURE, 0, _("multi-character tab %s"),
-                         quote (optarg));
+                    error (SORT_FAILURE, 0, _("multi-character tab %s"),
+                           quote (optarg));
                   }
               }
             if (tab != TAB_DEFAULT && tab != newtab)
-              die (SORT_FAILURE, 0, _("incompatible tabs"));
+              error (SORT_FAILURE, 0, _("incompatible tabs"));
             tab = newtab;
           }
           break;
@@ -4679,8 +4677,8 @@ main (int argc, char **argv)
       readtokens0_init (&tok);
 
       if (! readtokens0 (stream, &tok))
-        die (SORT_FAILURE, 0, _("cannot read file names from %s"),
-             quoteaf (files_from));
+        error (SORT_FAILURE, 0, _("cannot read file names from %s"),
+               quoteaf (files_from));
       xfclose (stream, files_from);
 
       if (tok.n_tok)
@@ -4691,24 +4689,24 @@ main (int argc, char **argv)
           for (size_t i = 0; i < nfiles; i++)
             {
               if (STREQ (files[i], "-"))
-                die (SORT_FAILURE, 0, _("when reading file names from stdin, "
-                                        "no file name of %s allowed"),
-                     quoteaf (files[i]));
+                error (SORT_FAILURE, 0, _("when reading file names from stdin, "
+                                          "no file name of %s allowed"),
+                       quoteaf (files[i]));
               else if (files[i][0] == '\0')
                 {
                   /* Using the standard 'filename:line-number:' prefix here is
                      not totally appropriate, since NUL is the separator,
                      not NL, but it might be better than nothing.  */
                   unsigned long int file_number = i + 1;
-                  die (SORT_FAILURE, 0,
-                       _("%s:%lu: invalid zero-length file name"),
-                       quotef (files_from), file_number);
+                  error (SORT_FAILURE, 0,
+                         _("%s:%lu: invalid zero-length file name"),
+                         quotef (files_from), file_number);
                 }
             }
         }
       else
-        die (SORT_FAILURE, 0, _("no input from %s"),
-             quoteaf (files_from));
+        error (SORT_FAILURE, 0, _("no input from %s"),
+               quoteaf (files_from));
     }
 
   /* Inheritance of global options to individual keys. */
@@ -4796,8 +4794,8 @@ main (int argc, char **argv)
   if (checkonly)
     {
       if (nfiles > 1)
-        die (SORT_FAILURE, 0, _("extra operand %s not allowed with -%c"),
-             quoteaf (files[1]), checkonly);
+        error (SORT_FAILURE, 0, _("extra operand %s not allowed with -%c"),
+               quoteaf (files[1]), checkonly);
 
       if (outfile)
         {
index da21d5eb71000ede038e23b03c1985912444b63f..f4514d4d28f842fc65c97611dd22cdb497fd79e6 100644 (file)
@@ -30,8 +30,6 @@
 #include "system.h"
 #include "alignalloc.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "fd-reopen.h"
 #include "fcntl--.h"
@@ -206,11 +204,9 @@ set_suffix_length (intmax_t n_units, enum Split_type split_type)
   if (suffix_length)            /* set by user */
     {
       if (suffix_length < suffix_length_needed)
-        {
-          die (EXIT_FAILURE, 0,
+        error (EXIT_FAILURE, 0,
                _("the suffix length needs to be at least %d"),
                suffix_length_needed);
-        }
       suffix_auto = false;
       return;
     }
@@ -444,7 +440,7 @@ new_name:
         char *dir = dir_name (outfile);
         long name_max = pathconf (dir, _PC_NAME_MAX);
         if (0 <= name_max && name_max < base_len (last_component (outfile)))
-          die (EXIT_FAILURE, ENAMETOOLONG, "%s", quotef (outfile));
+          error (EXIT_FAILURE, ENAMETOOLONG, "%s", quotef (outfile));
         free (dir);
       }
 #endif
@@ -465,7 +461,7 @@ new_name:
           sufindex[i] = 0;
           outfile_mid[i] = suffix_alphabet[sufindex[i]];
         }
-      die (EXIT_FAILURE, 0, _("output file suffixes exhausted"));
+      error (EXIT_FAILURE, 0, _("output file suffixes exhausted"));
     }
 }
 
@@ -488,15 +484,15 @@ create (char const *name)
         return fd;
       struct stat out_stat_buf;
       if (fstat (fd, &out_stat_buf) != 0)
-        die (EXIT_FAILURE, errno, _("failed to stat %s"), quoteaf (name));
+        error (EXIT_FAILURE, errno, _("failed to stat %s"), quoteaf (name));
       if (SAME_INODE (in_stat_buf, out_stat_buf))
-        die (EXIT_FAILURE, 0, _("%s would overwrite input; aborting"),
-             quoteaf (name));
+        error (EXIT_FAILURE, 0, _("%s would overwrite input; aborting"),
+               quoteaf (name));
       bool regularish
         = S_ISREG (out_stat_buf.st_mode) || S_TYPEISSHM (&out_stat_buf);
       if (! (regularish && out_stat_buf.st_size == 0)
           && ftruncate (fd, 0) < 0 && regularish)
-        die (EXIT_FAILURE, errno, _("%s: error truncating"), quotef (name));
+        error (EXIT_FAILURE, errno, _("%s: error truncating"), quotef (name));
 
       return fd;
     }
@@ -508,12 +504,12 @@ create (char const *name)
       if (shell_prog == nullptr)
         shell_prog = "/bin/sh";
       if (setenv ("FILE", name, 1) != 0)
-        die (EXIT_FAILURE, errno,
-             _("failed to set FILE environment variable"));
+        error (EXIT_FAILURE, errno,
+               _("failed to set FILE environment variable"));
       if (verbose)
         fprintf (stdout, _("executing with FILE=%s\n"), quotef (name));
       if (pipe (fd_pair) != 0)
-        die (EXIT_FAILURE, errno, _("failed to create pipe"));
+        error (EXIT_FAILURE, errno, _("failed to create pipe"));
       child_pid = fork ();
       if (child_pid == 0)
         {
@@ -527,27 +523,27 @@ create (char const *name)
              reading an EOF on the corresponding read-pipe.  */
           for (j = 0; j < n_open_pipes; ++j)
             if (close (open_pipes[j]) != 0)
-              die (EXIT_FAILURE, errno, _("closing prior pipe"));
+              error (EXIT_FAILURE, errno, _("closing prior pipe"));
           if (close (fd_pair[1]))
-            die (EXIT_FAILURE, errno, _("closing output pipe"));
+            error (EXIT_FAILURE, errno, _("closing output pipe"));
           if (fd_pair[0] != STDIN_FILENO)
             {
               if (dup2 (fd_pair[0], STDIN_FILENO) != STDIN_FILENO)
-                die (EXIT_FAILURE, errno, _("moving input pipe"));
+                error (EXIT_FAILURE, errno, _("moving input pipe"));
               if (close (fd_pair[0]) != 0)
-                die (EXIT_FAILURE, errno, _("closing input pipe"));
+                error (EXIT_FAILURE, errno, _("closing input pipe"));
             }
           if (default_SIGPIPE)
             signal (SIGPIPE, SIG_DFL);
           execl (shell_prog, last_component (shell_prog), "-c",
                  filter_command, (char *) nullptr);
-          die (EXIT_FAILURE, errno, _("failed to run command: \"%s -c %s\""),
-               shell_prog, filter_command);
+          error (EXIT_FAILURE, errno, _("failed to run command: \"%s -c %s\""),
+                 shell_prog, filter_command);
         }
       if (child_pid < 0)
-        die (EXIT_FAILURE, errno, _("fork system call failed"));
+        error (EXIT_FAILURE, errno, _("fork system call failed"));
       if (close (fd_pair[0]) != 0)
-        die (EXIT_FAILURE, errno, _("failed to close input pipe"));
+        error (EXIT_FAILURE, errno, _("failed to close input pipe"));
       filter_pid = child_pid;
       if (n_open_pipes == open_pipes_alloc)
         open_pipes = xpalloc (open_pipes, &open_pipes_alloc, 1,
@@ -564,11 +560,11 @@ static void
 closeout (FILE *fp, int fd, pid_t pid, char const *name)
 {
   if (fp != nullptr && fclose (fp) != 0 && ! ignorable (errno))
-    die (EXIT_FAILURE, errno, "%s", quotef (name));
+    error (EXIT_FAILURE, errno, "%s", quotef (name));
   if (fd >= 0)
     {
       if (fp == nullptr && close (fd) < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (name));
+        error (EXIT_FAILURE, errno, "%s", quotef (name));
       int j;
       for (j = 0; j < n_open_pipes; ++j)
         {
@@ -583,7 +579,7 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name)
     {
       int wstatus;
       if (waitpid (pid, &wstatus, 0) < 0)
-        die (EXIT_FAILURE, errno, _("waiting for child process"));
+        error (EXIT_FAILURE, errno, _("waiting for child process"));
       else if (WIFSIGNALED (wstatus))
         {
           int sig = WTERMSIG (wstatus);
@@ -607,8 +603,8 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name)
       else
         {
           /* shouldn't happen.  */
-          die (EXIT_FAILURE, 0,
-               _("unknown status from command (0x%X)"), wstatus + 0u);
+          error (EXIT_FAILURE, 0,
+                 _("unknown status from command (0x%X)"), wstatus + 0u);
         }
     }
 }
@@ -629,7 +625,7 @@ cwrite (bool new_file_flag, char const *bp, idx_t bytes)
       next_file_name ();
       output_desc = create (outfile);
       if (output_desc < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (outfile));
+        error (EXIT_FAILURE, errno, "%s", quotef (outfile));
     }
 
   if (full_write (output_desc, bp, bytes) == bytes)
@@ -637,7 +633,7 @@ cwrite (bool new_file_flag, char const *bp, idx_t bytes)
   else
     {
       if (! ignorable (errno))
-        die (EXIT_FAILURE, errno, "%s", quotef (outfile));
+        error (EXIT_FAILURE, errno, "%s", quotef (outfile));
       return false;
     }
 }
@@ -679,7 +675,7 @@ bytes_split (intmax_t n_bytes, intmax_t rem_bytes,
 
           n_read = read (STDIN_FILENO, buf, bufsize);
           if (n_read < 0)
-            die (EXIT_FAILURE, errno, "%s", quotef (infile));
+            error (EXIT_FAILURE, errno, "%s", quotef (infile));
           eof = n_read == 0;
         }
       char *bp_out = buf;
@@ -737,7 +733,7 @@ lines_split (intmax_t n_lines, char *buf, idx_t bufsize)
     {
       n_read = read (STDIN_FILENO, buf, bufsize);
       if (n_read < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
       bp = bp_out = buf;
       eob = bp + n_read;
       *eob = eolchar;
@@ -786,7 +782,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t bufsize)
     {
       n_read = read (STDIN_FILENO, buf, bufsize);
       if (n_read < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
       idx_t n_left = n_read;
       char *sob = buf;
       while (n_left)
@@ -908,7 +904,7 @@ lines_chunk_split (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
         {
           if (initial_read < start
               && lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0)
-            die (EXIT_FAILURE, errno, "%s", quotef (infile));
+            error (EXIT_FAILURE, errno, "%s", quotef (infile));
           initial_read = -1;
         }
       n_written = start;
@@ -930,7 +926,7 @@ lines_chunk_split (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
           n_read = read (STDIN_FILENO, buf,
                          MIN (bufsize, file_size - n_written));
           if (n_read < 0)
-            die (EXIT_FAILURE, errno, "%s", quotef (infile));
+            error (EXIT_FAILURE, errno, "%s", quotef (infile));
         }
       if (n_read == 0)
         break; /* eof.  */
@@ -960,7 +956,7 @@ lines_chunk_split (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
                  large chunks from an existing file, so it's more efficient
                  to write out directly.  */
               if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
-                die (EXIT_FAILURE, errno, "%s", _("write error"));
+                error (EXIT_FAILURE, errno, "%s", _("write error"));
             }
           else if (! k)
             cwrite (new_file_flag, bp, to_write);
@@ -1028,7 +1024,7 @@ bytes_chunk_extract (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
     {
       if (initial_read < start
           && lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
       initial_read = -1;
     }
 
@@ -1044,14 +1040,14 @@ bytes_chunk_extract (intmax_t k, intmax_t n, char *buf, idx_t bufsize,
         {
           n_read = read (STDIN_FILENO, buf, bufsize);
           if (n_read < 0)
-            die (EXIT_FAILURE, errno, "%s", quotef (infile));
+            error (EXIT_FAILURE, errno, "%s", quotef (infile));
         }
       if (n_read == 0)
         break; /* eof.  */
       n_read = MIN (n_read, end - start);
       if (full_write (STDOUT_FILENO, buf, n_read) != n_read
           && ! ignorable (errno))
-        die (EXIT_FAILURE, errno, "%s", quotef ("-"));
+        error (EXIT_FAILURE, errno, "%s", quotef ("-"));
       start += n_read;
     }
 }
@@ -1116,7 +1112,7 @@ ofile_open (of_t *files, idx_t i_check, idx_t nfiles)
             break;
 
           if (!(errno == EMFILE || errno == ENFILE))
-            die (EXIT_FAILURE, errno, "%s", quotef (files[i_check].of_name));
+            error (EXIT_FAILURE, errno, "%s", quotef (files[i_check].of_name));
 
           file_limit = true;
 
@@ -1126,12 +1122,12 @@ ofile_open (of_t *files, idx_t i_check, idx_t nfiles)
               i_reopen = i_reopen ? i_reopen - 1 : nfiles - 1;
               /* No more open files to close, exit with E[NM]FILE.  */
               if (i_reopen == i_check)
-                die (EXIT_FAILURE, errno, "%s",
-                     quotef (files[i_check].of_name));
+                error (EXIT_FAILURE, errno, "%s",
+                       quotef (files[i_check].of_name));
             }
 
           if (fclose (files[i_reopen].ofile) != 0)
-            die (EXIT_FAILURE, errno, "%s", quotef (files[i_reopen].of_name));
+            error (EXIT_FAILURE, errno, "%s", quotef (files[i_reopen].of_name));
           files[i_reopen].ofile = nullptr;
           files[i_reopen].ofd = OFD_APPEND;
         }
@@ -1139,7 +1135,7 @@ ofile_open (of_t *files, idx_t i_check, idx_t nfiles)
       files[i_check].ofd = fd;
       FILE *ofile = fdopen (fd, "a");
       if (!ofile)
-        die (EXIT_FAILURE, errno, "%s", quotef (files[i_check].of_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (files[i_check].of_name));
       files[i_check].ofile = ofile;
       files[i_check].opid = filter_pid;
       filter_pid = 0;
@@ -1191,7 +1187,7 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
       char *bp = buf, *eob;
       ssize_t n_read = read (STDIN_FILENO, buf, bufsize);
       if (n_read < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (infile));
+        error (EXIT_FAILURE, errno, "%s", quotef (infile));
       else if (n_read == 0)
         break; /* eof.  */
       eob = buf + n_read;
@@ -1217,12 +1213,12 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
               if (line_no == k && unbuffered)
                 {
                   if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
-                    die (EXIT_FAILURE, errno, "%s", _("write error"));
+                    error (EXIT_FAILURE, errno, "%s", _("write error"));
                 }
               else if (line_no == k && fwrite (bp, to_write, 1, stdout) != 1)
                 {
                   clearerr (stdout); /* To silence close_stdout().  */
-                  die (EXIT_FAILURE, errno, "%s", _("write error"));
+                  error (EXIT_FAILURE, errno, "%s", _("write error"));
                 }
               if (next)
                 line_no = (line_no == n) ? 1 : line_no + 1;
@@ -1237,17 +1233,13 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
                      an 8% performance benefit, due to reduced data copying.  */
                   if (full_write (files[i_file].ofd, bp, to_write) != to_write
                       && ! ignorable (errno))
-                    {
-                      die (EXIT_FAILURE, errno, "%s",
+                    error (EXIT_FAILURE, errno, "%s",
                            quotef (files[i_file].of_name));
-                    }
                 }
               else if (fwrite (bp, to_write, 1, files[i_file].ofile) != 1
                        && ! ignorable (errno))
-                {
-                  die (EXIT_FAILURE, errno, "%s",
+                error (EXIT_FAILURE, errno, "%s",
                        quotef (files[i_file].of_name));
-                }
 
               if (! ignorable (errno))
                 wrote = true;
@@ -1255,10 +1247,8 @@ lines_rr (intmax_t k, intmax_t n, char *buf, idx_t bufsize, of_t **filesp)
               if (file_limit)
                 {
                   if (fclose (files[i_file].ofile) != 0)
-                    {
-                      die (EXIT_FAILURE, errno, "%s",
+                    error (EXIT_FAILURE, errno, "%s",
                            quotef (files[i_file].of_name));
-                    }
                   files[i_file].ofile = nullptr;
                   files[i_file].ofd = OFD_APPEND;
                 }
@@ -1310,8 +1300,8 @@ no_filters:
 static _Noreturn void
 strtoint_die (char const *msgid, char const *arg)
 {
-  die (EXIT_FAILURE, errno == EINVAL ? 0 : errno, "%s: %s",
-       gettext (msgid), quote (arg));
+  error (EXIT_FAILURE, errno == EINVAL ? 0 : errno, "%s: %s",
+         gettext (msgid), quote (arg));
 }
 
 /* Use OVERFLOW_OK when it is OK to ignore LONGINT_OVERFLOW errors, since the
@@ -1345,8 +1335,8 @@ parse_chunk (intmax_t *k_units, intmax_t *n_units, char const *arg)
       *n_units = parse_n_units (argend + 1, "",
                                 N_("invalid number of chunks"));
       if (! (0 < *k_units && *k_units <= *n_units))
-        die (EXIT_FAILURE, 0, "%s: %s", _("invalid chunk number"),
-             quote_mem (arg, argend - arg));
+        error (EXIT_FAILURE, 0, "%s: %s", _("invalid chunk number"),
+               quote_mem (arg, argend - arg));
     }
   else if (! (e <= OVERFLOW_OK && 0 < *n_units))
     strtoint_die (N_("invalid number of chunks"), arg);
@@ -1464,7 +1454,7 @@ main (int argc, char **argv)
           {
             char neweol = optarg[0];
             if (! neweol)
-              die (EXIT_FAILURE, 0, _("empty record separator"));
+              error (EXIT_FAILURE, 0, _("empty record separator"));
             if (optarg[1])
               {
                 if (STREQ (optarg, "\\0"))
@@ -1475,15 +1465,15 @@ main (int argc, char **argv)
                        "multi-character tab" instead of "multibyte tab", so
                        that the diagnostic's wording does not need to be
                        changed once multibyte characters are supported.  */
-                    die (EXIT_FAILURE, 0, _("multi-character separator %s"),
-                         quote (optarg));
+                    error (EXIT_FAILURE, 0, _("multi-character separator %s"),
+                           quote (optarg));
                   }
               }
             /* Make it explicit we don't support multiple separators.  */
             if (0 <= eolchar && neweol != eolchar)
               {
-                die (EXIT_FAILURE, 0,
-                     _("multiple separator characters specified"));
+                error (EXIT_FAILURE, 0,
+                       _("multiple separator characters specified"));
               }
 
             eolchar = neweol;
@@ -1620,8 +1610,8 @@ main (int argc, char **argv)
   /* Open the input file.  */
   if (! STREQ (infile, "-")
       && fd_reopen (STDIN_FILENO, infile, O_RDONLY, 0) < 0)
-    die (EXIT_FAILURE, errno, _("cannot open %s for reading"),
-         quoteaf (infile));
+    error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+           quoteaf (infile));
 
   /* Binary I/O is safer when byte counts are used.  */
   xset_binary_mode (STDIN_FILENO, O_BINARY);
@@ -1632,7 +1622,7 @@ main (int argc, char **argv)
   /* Get the optimal block size of input device and make a buffer.  */
 
   if (fstat (STDIN_FILENO, &in_stat_buf) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (infile));
+    error (EXIT_FAILURE, errno, "%s", quotef (infile));
 
   if (in_blk_size == 0)
     {
@@ -1649,8 +1639,8 @@ main (int argc, char **argv)
       file_size = input_file_size (STDIN_FILENO, &in_stat_buf,
                                    buf, in_blk_size);
       if (file_size < 0)
-        die (EXIT_FAILURE, errno, _("%s: cannot determine file size"),
-             quotef (infile));
+        error (EXIT_FAILURE, errno, _("%s: cannot determine file size"),
+               quotef (infile));
       initial_read = MIN (file_size, in_blk_size);
     }
 
@@ -1702,7 +1692,7 @@ main (int argc, char **argv)
     }
 
   if (close (STDIN_FILENO) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (infile));
+    error (EXIT_FAILURE, errno, "%s", quotef (infile));
   closeout (nullptr, output_desc, filter_pid, outfile);
 
   main_exit (EXIT_SUCCESS);
index 05d0cb9f58b70a6ae0dca225347e5986f6629442..d8678e5038e4c2fa170f7b8f85375afa852db5d6 100644 (file)
@@ -58,8 +58,6 @@
 
 #include "areadlink.h"
 #include "argmatch.h"
-#include "die.h"
-#include "error.h"
 #include "file-type.h"
 #include "filemode.h"
 #include "fs.h"
@@ -1170,8 +1168,8 @@ print_it (char const *format, int fd, char const *filename,
                   {
                     dest[len] = fmt_char;
                     dest[len + 1] = '\0';
-                    die (EXIT_FAILURE, 0, _("%s: invalid directive"),
-                         quote (dest));
+                    error (EXIT_FAILURE, 0, _("%s: invalid directive"),
+                           quote (dest));
                   }
                 putchar ('%');
                 break;
index 262b6d822391c00b3332bceb91a2b65d8540c8da..38df48e16f0870c6b59cb31164c733aaed2c7852 100644 (file)
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "quote.h"
 #include "xreadlink.h"
@@ -243,7 +241,7 @@ set_LD_PRELOAD (void)
 
       ++path;
       if ( ! *path)
-        die (EXIT_CANCELED, 0, _("failed to find %s"), quote (LIB_NAME));
+        error (EXIT_CANCELED, 0, _("failed to find %s"), quote (LIB_NAME));
     }
 
   /* FIXME: Do we need to support libstdbuf.dll, c:, '\' separators etc?  */
@@ -265,11 +263,9 @@ set_LD_PRELOAD (void)
 #endif
 
   if (ret != 0)
-    {
-      die (EXIT_CANCELED, errno,
+    error (EXIT_CANCELED, errno,
            _("failed to update the environment with %s"),
            quote (LD_PRELOAD));
-    }
 }
 
 /* Populate environ with _STDBUF_I=$MODE _STDBUF_O=$MODE _STDBUF_E=$MODE.
@@ -298,11 +294,9 @@ set_libstdbuf_options (void)
             xalloc_die ();
 
           if (putenv (var) != 0)
-            {
-              die (EXIT_CANCELED, errno,
+            error (EXIT_CANCELED, errno,
                    _("failed to update the environment with %s"),
                    quote (var));
-            }
 
           env_set = true;
         }
@@ -352,7 +346,7 @@ main (int argc, char **argv)
 
           if (!STREQ (optarg, "L")
               && parse_size (optarg, &stdbuf[opt_fileno].size) == -1)
-            die (EXIT_CANCELED, errno, _("invalid mode %s"), quote (optarg));
+            error (EXIT_CANCELED, errno, _("invalid mode %s"), quote (optarg));
 
           break;
 
index be8f4adeedd74c252d2051a113883f048be4a6d0..37f9b14ffc4b37bb8ff86b9d27b58d1fbdc8dbe0 100644 (file)
@@ -55,8 +55,6 @@
 
 #include "system.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fd-reopen.h"
 #include "quote.h"
 #include "xdectoint.h"
@@ -1209,10 +1207,8 @@ apply_settings (bool checking, char const *device_name,
                 continue;
 
               if (ioctl (STDIN_FILENO, TIOCEXT, &val) != 0)
-                {
-                  die (EXIT_FAILURE, errno, _("%s: error setting %s"),
+                error (EXIT_FAILURE, errno, _("%s: error setting %s"),
                        quotef_n (0, device_name), quote_n (1, arg));
-                }
             }
 #endif
 #ifdef TIOCGWINSZ
@@ -1345,7 +1341,7 @@ main (int argc, char **argv)
 
         case 'F':
           if (file_name)
-            die (EXIT_FAILURE, 0, _("only one device may be specified"));
+            error (EXIT_FAILURE, 0, _("only one device may be specified"));
           file_name = optarg;
           break;
 
@@ -1382,14 +1378,14 @@ main (int argc, char **argv)
 
   /* Specifying both -a and -g gets an error.  */
   if (verbose_output && recoverable_output)
-    die (EXIT_FAILURE, 0,
-         _("the options for verbose and stty-readable output styles are\n"
-           "mutually exclusive"));
+    error (EXIT_FAILURE, 0,
+           _("the options for verbose and stty-readable output styles are\n"
+             "mutually exclusive"));
 
   /* Specifying any other arguments with -a or -g gets an error.  */
   if (!noargs && (verbose_output || recoverable_output))
-    die (EXIT_FAILURE, 0,
-         _("when specifying an output style, modes may not be set"));
+    error (EXIT_FAILURE, 0,
+           _("when specifying an output style, modes may not be set"));
 
   device_name = file_name ? file_name : _("standard input");
 
@@ -1404,15 +1400,15 @@ main (int argc, char **argv)
     {
       int fdflags;
       if (fd_reopen (STDIN_FILENO, device_name, O_RDONLY | O_NONBLOCK, 0) < 0)
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
       if ((fdflags = fcntl (STDIN_FILENO, F_GETFL)) == -1
           || fcntl (STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0)
-        die (EXIT_FAILURE, errno, _("%s: couldn't reset non-blocking mode"),
-             quotef (device_name));
+        error (EXIT_FAILURE, errno, _("%s: couldn't reset non-blocking mode"),
+               quotef (device_name));
     }
 
   if (tcgetattr (STDIN_FILENO, &mode))
-    die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+    error (EXIT_FAILURE, errno, "%s", quotef (device_name));
 
   if (verbose_output || recoverable_output || noargs)
     {
@@ -1433,7 +1429,7 @@ main (int argc, char **argv)
       static struct termios new_mode;
 
       if (tcsetattr (STDIN_FILENO, tcsetattr_options, &mode))
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
 
       /* POSIX (according to Zlotnick's book) tcsetattr returns zero if
          it performs *any* of the requested operations.  This means it
@@ -1443,7 +1439,7 @@ main (int argc, char **argv)
          compare them to the requested ones.  */
 
       if (tcgetattr (STDIN_FILENO, &new_mode))
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
 
       if (! eq_mode (&mode, &new_mode))
         {
@@ -1459,9 +1455,9 @@ main (int argc, char **argv)
                 }
             }
 
-          die (EXIT_FAILURE, 0,
-                _("%s: unable to perform all requested operations"),
-                quotef (device_name));
+          error (EXIT_FAILURE, 0,
+                 _("%s: unable to perform all requested operations"),
+                 quotef (device_name));
         }
     }
 
@@ -1732,13 +1728,13 @@ set_speed (enum speed_setting type, char const *arg, struct termios *mode)
     {
       last_ibaud = baud;
       if (cfsetispeed (mode, baud))
-        die (EXIT_FAILURE, 0, "unsupported ispeed %s", quoteaf (arg));
+        error (EXIT_FAILURE, 0, "unsupported ispeed %s", quoteaf (arg));
     }
   if (type == output_speed || type == both_speeds)
     {
       last_obaud = baud;
       if (cfsetospeed (mode, baud))
-        die (EXIT_FAILURE, 0, "unsupported ospeed %s", quoteaf (arg));
+        error (EXIT_FAILURE, 0, "unsupported ospeed %s", quoteaf (arg));
     }
 }
 
@@ -1759,7 +1755,7 @@ set_window_size (int rows, int cols, char const *device_name)
   if (get_win_size (STDIN_FILENO, &win))
     {
       if (errno != EINVAL)
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
       memset (&win, 0, sizeof (win));
     }
 
@@ -1801,16 +1797,16 @@ set_window_size (int rows, int cols, char const *device_name)
       win.ws_col = 1;
 
       if (ioctl (STDIN_FILENO, TIOCSWINSZ, (char *) &win))
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
 
       if (ioctl (STDIN_FILENO, TIOCSSIZE, (char *) &ttysz))
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
       return;
     }
 # endif
 
   if (ioctl (STDIN_FILENO, TIOCSWINSZ, (char *) &win))
-    die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+    error (EXIT_FAILURE, errno, "%s", quotef (device_name));
 }
 
 static void
@@ -1821,11 +1817,11 @@ display_window_size (bool fancy, char const *device_name)
   if (get_win_size (STDIN_FILENO, &win))
     {
       if (errno != EINVAL)
-        die (EXIT_FAILURE, errno, "%s", quotef (device_name));
+        error (EXIT_FAILURE, errno, "%s", quotef (device_name));
       if (!fancy)
-        die (EXIT_FAILURE, 0,
-             _("%s: no size information for this device"),
-             quotef (device_name));
+        error (EXIT_FAILURE, 0,
+               _("%s: no size information for this device"),
+               quotef (device_name));
     }
   else
     {
@@ -2092,9 +2088,9 @@ check_speed (struct termios *mode)
     {
       if (cfgetispeed (mode) != last_ibaud
           || cfgetospeed (mode) != last_obaud)
-        die (EXIT_FAILURE, 0,
-             _("asymmetric input (%lu), output (%lu) speeds not supported"),
-             baud_to_value (last_ibaud), baud_to_value (last_obaud));
+        error (EXIT_FAILURE, 0,
+               _("asymmetric input (%lu), output (%lu) speeds not supported"),
+               baud_to_value (last_ibaud), baud_to_value (last_obaud));
     }
 }
 
index 07b4392b35bbf25816a76614fdeaded2b3bd4e06..22337bcdc61c1cdfdf872a52f844e4164ed70cbf 100644 (file)
@@ -22,8 +22,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
 #define PROGRAM_NAME "sync"
@@ -209,13 +207,11 @@ main (int argc, char **argv)
   args_specified = optind < argc;
 
   if (arg_data && arg_file_system)
-    {
-      die (EXIT_FAILURE, 0,
+    error (EXIT_FAILURE, 0,
            _("cannot specify both --data and --file-system"));
-    }
 
   if (!args_specified && arg_data)
-    die (EXIT_FAILURE, 0, _("--data needs at least one argument"));
+    error (EXIT_FAILURE, 0, _("--data needs at least one argument"));
 
   if (! args_specified || (arg_file_system && ! HAVE_SYNCFS))
     mode = MODE_SYNC;
index 082cbe5bd6d2f2cc9f1ebaf6840b1f32aafef838..c8c8d52f2a769fc254e55dcc6e8d0a94de0a8a4c 100644 (file)
@@ -738,6 +738,8 @@ usable_st_size (struct stat const *sb)
 
 _Noreturn void usage (int status);
 
+#include "error.h"
+
 /* Like error(0, 0, ...), but without an implicit newline.
    Also a noop unless the global DEV_DEBUG is set.  */
 #define devmsg(...)                    \
index cc2696dabc4b92e5df950f719df1189c338bca80..decf66674fb2994098a657738583f99c7860f9d3 100644 (file)
@@ -18,8 +18,6 @@
 /* FIXME */
 #include "assure.h"
 
-#include "die.h"
-
 /* FIXME: this is small for testing */
 #define BUFFER_SIZE (8)
 
@@ -73,7 +71,7 @@ buf_init_from_stdin (Buf *x, char eol_byte)
         }
       bytes_read = full_read (STDIN_FILENO, buf, BUFFER_SIZE);
       if (bytes_read != buffer_size && errno != 0)
-        die (EXIT_FAILURE, errno, _("read error"));
+        error (EXIT_FAILURE, errno, _("read error"));
 
       {
         struct B_pair bp;
index 1d24f5b57f9cfcdd267a294cc517de9ad4386913..e52d4b7f26d93f95fda37f7ade95fb2769d8cce3 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -43,8 +43,6 @@ tac -r -s '.\|
 
 #include <regex.h>
 
-#include "die.h"
-#include "error.h"
 #include "filenamecat.h"
 #include "safe-read.h"
 #include "stdlib--.h"
@@ -273,7 +271,7 @@ tac_seekable (int input_fd, char const *file, off_t file_pos)
           regoff_t ret;
 
           if (1 < range)
-            die (EXIT_FAILURE, 0, _("record too large"));
+            error (EXIT_FAILURE, 0, _("record too large"));
 
           if (range == 1
               || ((ret = re_search (&compiled_separator, G_buffer,
@@ -281,10 +279,8 @@ tac_seekable (int input_fd, char const *file, off_t file_pos)
                   == -1))
             match_start = G_buffer - 1;
           else if (ret == -2)
-            {
-              die (EXIT_FAILURE, 0,
+            error (EXIT_FAILURE, 0,
                    _("error in regular expression search"));
-            }
           else
             {
               match_start = G_buffer + regs.start[0];
@@ -647,7 +643,7 @@ main (int argc, char **argv)
   if (sentinel_length == 0)
     {
       if (*separator == 0)
-        die (EXIT_FAILURE, 0, _("separator cannot be empty"));
+        error (EXIT_FAILURE, 0, _("separator cannot be empty"));
 
       compiled_separator.buffer = nullptr;
       compiled_separator.allocated = 0;
@@ -656,7 +652,7 @@ main (int argc, char **argv)
       error_message = re_compile_pattern (separator, strlen (separator),
                                           &compiled_separator);
       if (error_message)
-        die (EXIT_FAILURE, 0, "%s", (error_message));
+        error (EXIT_FAILURE, 0, "%s", (error_message));
     }
   else
     match_length = sentinel_length = *separator ? strlen (separator) : 1;
index 6c1b890ccea9607abba4a3666ef1f53ffde47486..db0913652531f0d85ddfc58e695dee43d3bc1939 100644 (file)
@@ -34,8 +34,6 @@
 #include "argmatch.h"
 #include "assure.h"
 #include "cl-strtod.h"
-#include "die.h"
-#include "error.h"
 #include "fcntl--.h"
 #include "iopoll.h"
 #include "isapipe.h"
@@ -415,8 +413,8 @@ xwrite_stdout (char const *buffer, size_t n_bytes)
   if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) < n_bytes)
     {
       clearerr (stdout); /* To avoid redundant close_stdout diagnostic.  */
-      die (EXIT_FAILURE, errno, _("error writing %s"),
-           quoteaf ("standard output"));
+      error (EXIT_FAILURE, errno, _("error writing %s"),
+             quoteaf ("standard output"));
     }
 }
 
@@ -441,8 +439,8 @@ dump_remainder (bool want_header, char const *pretty_filename, int fd,
       if (bytes_read == SAFE_READ_ERROR)
         {
           if (errno != EAGAIN)
-            die (EXIT_FAILURE, errno, _("error reading %s"),
-                 quoteaf (pretty_filename));
+            error (EXIT_FAILURE, errno, _("error reading %s"),
+                   quoteaf (pretty_filename));
           break;
         }
       if (bytes_read == 0)
@@ -1169,9 +1167,9 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
                          the append-only attribute.  */
                     }
                   else
-                    die (EXIT_FAILURE, errno,
-                         _("%s: cannot change nonblocking mode"),
-                         quotef (name));
+                    error (EXIT_FAILURE, errno,
+                           _("%s: cannot change nonblocking mode"),
+                           quotef (name));
                 }
               else
                 f[i].blocking = blocking;
@@ -1265,7 +1263,7 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
         }
 
       if ((!any_input || blocking) && fflush (stdout) != 0)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
 
       check_output_alive ();
 
@@ -1285,7 +1283,7 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
                             && errno != EPERM);
 
           if (!writer_is_dead && xnanosleep (sleep_interval))
-            die (EXIT_FAILURE, errno, _("cannot read realtime clock"));
+            error (EXIT_FAILURE, errno, _("cannot read realtime clock"));
 
         }
     }
@@ -1419,7 +1417,7 @@ check_fspec (struct File_spec *fspec, struct File_spec **prev_fspec)
     {
       *prev_fspec = fspec;
       if (fflush (stdout) != 0)
-        die (EXIT_FAILURE, errno, _("write error"));
+        error (EXIT_FAILURE, errno, _("write error"));
     }
 }
 
@@ -1595,7 +1593,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
       if (follow_mode == Follow_name
           && ! reopen_inaccessible_files
           && hash_get_n_entries (wd_to_name) == 0)
-        die (EXIT_FAILURE, 0, _("no files remaining"));
+        error (EXIT_FAILURE, 0, _("no files remaining"));
 
       if (len <= evbuf_off)
         {
@@ -1637,8 +1635,8 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
           while (file_change == 0);
 
           if (file_change < 0)
-            die (EXIT_FAILURE, errno,
-                 _("error waiting for inotify and output events"));
+            error (EXIT_FAILURE, errno,
+                   _("error waiting for inotify and output events"));
           if (pfd[1].revents)
             die_pipe ();
 
@@ -1657,7 +1655,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
             }
 
           if (len == 0 || len == SAFE_READ_ERROR)
-            die (EXIT_FAILURE, errno, _("error reading inotify event"));
+            error (EXIT_FAILURE, errno, _("error reading inotify event"));
         }
 
       void_ev = evbuf + evbuf_off;
@@ -2121,10 +2119,8 @@ parse_obsolete_option (int argc, char * const *argv, uintmax_t *n_units)
   else if ((xstrtoumax (n_string, nullptr, 10, n_units, "b")
             & ~LONGINT_INVALID_SUFFIX_CHAR)
            != LONGINT_OK)
-    {
-      die (EXIT_FAILURE, errno, "%s: %s", _("invalid number"),
+    error (EXIT_FAILURE, errno, "%s: %s", _("invalid number"),
            quote (argv[1]));
-    }
 
   /* Set globals.  */
   from_start = t_from_start;
@@ -2208,8 +2204,8 @@ parse_options (int argc, char **argv,
           {
             double s;
             if (! (xstrtod (optarg, nullptr, &s, cl_strtod) && 0 <= s))
-              die (EXIT_FAILURE, 0,
-                   _("invalid number of seconds: %s"), quote (optarg));
+              error (EXIT_FAILURE, 0,
+                     _("invalid number of seconds: %s"), quote (optarg));
             *sleep_interval = s;
           }
           break;
@@ -2228,7 +2224,7 @@ parse_options (int argc, char **argv,
 
         case '0': case '1': case '2': case '3': case '4':
         case '5': case '6': case '7': case '8': case '9':
-          die (EXIT_FAILURE, 0, _("option used in invalid context -- %c"), c);
+          error (EXIT_FAILURE, 0, _("option used in invalid context -- %c"), c);
 
         default:
           usage (EXIT_FAILURE);
@@ -2356,7 +2352,7 @@ main (int argc, char **argv)
 
     /* When following by name, there must be a name.  */
     if (found_hyphen && follow_mode == Follow_name)
-      die (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-"));
+      error (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-"));
 
     /* When following forever, and not using simple blocking, warn if
        any file is '-' as the stats() used to check for input are ineffective.
@@ -2399,7 +2395,7 @@ main (int argc, char **argv)
          so that we exit if the reader goes away.  */
       struct stat out_stat;
       if (fstat (STDOUT_FILENO, &out_stat) < 0)
-        die (EXIT_FAILURE, errno, _("standard output"));
+        error (EXIT_FAILURE, errno, _("standard output"));
       monitor_output = (S_ISFIFO (out_stat.st_mode)
                         || (HAVE_FIFO_PIPES != 1 && isapipe (STDOUT_FILENO)));
 
@@ -2458,7 +2454,7 @@ main (int argc, char **argv)
                  tail_forever_inotify flushes only after writing,
                  not before reading.  */
               if (fflush (stdout) != 0)
-                die (EXIT_FAILURE, errno, _("write error"));
+                error (EXIT_FAILURE, errno, _("write error"));
 
               Hash_table *ht;
               tail_forever_inotify (wd, F, n_files, sleep_interval, &ht);
@@ -2474,6 +2470,6 @@ main (int argc, char **argv)
     }
 
   if (have_read_stdin && close (STDIN_FILENO) < 0)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
   main_exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 8d25a956bc0bdb58288fff9a0c1a3f24f0f4611d..27323a3b211617d17d5d01158619271c42f4ed1d 100644 (file)
--- a/src/tee.c
+++ b/src/tee.c
@@ -23,8 +23,6 @@
 
 #include "system.h"
 #include "argmatch.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "iopoll.h"
 #include "stdio--.h"
@@ -178,7 +176,7 @@ main (int argc, char **argv)
 
   bool ok = tee_files (argc - optind, &argv[optind], pipe_check);
   if (close (STDIN_FILENO) != 0)
-    die (EXIT_FAILURE, errno, "%s", _("standard input"));
+    error (EXIT_FAILURE, errno, "%s", _("standard input"));
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index 422220246d94de4d293be2fbc5fd6bd39f338600..76cb6ce85c20fa738a146d4ac49cd3af410f418b 100644 (file)
@@ -59,7 +59,6 @@
 #include "xstrtod.h"
 #include "sig2str.h"
 #include "operand2sig.h"
-#include "error.h"
 #include "quote.h"
 
 #if HAVE_SETRLIMIT
index 7bc199fda8f885c3925e351bae52ece8f4c755d6..ee1977fb2aea557dc063b902d269d9eefff56f9d 100644 (file)
@@ -25,8 +25,6 @@
 #include "system.h"
 #include "argmatch.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fd-reopen.h"
 #include "parse-datetime.h"
 #include "posixtm.h"
@@ -112,7 +110,7 @@ date_relative (char const *flex_date, struct timespec now)
 {
   struct timespec result;
   if (! parse_datetime (&result, flex_date, &now))
-    die (EXIT_FAILURE, 0, _("invalid date format %s"), quote (flex_date));
+    error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (flex_date));
   return result;
 }
 
@@ -311,8 +309,8 @@ main (int argc, char **argv)
         case 't':
           if (! posixtime (&newtime[0].tv_sec, optarg,
                            PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS))
-            die (EXIT_FAILURE, 0, _("invalid date format %s"),
-                 quote (optarg));
+            error (EXIT_FAILURE, 0, _("invalid date format %s"),
+                   quote (optarg));
           newtime[0].tv_nsec = 0;
           newtime[1] = newtime[0];
           date_set = true;
@@ -348,8 +346,8 @@ main (int argc, char **argv)
          might be an object-like macro.  */
       if (no_dereference ? lstat (ref_file, &ref_stats)
           : stat (ref_file, &ref_stats))
-        die (EXIT_FAILURE, errno,
-             _("failed to get attributes of %s"), quoteaf (ref_file));
+        error (EXIT_FAILURE, errno,
+               _("failed to get attributes of %s"), quoteaf (ref_file));
       newtime[0] = get_stat_atime (&ref_stats);
       newtime[1] = get_stat_mtime (&ref_stats);
       date_set = true;
index db669a7d45c2441b8e915a6e59e3967ff62a3ae4..af47021dcfc6bd387a24b9cfe4e4cf536fcc26ad 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -24,8 +24,6 @@
 
 #include "system.h"
 #include "assure.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "quote.h"
 #include "safe-read.h"
@@ -1198,8 +1196,8 @@ validate_case_classes (struct Spec_list *s1, struct Spec_list *s2)
          c1 must also transition at the same time.  */
       if (s2_new_element && class_s2 != UL_NONE
           && !(s1_new_element && class_s1 != UL_NONE))
-        die (EXIT_FAILURE, 0,
-             _("misaligned [:upper:] and/or [:lower:] construct"));
+        error (EXIT_FAILURE, 0,
+               _("misaligned [:upper:] and/or [:lower:] construct"));
 
       /* If case converting, quickly skip over the elements.  */
       if (class_s2 != UL_NONE)
@@ -1303,7 +1301,7 @@ get_spec_stats (struct Spec_list *s)
          indefinite element.  */
       new_length = length + len;
       if (! (length <= new_length && new_length <= REPEAT_COUNT_MAXIMUM))
-        die (EXIT_FAILURE, 0, _("too many characters in set"));
+        error (EXIT_FAILURE, 0, _("too many characters in set"));
       length = new_length;
     }
 
@@ -1386,9 +1384,9 @@ string2_extend (const struct Spec_list *s1, struct Spec_list *s2)
            tr '[:upper:]0-9' '[:lower:]'
          That's not portable however, contradicts POSIX and is dependent
          on your collating sequence.  */
-      die (EXIT_FAILURE, 0,
-           _("when translating with string1 longer than string2,\nthe\
- latter string must not end with a character class"));
+      error (EXIT_FAILURE, 0,
+             _("when translating with string1 longer than string2,\n"
              "the latter string must not end with a character class"));
 
     case RE_REPEATED_CHAR:
       char_to_repeat = p->u.repeated_char.the_repeated_char;
@@ -1441,36 +1439,29 @@ validate (struct Spec_list *s1, struct Spec_list *s2)
 {
   get_s1_spec_stats (s1);
   if (s1->n_indefinite_repeats > 0)
-    {
-      die (EXIT_FAILURE, 0,
+    error (EXIT_FAILURE, 0,
            _("the [c*] repeat construct may not appear in string1"));
-    }
 
   if (s2)
     {
       get_s2_spec_stats (s2, s1->length);
 
       if (s2->n_indefinite_repeats > 1)
-        {
-          die (EXIT_FAILURE, 0,
+        error (EXIT_FAILURE, 0,
                _("only one [c*] repeat construct may appear in string2"));
-        }
 
       if (translating)
         {
           if (s2->has_equiv_class)
-            {
-              die (EXIT_FAILURE, 0,
-                   _("[=c=] expressions may not appear in string2\
- when translating"));
-            }
+            error (EXIT_FAILURE, 0,
+                   _("[=c=] expressions may not appear in string2"
+                     " when translating"));
 
           if (s2->has_restricted_char_class)
-            {
-              die (EXIT_FAILURE, 0,
-                   _("when translating, the only character classes that may\
- appear in\nstring2 are 'upper' and 'lower'"));
-            }
+            error (EXIT_FAILURE, 0,
+                   _("when translating, the only character classes"
+                     " that may appear in\n"
+                     "string2 are 'upper' and 'lower'"));
 
           validate_case_classes (s1, s2);
 
@@ -1482,27 +1473,26 @@ validate (struct Spec_list *s1, struct Spec_list *s2)
                      given or string1 is empty.  */
 
                   if (s2->length == 0)
-                    die (EXIT_FAILURE, 0,
-                     _("when not truncating set1, string2 must be non-empty"));
+                    error (EXIT_FAILURE, 0,
+                           _("when not truncating set1,"
+                             " string2 must be non-empty"));
                   string2_extend (s1, s2);
                 }
             }
 
           if (complement && s1->has_char_class
               && ! (s2->length == s1->length && homogeneous_spec_list (s2)))
-            {
-              die (EXIT_FAILURE, 0,
-                   _("when translating with complemented character classes,\
-\nstring2 must map all characters in the domain to one"));
-            }
+            error (EXIT_FAILURE, 0,
+                   _("when translating with complemented character classes,\n"
+                     "string2 must map all characters in the domain to one"));
         }
       else
         /* Not translating.  */
         {
           if (s2->n_indefinite_repeats > 0)
-            die (EXIT_FAILURE, 0,
-                 _("the [c*] construct may appear in string2 only\
- when translating"));
+            error (EXIT_FAILURE, 0,
+                   _("the [c*] construct may appear in string2"
                    " only when translating"));
         }
     }
 }
@@ -1581,7 +1571,7 @@ squeeze_filter (char *buf, size_t size, size_t (*reader) (char *, size_t))
             }
           if (out_len > 0
               && fwrite (&buf[begin], 1, out_len, stdout) != out_len)
-            die (EXIT_FAILURE, errno, _("write error"));
+            error (EXIT_FAILURE, errno, _("write error"));
         }
 
       if (char_to_squeeze != NOT_A_CHAR)
@@ -1605,7 +1595,7 @@ plain_read (char *buf, size_t size)
 {
   size_t nr = safe_read (STDIN_FILENO, buf, size);
   if (nr == SAFE_READ_ERROR)
-    die (EXIT_FAILURE, errno, _("read error"));
+    error (EXIT_FAILURE, errno, _("read error"));
   return nr;
 }
 
@@ -1807,7 +1797,7 @@ main (int argc, char **argv)
           if (nr == 0)
             break;
           if (fwrite (io_buf, 1, nr, stdout) != nr)
-            die (EXIT_FAILURE, errno, _("write error"));
+            error (EXIT_FAILURE, errno, _("write error"));
         }
     }
   else if (squeeze_repeats && delete && non_option_args == 2)
@@ -1899,13 +1889,13 @@ main (int argc, char **argv)
               if (bytes_read == 0)
                 break;
               if (fwrite (io_buf, 1, bytes_read, stdout) != bytes_read)
-                die (EXIT_FAILURE, errno, _("write error"));
+                error (EXIT_FAILURE, errno, _("write error"));
             }
         }
     }
 
   if (close (STDIN_FILENO) != 0)
-    die (EXIT_FAILURE, errno, _("standard input"));
+    error (EXIT_FAILURE, errno, _("standard input"));
 
   main_exit (EXIT_SUCCESS);
 }
index 07c210ebbd62c116289ea5b89a8612b12d492d4b..967da65edc279a15cbd917bdc70f4344eff1d7d6 100644 (file)
@@ -26,8 +26,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "stat-size.h"
 #include "xdectoint.h"
@@ -273,7 +271,7 @@ main (int argc, char **argv)
                              _("Invalid number"), 0);
           /* Rounding to multiple of 0 is nonsensical */
           if ((rel_mode == rm_rup || rel_mode == rm_rdn) && size == 0)
-            die (EXIT_FAILURE, 0, _("division by zero"));
+            error (EXIT_FAILURE, 0, _("division by zero"));
           got_size = true;
           break;
 
@@ -322,7 +320,7 @@ main (int argc, char **argv)
       struct stat sb;
       off_t file_size = -1;
       if (stat (ref_file, &sb) != 0)
-        die (EXIT_FAILURE, errno, _("cannot stat %s"), quoteaf (ref_file));
+        error (EXIT_FAILURE, errno, _("cannot stat %s"), quoteaf (ref_file));
       if (usable_st_size (&sb))
         file_size = sb.st_size;
       else
@@ -343,8 +341,8 @@ main (int argc, char **argv)
             }
         }
       if (file_size < 0)
-        die (EXIT_FAILURE, errno, _("cannot get the size of %s"),
-             quoteaf (ref_file));
+        error (EXIT_FAILURE, errno, _("cannot get the size of %s"),
+               quoteaf (ref_file));
       if (!got_size)
         size = file_size;
       else
index 8345b5997113c6fa55e9227570827b95a961a0f2..4ee24ba8c4cf8ea5ea33baecaa30ee451ffb6ca4 100644 (file)
@@ -27,8 +27,6 @@
 #include "system.h"
 #include "assure.h"
 #include "long-options.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "readtokens.h"
 #include "stdio--.h"
@@ -441,7 +439,7 @@ tsort (char const *file)
   root = new_item (nullptr);
 
   if (!is_stdin && ! freopen (file, "r", stdin))
-    die (EXIT_FAILURE, errno, "%s", quotef (file));
+    error (EXIT_FAILURE, errno, "%s", quotef (file));
 
   fadvise (stdin, FADVISE_SEQUENTIAL);
 
@@ -454,7 +452,7 @@ tsort (char const *file)
       if (len == (size_t) -1)
         {
           if (ferror (stdin))
-            die (EXIT_FAILURE, errno, _("%s: read error"), quotef (file));
+            error (EXIT_FAILURE, errno, _("%s: read error"), quotef (file));
           break;
         }
 
@@ -472,8 +470,8 @@ tsort (char const *file)
     }
 
   if (k != nullptr)
-    die (EXIT_FAILURE, 0, _("%s: input contains an odd number of tokens"),
-         quotef (file));
+    error (EXIT_FAILURE, 0, _("%s: input contains an odd number of tokens"),
+           quotef (file));
 
   /* T1. Initialize (N <- n).  */
   walk_tree (root, count_items);
@@ -524,8 +522,8 @@ tsort (char const *file)
     }
 
   if (fclose (stdin) != 0)
-    die (EXIT_FAILURE, errno, "%s",
-         is_stdin ? _("standard input") : quotef (file));
+    error (EXIT_FAILURE, errno, "%s",
+           is_stdin ? _("standard input") : quotef (file));
 
   exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
 }
index 5db89515322e1db8a9c3d0a5aa0fe56879702165..641579776bb03454f1d15eee4b7abd477c15d964 100644 (file)
--- a/src/tty.c
+++ b/src/tty.c
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "error.h"
 #include "quote.h"
 
 /* Exit statuses.  */
index 37c3be6ef3f7c98747e6708f8df9b37c9f491628..883b9a490d5157f0bba5c7cf5691dfeac9374413 100644 (file)
@@ -45,8 +45,6 @@
 #endif
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "quote.h"
 #include "uname.h"
 
@@ -299,7 +297,7 @@ main (int argc, char **argv)
       struct utsname name;
 
       if (uname (&name) == -1)
-        die (EXIT_FAILURE, errno, _("cannot get system name"));
+        error (EXIT_FAILURE, errno, _("cannot get system name"));
 
       if (toprint & PRINT_KERNEL_NAME)
         print_element_env (name.sysname, "UNAME_SYSNAME");
index 8dc755990e4cbd93c07f1e8121d5cc059d826d5e..8505a0761954e99a8f61130eb6b084b007656bc0 100644 (file)
@@ -39,8 +39,6 @@
 #include <getopt.h>
 #include <sys/types.h>
 #include "system.h"
-#include "die.h"
-
 #include "expand-common.h"
 
 /* The official name of this program (e.g., no 'g' prefix).  */
@@ -177,7 +175,7 @@ unexpand (void)
                   if (convert)
                     {
                       if (next_tab_column < column)
-                        die (EXIT_FAILURE, 0, _("input line is too long"));
+                        error (EXIT_FAILURE, 0, _("input line is too long"));
 
                       if (c == '\t')
                         {
@@ -222,7 +220,7 @@ unexpand (void)
                 {
                   column++;
                   if (!column)
-                    die (EXIT_FAILURE, 0, _("input line is too long"));
+                    error (EXIT_FAILURE, 0, _("input line is too long"));
                 }
 
               if (pending)
@@ -230,7 +228,7 @@ unexpand (void)
                   if (pending > 1 && one_blank_before_tab_stop)
                     pending_blank[0] = '\t';
                   if (fwrite (pending_blank, 1, pending, stdout) != pending)
-                    die (EXIT_FAILURE, errno, _("write error"));
+                    error (EXIT_FAILURE, errno, _("write error"));
                   pending = 0;
                   one_blank_before_tab_stop = false;
                 }
@@ -246,7 +244,7 @@ unexpand (void)
             }
 
           if (putchar (c) < 0)
-            die (EXIT_FAILURE, errno, _("write error"));
+            error (EXIT_FAILURE, errno, _("write error"));
         }
       while (c != '\n');
     }
@@ -302,7 +300,7 @@ main (int argc, char **argv)
               have_tabval = true;
             }
           if (!DECIMAL_DIGIT_ACCUMULATE (tabval, c - '0', uintmax_t))
-            die (EXIT_FAILURE, 0, _("tab stop value is too large"));
+            error (EXIT_FAILURE, 0, _("tab stop value is too large"));
           break;
         }
     }
index 2b83bccb375f357351befde71ac681fbefd902e2..15611540b564ae96808be14ddfa472fca1f215b5 100644 (file)
@@ -24,8 +24,6 @@
 #include "system.h"
 #include "argmatch.h"
 #include "linebuffer.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "posixver.h"
 #include "stdio--.h"
@@ -243,7 +241,7 @@ size_opt (char const *opt, char const *msgid)
       break;
 
     default:
-      die (EXIT_FAILURE, 0, "%s: %s", opt, _(msgid));
+      error (EXIT_FAILURE, 0, "%s: %s", opt, _(msgid));
     }
 
   return MIN (size, SIZE_MAX);
@@ -324,9 +322,9 @@ check_file (char const *infile, char const *outfile, char delimiter)
   struct linebuffer *thisline, *prevline;
 
   if (! (STREQ (infile, "-") || freopen (infile, "r", stdin)))
-    die (EXIT_FAILURE, errno, "%s", quotef (infile));
+    error (EXIT_FAILURE, errno, "%s", quotef (infile));
   if (! (STREQ (outfile, "-") || freopen (outfile, "w", stdout)))
-    die (EXIT_FAILURE, errno, "%s", quotef (outfile));
+    error (EXIT_FAILURE, errno, "%s", quotef (outfile));
 
   fadvise (stdin, FADVISE_SEQUENTIAL);
 
@@ -423,7 +421,7 @@ check_file (char const *infile, char const *outfile, char delimiter)
           if (match_count == UINTMAX_MAX)
             {
               if (count_occurrences)
-                die (EXIT_FAILURE, 0, _("too many repeated lines"));
+                error (EXIT_FAILURE, 0, _("too many repeated lines"));
               match_count--;
             }
 
@@ -459,7 +457,7 @@ check_file (char const *infile, char const *outfile, char delimiter)
 
  closefiles:
   if (ferror (stdin) || fclose (stdin) != 0)
-    die (EXIT_FAILURE, errno, _("error reading %s"), quoteaf (infile));
+    error (EXIT_FAILURE, errno, _("error reading %s"), quoteaf (infile));
 
   /* stdout is handled via the atexit-invoked close_stdout function.  */
 
index 0178de76ae5c23935a103197b29a835ff7ebff84..3bf7a427840af227286ac55211a5906120ce393e 100644 (file)
@@ -25,8 +25,6 @@
 #include <sys/types.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 
@@ -82,7 +80,7 @@ main (int argc, char **argv)
     }
 
   if (unlink (argv[optind]) != 0)
-    die (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (argv[optind]));
+    error (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (argv[optind]));
 
   return EXIT_SUCCESS;
 }
index f660db81ba8e8193e943d1d8b04ceba6b2265da8..bc31026c0e7f7aa1cf781c3e1046807e5ccca624 100644 (file)
@@ -31,8 +31,6 @@
 #endif
 
 #include "c-strtod.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 #include "readutmp.h"
@@ -123,7 +121,7 @@ print_uptime (size_t n, const STRUCT_UTMP *this)
 #endif
     {
       if (boot_time == 0)
-        die (EXIT_FAILURE, errno, _("couldn't get boot time"));
+        error (EXIT_FAILURE, errno, _("couldn't get boot time"));
       uptime = time_now - boot_time;
     }
   updays = uptime / 86400;
@@ -181,7 +179,7 @@ uptime (char const *filename, int options)
 
 #if HAVE_STRUCT_UTMP_UT_TYPE || HAVE_STRUCT_UTMPX_UT_TYPE
   if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (filename));
+    error (EXIT_FAILURE, errno, "%s", quotef (filename));
 #endif
 
   print_uptime (n_users, utmp_buf);
index 6607384ba4f3ff3ec989cee3c80d998380b3f889..e14f3fc3e7adb36635a1dc8c97f3575d7c231f81 100644 (file)
@@ -22,8 +22,6 @@
 #include <sys/types.h>
 #include "system.h"
 
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 #include "readutmp.h"
@@ -88,7 +86,7 @@ users (char const *filename, int options)
   STRUCT_UTMP *utmp_buf;
 
   if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (filename));
+    error (EXIT_FAILURE, errno, "%s", quotef (filename));
 
   list_entries_users (n_users, utmp_buf);
 
index 318fcaa3d13f0bb7615d342e50e0d93988302065..1330734d51c7ccf00d584d43200671bab3867acd 100644 (file)
--- a/src/wc.c
+++ b/src/wc.c
@@ -29,8 +29,6 @@
 #include "assure.h"
 #include "argmatch.h"
 #include "argv-iter.h"
-#include "die.h"
-#include "error.h"
 #include "fadvise.h"
 #include "mbchar.h"
 #include "physmem.h"
@@ -874,8 +872,8 @@ main (int argc, char **argv)
         {
           stream = fopen (files_from, "r");
           if (stream == nullptr)
-            die (EXIT_FAILURE, errno, _("cannot open %s for reading"),
-                 quoteaf (files_from));
+            error (EXIT_FAILURE, errno, _("cannot open %s for reading"),
+                   quoteaf (files_from));
         }
 
       /* Read the file list into RAM if we can detect its size and that
@@ -888,8 +886,8 @@ main (int argc, char **argv)
           read_tokens = true;
           readtokens0_init (&tok);
           if (! readtokens0 (stream, &tok) || fclose (stream) != 0)
-            die (EXIT_FAILURE, 0, _("cannot read file names from %s"),
-                 quoteaf (files_from));
+            error (EXIT_FAILURE, 0, _("cannot read file names from %s"),
+                   quoteaf (files_from));
           files = tok.tok;
           nfiles = tok.n_tok;
           ai = argv_iter_init_argv (files);
@@ -1028,7 +1026,7 @@ main (int argc, char **argv)
   free (fstatus);
 
   if (have_read_stdin && close (STDIN_FILENO) != 0)
-    die (EXIT_FAILURE, errno, "-");
+    error (EXIT_FAILURE, errno, "-");
 
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
index 3ff0c41b76592df327e1e70b5396b770fc582a9f..eff7972b4e44f3d90f666c4d27d101df45129c7f 100644 (file)
@@ -17,7 +17,6 @@
 #include <config.h>
 
 #include "system.h"
-#include "error.h"
 #include "safe-read.h"
 
 #include <x86intrin.h>
index a8a3a8ba1577a20a749b3671110df499d8dd80b1..362408a42b7c9600d1f26348193746a805754207 100644 (file)
--- a/src/who.c
+++ b/src/who.c
@@ -33,8 +33,6 @@
 #include "c-ctype.h"
 #include "canon-host.h"
 #include "readutmp.h"
-#include "die.h"
-#include "error.h"
 #include "hard-locale.h"
 #include "quote.h"
 
@@ -623,7 +621,7 @@ who (char const *filename, int options)
   STRUCT_UTMP *utmp_buf;
 
   if (read_utmp (filename, &n_users, &utmp_buf, options) != 0)
-    die (EXIT_FAILURE, errno, "%s", quotef (filename));
+    error (EXIT_FAILURE, errno, "%s", quotef (filename));
 
   if (short_list)
     list_entries_who (n_users, utmp_buf);
index 85e7be5de7795555f655b70db777cf00c32681ba..e7a578a58d37865a8ee9ff46d6fd357443800401 100644 (file)
@@ -24,8 +24,6 @@
 #include <pwd.h>
 
 #include "system.h"
-#include "die.h"
-#include "error.h"
 #include "long-options.h"
 #include "quote.h"
 
@@ -83,8 +81,8 @@ main (int argc, char **argv)
   uid = geteuid ();
   pw = uid == NO_UID && errno ? nullptr : getpwuid (uid);
   if (!pw)
-    die (EXIT_FAILURE, errno, _("cannot find name for user ID %lu"),
-         (unsigned long int) uid);
+    error (EXIT_FAILURE, errno, _("cannot find name for user ID %lu"),
+           (unsigned long int) uid);
   puts (pw->pw_name);
   return EXIT_SUCCESS;
 }
index 38ebaa88ccaa8da9a074337c750bba0ad823f5d8..207b407a06d417215c69fb4258368a3ffe0d69cc 100644 (file)
--- a/src/yes.c
+++ b/src/yes.c
@@ -22,7 +22,6 @@
 
 #include "system.h"
 
-#include "error.h"
 #include "full-write.h"
 #include "long-options.h"