[Midnightbsd-cvs] src [11193] trunk/bin/pax: add o flag
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jul 1 11:47:35 EDT 2018
Revision: 11193
http://svnweb.midnightbsd.org/src/?rev=11193
Author: laffer1
Date: 2018-07-01 11:47:35 -0400 (Sun, 01 Jul 2018)
Log Message:
-----------
add o flag
Modified Paths:
--------------
trunk/bin/pax/getoldopt.c
trunk/bin/pax/options.c
trunk/bin/pax/pat_rep.c
trunk/bin/pax/pax.c
trunk/bin/pax/sel_subs.c
Modified: trunk/bin/pax/getoldopt.c
===================================================================
--- trunk/bin/pax/getoldopt.c 2018-07-01 15:44:56 UTC (rev 11192)
+++ trunk/bin/pax/getoldopt.c 2018-07-01 15:47:35 UTC (rev 11193)
@@ -19,8 +19,7 @@
#include <string.h>
#include <unistd.h>
-#include "pax.h"
-#include "extern.h"
+int getoldopt(int, char **, const char *);
int
getoldopt(int argc, char **argv, const char *optstring)
Modified: trunk/bin/pax/options.c
===================================================================
--- trunk/bin/pax/options.c 2018-07-01 15:44:56 UTC (rev 11192)
+++ trunk/bin/pax/options.c 2018-07-01 15:47:35 UTC (rev 11193)
@@ -81,6 +81,7 @@
#define GETLINE_OUT_OF_MEM 2
static int getline_error;
+char *chdname;
#define GZIP_CMD "gzip" /* command to run as gzip */
#define COMPRESS_CMD "compress" /* command to run as compress */
@@ -193,7 +194,7 @@
/*
* process option flags
*/
- while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ"))
+ while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLOPT:U:XYZ"))
!= -1) {
switch (c) {
case 'a':
@@ -446,6 +447,12 @@
Lflag = 1;
flg |= CLF;
break;
+ case 'O':
+ /*
+ * Force one volume. Non standard option.
+ */
+ Oflag = 1;
+ break;
case 'P':
/*
* do NOT follow symlinks (default)
@@ -583,7 +590,7 @@
{
int c;
int fstdin = 0;
- int Oflag = 0;
+ int tar_Oflag = 0;
int nincfiles = 0;
int incfiles_max = 0;
struct incfile {
@@ -663,7 +670,7 @@
if (opt_add("write_opt=nodir") < 0)
tar_usage();
case 'O':
- Oflag = 1;
+ tar_Oflag = 1;
break;
case 'p':
/*
@@ -819,8 +826,8 @@
* (unless -o specified)
*/
if (act == ARCHIVE || act == APPND)
- frmt = &(fsub[Oflag ? F_OTAR : F_TAR]);
- else if (Oflag) {
+ frmt = &(fsub[tar_Oflag ? F_OTAR : F_TAR]);
+ else if (tar_Oflag) {
paxwarn(1, "The -O/-o options are only valid when writing an archive");
tar_usage(); /* only valid when writing */
}
@@ -1523,18 +1530,18 @@
void
pax_usage(void)
{
- (void)fputs("usage: pax [-cdnvz] [-E limit] [-f archive] ", stderr);
+ (void)fputs("usage: pax [-cdnOvz] [-E limit] [-f archive] ", stderr);
(void)fputs("[-s replstr] ... [-U user] ...", stderr);
(void)fputs("\n [-G group] ... ", stderr);
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
(void)fputs("[pattern ...]\n", stderr);
- (void)fputs(" pax -r [-cdiknuvzDYZ] [-E limit] ", stderr);
+ (void)fputs(" pax -r [-cdiknOuvzDYZ] [-E limit] ", stderr);
(void)fputs("[-f archive] [-o options] ... \n", stderr);
(void)fputs(" [-p string] ... [-s replstr] ... ", stderr);
(void)fputs("[-U user] ... [-G group] ...\n ", stderr);
(void)fputs("[-T [from_date][,to_date]] ... ", stderr);
(void)fputs(" [pattern ...]\n", stderr);
- (void)fputs(" pax -w [-dituvzHLPX] [-b blocksize] ", stderr);
+ (void)fputs(" pax -w [-dituvzHLOPX] [-b blocksize] ", stderr);
(void)fputs("[ [-a] [-f archive] ] [-x format] \n", stderr);
(void)fputs(" [-B bytes] [-s replstr] ... ", stderr);
(void)fputs("[-o options] ... [-U user] ...", stderr);
@@ -1541,7 +1548,7 @@
(void)fputs("\n [-G group] ... ", stderr);
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
(void)fputs("[file ...]\n", stderr);
- (void)fputs(" pax -r -w [-diklntuvDHLPXYZ] ", stderr);
+ (void)fputs(" pax -r -w [-diklntuvDHLOPXYZ] ", stderr);
(void)fputs("[-p string] ... [-s replstr] ...", stderr);
(void)fputs("\n [-U user] ... [-G group] ... ", stderr);
(void)fputs("[-T [from_date][,to_date][/[c][m]]] ... ", stderr);
Modified: trunk/bin/pax/pat_rep.c
===================================================================
--- trunk/bin/pax/pat_rep.c 2018-07-01 15:44:56 UTC (rev 11192)
+++ trunk/bin/pax/pat_rep.c 2018-07-01 15:47:35 UTC (rev 11193)
@@ -43,9 +43,7 @@
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
#ifdef NET2_REGEX
#include <regexp.h>
#else
@@ -880,7 +878,7 @@
* (the user already saw that substitution go by)
*/
pt = rephead;
- (void)strcpy(buf1, name);
+ (void)strlcpy(buf1, name, sizeof(buf1));
inpt = buf1;
outpt = nname;
endpt = outpt + PAXPATHLEN;
Modified: trunk/bin/pax/pax.c
===================================================================
--- trunk/bin/pax/pax.c 2018-07-01 15:44:56 UTC (rev 11192)
+++ trunk/bin/pax/pax.c 2018-07-01 15:47:35 UTC (rev 11193)
@@ -58,7 +58,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include "pax.h"
#include "extern.h"
static int gen_init(void);
@@ -85,6 +84,7 @@
int Dflag; /* same as uflag except inode change time */
int Hflag; /* follow command line symlinks (write only) */
int Lflag; /* follow symlinks when writing */
+int Oflag; /* limit to single volume */
int Xflag; /* archive files with same device id only */
int Yflag; /* same as Dflg except after name mode */
int Zflag; /* same as uflg except after name mode */
Modified: trunk/bin/pax/sel_subs.c
===================================================================
--- trunk/bin/pax/sel_subs.c 2018-07-01 15:44:56 UTC (rev 11192)
+++ trunk/bin/pax/sel_subs.c 2018-07-01 15:47:35 UTC (rev 11193)
@@ -47,7 +47,6 @@
#include <stdio.h>
#include <string.h>
#include <strings.h>
-#include <unistd.h>
#include <stdlib.h>
#include "pax.h"
#include "sel_subs.h"
More information about the Midnightbsd-cvs
mailing list