summaryrefslogtreecommitdiff
path: root/src/tac.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-10-28 13:02:31 +0000
committerPádraig Brady <P@draigBrady.com>2015-11-04 02:03:41 +0000
commitab40a941a07d80326aaa051e3c94c88b800cbd7d (patch)
tree382e656f126d0e63ca1158f8f43630e1dd10d18b /src/tac.c
parent00eb7af8ea30ccbefeb17213cd644b8f0ade1ef8 (diff)
downloadcoreutils-ab40a941a07d80326aaa051e3c94c88b800cbd7d.tar.xz
all: replace most uses of quotearg_colon() with quote()
Related to commit v8.24-61-g6796698 this provides more consistent quoting, as quotearg_colon() defaults to "literal" quoting by default, while quote() provides appropriate quoting for diagnostics by default. * gl/modules/randread: Depend on quote module rather than quotearg. * gl/lib/randread.c: Used quote() not quotearg_colon(). * src/: Likewise. * src/shred.c: Likewise. Also avoid unnecessary quoting introducing overhead when wiping names. * cfg.mk: Relax the matching expression to allow "qname" variables as used in shred.c to satisfy the check. * tests/: Adjust accordingly.
Diffstat (limited to 'src/tac.c')
-rw-r--r--src/tac.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/tac.c b/src/tac.c
index 1029de63b..a260b7bad 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -46,7 +46,6 @@ tac -r -s '.\|
#include "error.h"
#include "filenamecat.h"
#include "quote.h"
-#include "quotearg.h"
#include "safe-read.h"
#include "stdlib--.h"
#include "xfreopen.h"
@@ -221,7 +220,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
{
file_pos -= remainder;
if (lseek (input_fd, file_pos, SEEK_SET) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
}
/* Scan backward, looking for end of file. This caters to proc-like
@@ -231,7 +230,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
{
off_t rsize = read_size;
if (lseek (input_fd, -rsize, SEEK_CUR) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
file_pos -= read_size;
}
@@ -249,7 +248,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
if (saved_record_size == SAFE_READ_ERROR)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
return false;
}
@@ -341,7 +340,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
file_pos = 0;
}
if (lseek (input_fd, file_pos, SEEK_SET) < 0)
- error (0, errno, _("%s: seek failed"), quotearg_colon (file));
+ error (0, errno, _("%s: seek failed"), quote (file));
/* Shift the pending record data right to make room for the new.
The source and destination regions probably overlap. */
@@ -355,7 +354,7 @@ tac_seekable (int input_fd, const char *file, off_t file_pos)
if (safe_read (input_fd, G_buffer, read_size) != read_size)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
return false;
}
}
@@ -512,13 +511,13 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
break;
if (bytes_read == SAFE_READ_ERROR)
{
- error (0, errno, _("%s: read error"), quotearg_colon (file));
+ error (0, errno, _("%s: read error"), quote (file));
goto Fail;
}
if (fwrite (G_buffer, 1, bytes_read, fp) != bytes_read)
{
- error (0, errno, _("%s: write error"), quotearg_colon (file_name));
+ error (0, errno, _("%s: write error"), quote (file_name));
goto Fail;
}
@@ -530,7 +529,7 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
if (fflush (fp) != 0)
{
- error (0, errno, _("%s: write error"), quotearg_colon (file_name));
+ error (0, errno, _("%s: write error"), quote (file_name));
goto Fail;
}
@@ -598,7 +597,7 @@ tac_file (const char *filename)
if (!is_stdin && close (fd) != 0)
{
- error (0, errno, _("%s: read error"), quotearg_colon (filename));
+ error (0, errno, _("%s: read error"), quote (filename));
ok = false;
}
return ok;