+
+static struct fmttab {
+ char const *name;
+ enum archive_format fmt;
+} const fmttab[] = {
+ { "v7", V7_FORMAT },
+ { "oldgnu", OLDGNU_FORMAT },
+ { "posix", POSIX_FORMAT },
+#if 0 /* not fully supported yet */
+ { "star", STAR_FORMAT },
+#endif
+ { "gnu", GNU_FORMAT },
+ { NULL, 0 }
+};
+
+static void
+set_archive_format (char const *name)
+{
+ struct fmttab const *p;
+
+ for (p = fmttab; strcmp (p->name, name) != 0; )
+ if (! (++p)->name)
+ USAGE_ERROR ((0, 0, _("%s: Invalid archive format"),
+ quotearg_colon (name)));
+
+ if (archive_format != DEFAULT_FORMAT && archive_format != p->fmt)
+ USAGE_ERROR ((0, 0, _("Conflicting archive format options")));
+
+ archive_format = p->fmt;
+}
+
+static const char *
+archive_format_string (enum archive_format fmt)
+{
+ struct fmttab const *p;
+
+ for (p = fmttab; p->name; p++)
+ if (p->fmt == fmt)
+ return p->name;
+ return "unknown?";
+}
+