From: jca Date: Wed, 17 Apr 2024 18:12:12 +0000 (+0000) Subject: Provide a pax format specific option handler X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8df76133309eacd4092b091ee0504adb842322a5;p=openbsd Provide a pax format specific option handler The existing tar_opt() implements support for -o write_opt=nodir for the old tar and ustar formats. We don't really want to support it for the pax format, and we want to be able to implement pax format specific options (even if there are none right now). ok millert@ --- diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 6e7031ab18d..c9358dd0b8b 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.63 2024/04/16 18:52:43 jca Exp $ */ +/* $OpenBSD: extern.h,v 1.64 2024/04/17 18:12:12 jca Exp $ */ /* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */ /*- @@ -285,6 +285,7 @@ int ustar_id(char *, int); int ustar_rd(ARCHD *, char *); int ustar_wr(ARCHD *); int pax_id(char *, int); +int pax_opt(void); int pax_wr(ARCHD *); /* diff --git a/bin/pax/options.c b/bin/pax/options.c index 663aea207f4..2e9960168fd 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.113 2024/04/17 10:19:17 jca Exp $ */ +/* $OpenBSD: options.c,v 1.114 2024/04/17 18:12:12 jca Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -230,7 +230,7 @@ FSUB fsub[] = { /* 10: POSIX PAX */ {"pax", 5120, BLKMULT, 0, 1, BLKMULT, 0, pax_id, no_op, ustar_rd, tar_endrd, no_op, pax_wr, tar_endwr, tar_trail, - tar_opt}, + pax_opt}, #endif }; #define F_OCPIO 0 /* format when called as cpio -6 */ diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 01f4491ac6b..ef22a9fd2d8 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tar.c,v 1.84 2024/04/16 22:58:10 jca Exp $ */ +/* $OpenBSD: tar.c,v 1.85 2024/04/17 18:12:12 jca Exp $ */ /* $NetBSD: tar.c,v 1.5 1995/03/21 09:07:49 cgd Exp $ */ /*- @@ -1447,6 +1447,29 @@ pax_wr(ARCHD *arcn) } #endif +/* + * pax_opt() + * handle pax format specific -o options + * Return: + * 0 if ok -1 otherwise + */ +#ifndef SMALL +int +pax_opt(void) +{ + OPLIST *opt; + + while ((opt = opt_next()) != NULL) { + if (1) { + paxwarn(1, "Unknown pax format -o option/value pair %s=%s", + opt->name, opt->value); + return(-1); + } + } + return 0; +} +#endif + /* * name_split() * see if the name has to be split for storage in a ustar header. We try