+}
+
+/* Read from file FP a nul-terminated string and convert it to
+ uintmax_t. Return the resulting value in PVAL.
+
+ Throw a fatal error if the string cannot be converted or if the
+ converted value exceeds MAX_VAL.
+
+ Return the last character read or EOF on end of file. */
+
+static int
+read_num (FILE *fp, uintmax_t max_val, uintmax_t *pval)
+{
+ return read_unsigned_num (getc (fp), fp, max_val, pval);
+}
+
+/* Read from FP two NUL-terminated strings representing a struct
+ timespec. Return the resulting value in PVAL.
+
+ Throw a fatal error if the string cannot be converted. */
+
+static void
+read_timespec (FILE *fp, struct timespec *pval)
+{
+ int c = getc (fp);
+ intmax_t i;
+ uintmax_t u;
+
+ if (c == '-')
+ {
+ read_negative_num (fp, TYPE_MINIMUM (time_t), &i);
+ c = 0;
+ pval->tv_sec = i;
+ }
+ else
+ {
+ c = read_unsigned_num (c, fp, TYPE_MAXIMUM (time_t), &u);
+ pval->tv_sec = u;
+ }
+
+ if (c || read_num (fp, BILLION - 1, &u))
+ FATAL_ERROR ((0, 0, "%s: %s",
+ quotearg_colon (listed_incremental_option),
+ _("Unexpected EOF in snapshot file")));
+ pval->tv_nsec = u;
+}