summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-07-25 13:06:31 +0000
committerJim Meyering <jim@meyering.net>2000-07-25 13:06:31 +0000
commitc0186d3cbb88f5b22c23e3e96e2432d6e8406de9 (patch)
treedfacfbbd54a173ec156d2e7a1cb11d4c49daa31b
parent289dacfa49deca7961442c40d24189de057f7bb5 (diff)
downloadcoreutils-c0186d3cbb88f5b22c23e3e96e2432d6e8406de9.tar.xz
Convert "`%s'" in format strings to "%s", and wrap each
corresponding argument in a `quote (...)' call. Add more precise diagnostics.
-rw-r--r--src/touch.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/touch.c b/src/touch.c
index 7d017a5b8..8fcbb5b78 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -28,6 +28,7 @@
#include "error.h"
#include "getdate.h"
#include "posixtm.h"
+#include "quote.h"
#include "safe-read.h"
/* The official name of this program (e.g., no `g' prefix). */
@@ -149,7 +150,10 @@ touch (const char *file)
or FILE is inaccessible or a directory, so we have to use stat. */
if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))
{
- error (0, open_errno ? open_errno : errno, "%s", file);
+ if (open_errno)
+ error (0, open_errno, _("creating %s"), quote (file));
+ else
+ error (0, errno, _("obtaining attributes of %s"), quote (file));
close (fd);
return 1;
}
@@ -157,7 +161,7 @@ touch (const char *file)
if (fd != -1 && close (fd) < 0)
{
- error (0, errno, "%s", file);
+ error (0, errno, _("creating %s"), quote (file));
return 1;
}
@@ -194,7 +198,10 @@ touch (const char *file)
if (status)
{
- error (0, open_errno ? open_errno : errno, "%s", file);
+ if (open_errno)
+ error (0, open_errno, _("creating %s"), quote (file));
+ else
+ error (0, errno, _("setting times of %s"), quote (file));
return 1;
}
@@ -271,7 +278,7 @@ main (int argc, char **argv)
flexible_date++;
newtime = get_date (optarg, NULL);
if (newtime == (time_t) -1)
- error (1, 0, _("invalid date format `%s'"), optarg);
+ error (1, 0, _("invalid date format %s"), quote (optarg));
date_set++;
break;
@@ -292,7 +299,7 @@ main (int argc, char **argv)
newtime = posixtime (optarg,
PDS_LEADING_YEAR | PDS_CENTURY | PDS_SECONDS);
if (newtime == (time_t) -1)
- error (1, 0, _("invalid date format `%s'"), optarg);
+ error (1, 0, _("invalid date format %s"), quote (optarg));
date_set++;
break;
@@ -323,7 +330,7 @@ main (int argc, char **argv)
if (use_ref)
{
if (stat (ref_file, &ref_stats))
- error (1, errno, "%s", ref_file);
+ error (1, errno, _("obtaining attributes of %s"), quote (ref_file));
date_set++;
}