+ if (digs != 0 && *where && !ISSPACE ((unsigned char) *where))
+ {
+ if (type)
+ {
+ char buf[1000]; /* Big enough to represent any header. */
+ static struct quoting_options *o;
+
+ if (!o)
+ {
+ o = clone_quoting_options ((struct quoting_options *) 0);
+ set_quoting_style (o, c_quoting_style);
+ }
+
+ for (digs = digs0; digs && ! where0[digs - 1]; digs--)
+ continue;
+ quotearg_buffer (buf, sizeof buf, where0, digs, o);
+ ERROR ((0, 0,
+ _("Header contains %.*s where octal %s value expected"),
+ (int) sizeof buf, buf, type));
+ }
+
+ return -1;
+ }
+
+ if (value <= maxval)
+ return value;
+
+ out_of_range:
+ if (type)
+ ERROR ((0, 0, _("Octal value `%.*s' is out of range for %s"),
+ (int) digs0, where0, type));
+ return -1;
+}
+gid_t
+gid_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "gid_t", (uintmax_t) TYPE_MAXIMUM (gid_t));
+}
+major_t
+major_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "major_t", (uintmax_t) TYPE_MAXIMUM (major_t));
+}
+minor_t
+minor_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "minor_t", (uintmax_t) TYPE_MAXIMUM (minor_t));
+}
+mode_t
+mode_from_oct (const char *p, size_t s)
+{
+ /* Do not complain about unrecognized mode bits. */
+ unsigned u = from_oct (p, s, "mode_t", TYPE_MAXIMUM (uintmax_t));
+ return ((u & TSUID ? S_ISUID : 0)
+ | (u & TSGID ? S_ISGID : 0)
+ | (u & TSVTX ? S_ISVTX : 0)
+ | (u & TUREAD ? S_IRUSR : 0)
+ | (u & TUWRITE ? S_IWUSR : 0)
+ | (u & TUEXEC ? S_IXUSR : 0)
+ | (u & TGREAD ? S_IRGRP : 0)
+ | (u & TGWRITE ? S_IWGRP : 0)
+ | (u & TGEXEC ? S_IXGRP : 0)
+ | (u & TOREAD ? S_IROTH : 0)
+ | (u & TOWRITE ? S_IWOTH : 0)
+ | (u & TOEXEC ? S_IXOTH : 0));
+}
+off_t
+off_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "off_t", (uintmax_t) TYPE_MAXIMUM (off_t));
+}
+size_t
+size_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "size_t", (uintmax_t) TYPE_MAXIMUM (size_t));
+}
+time_t
+time_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "time_t", (uintmax_t) TYPE_MAXIMUM (time_t));
+}
+uid_t
+uid_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "uid_t", (uintmax_t) TYPE_MAXIMUM (uid_t));
+}
+uintmax_t
+uintmax_from_oct (const char *p, size_t s)
+{
+ return from_oct (p, s, "uintmax_t", TYPE_MAXIMUM (uintmax_t));
+}
+
+
+
+/*----------------------------------------------------------------------.
+| Format O as a null-terminated decimal string into BUF _backwards_; |
+| return pointer to start of result. |
+`----------------------------------------------------------------------*/
+char *
+stringify_uintmax_t_backwards (uintmax_t o, char *buf)
+{
+ *--buf = '\0';
+ do
+ *--buf = '0' + (int) (o % 10);
+ while ((o /= 10) != 0);
+ return buf;
+}
+
+#if !USE_OLD_CTIME