#include <argmatch.h>
#include <argp.h>
#include <argcv.h>
-#include <getdate.h>
-#include <utimens.h>
+#include <parse-datetime.h>
#include <inttostr.h>
#include <fcntl.h>
#include <sys/stat.h>
break;
case OPT_DATE:
- if (!get_date (&touch_time, arg, NULL))
+ if (! parse_datetime (&touch_time, arg, NULL))
argp_error (state, _("Unknown date format"));
break;
printf ("%lu", (unsigned long) st.st_ino);
else if (strncmp (p, "mode", 4) == 0)
{
- mode_t mask = ~0;
+ unsigned val = st.st_mode;
if (ispunct ((unsigned char) p[4]))
{
char *q;
- mask = strtoul (p + 5, &q, 8);
+ val &= strtoul (p + 5, &q, 8);
if (*q)
{
printf ("\n");
printf ("\n");
error (EXIT_FAILURE, 0, _("Unknown field `%s'"), p);
}
- printf ("%0o", st.st_mode & mask);
+ printf ("%0o", val);
}
else if (strcmp (p, "nlink") == 0)
printf ("%lu", (unsigned long) st.st_nlink);
struct timespec ts[2];
ts[0] = ts[1] = p->ts;
- if (utimens (p->name, ts) != 0)
+ if (utimensat (AT_FDCWD, p->name, ts, 0) != 0)
{
error (0, errno, _("cannot set time on `%s'"), p->name);
break;
if (unlink (p->name))
error (0, errno, _("cannot unlink `%s'"), p->name);
break;
-
+
default:
abort ();
}
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
- get_date (&touch_time, "now", NULL);
+ parse_datetime (&touch_time, "now", NULL);
/* Decode command options. */