char *ebuf;
int n;
long lineno = 1;
- unsigned long u = (errno = 0, strtoul (buf, &ebuf, 10));
+ uintmax_t u = (errno = 0, strtoumax (buf, &ebuf, 10));
time_t t = u;
+
if (buf == ebuf || (u == 0 && errno == EINVAL))
ERROR ((0, 0, "%s:1: %s", quotearg_colon (listed_incremental_option),
_("Invalid time stamp")));
- else if (t != u || (u == -1 && errno == ERANGE))
+ else if (t != u)
ERROR ((0, 0, "%s:1: %s", quotearg_colon (listed_incremental_option),
_("Time stamp out of range")));
else
{
+ /* FIXME: This should also input nanoseconds, but that will be a
+ change in file format. */
newer_mtime_option.tv_sec = t;
newer_mtime_option.tv_nsec = 0;
}
buf[n - 1] = '\0';
errno = 0;
- dev = u = strtoul (strp, &ebuf, 10);
- if (strp == ebuf || (u == 0 && errno == EINVAL))
+ dev = u = strtoumax (strp, &ebuf, 10);
+ if (!isspace (*ebuf))
ERROR ((0, 0, "%s:%ld: %s",
quotearg_colon (listed_incremental_option), lineno,
_("Invalid device number")));
- else if (dev != u || (u == -1 && errno == ERANGE))
+ else if (dev != u)
ERROR ((0, 0, "%s:%ld: %s",
quotearg_colon (listed_incremental_option), lineno,
_("Device number out of range")));
strp = ebuf;
errno = 0;
- ino = u = strtoul (strp, &ebuf, 10);
- if (strp == ebuf || (u == 0 && errno == EINVAL))
+ ino = u = strtoumax (strp, &ebuf, 10);
+ if (!isspace (*ebuf))
ERROR ((0, 0, "%s:%ld: %s",
quotearg_colon (listed_incremental_option), lineno,
_("Invalid inode number")));
- else if (ino != u || (u == -1 && errno == ERANGE))
+ else if (ino != u)
ERROR ((0, 0, "%s:%ld: %s",
quotearg_colon (listed_incremental_option), lineno,
_("Inode number out of range")));
if (directory->found)
{
int e;
+ char buf[UINTMAX_STRSIZE_BOUND];
char *str = quote_copy_string (directory->name);
- fprintf (fp, "+%lu %lu %s\n" + ! directory->nfs,
- (unsigned long) directory->device_number,
- (unsigned long) directory->inode_number,
- str ? str : directory->name);
+
+ if (directory->nfs)
+ fprintf (fp, "+");
+ fprintf (fp, "%s ", umaxtostr (directory->device_number, buf));
+ fprintf (fp, "%s ", umaxtostr (directory->inode_number, buf));
+ fprintf (fp, "%s\n", str ? str : directory->name);
+
e = errno;
if (str)
free (str);
if (sys_truncate (fileno (fp)) != 0)
truncate_error (listed_incremental_option);
- fprintf (fp, "%lu\n", (unsigned long) start_time);
+ /* FIXME: This should also output nanoseconds, but that will be a
+ change in file format. */
+ fprintf (fp, "%lu\n", (unsigned long int) start_time.tv_sec);
if (! ferror (fp) && directory_table)
hash_do_for_each (directory_table, write_directory_file_entry, fp);
if (ferror (fp))
struct stat st;
char *p = new_name (directory_name, cur);
- if (deref_stat (true, p, &st))
+ if (deref_stat (false, p, &st))
{
stat_diag (p);
WARN((0, 0, _("%s: Not purging directory: unable to stat"),
free (current_dir);
free (archive_dir);
}
+
+void
+list_dumpdir (char *buffer, size_t size)
+{
+ while (size)
+ {
+ switch (*buffer)
+ {
+ case 'Y':
+ case 'N':
+ case 'D':
+ fprintf (stdlis, "%c ", *buffer);
+ buffer++;
+ size--;
+ break;
+
+ case 0:
+ fputc ('\n', stdlis);
+ buffer++;
+ size--;
+ break;
+
+ default:
+ fputc (*buffer, stdlis);
+ buffer++;
+ size--;
+ }
+ }
+}