add a new -p subflag: 'f' to preserve 4.4BSD fileflags. this only
really works for `pax -rw' but that's where it is most useful.
This commit is contained in:
parent
d2827a09c0
commit
b60cafe2fb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.19 1999/10/22 20:59:08 is Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.20 1999/11/01 01:35:58 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -143,6 +143,7 @@ int chk_path __P((char *, uid_t, gid_t));
|
||||
void set_ftime __P((char *fnm, time_t mtime, time_t atime, int frc));
|
||||
int set_ids __P((char *, uid_t, gid_t));
|
||||
void set_pmode __P((char *, mode_t));
|
||||
void set_chflags __P((char *fnm, u_int32_t flags));
|
||||
int file_write __P((int, char *, int, int *, int *, int, char *));
|
||||
void file_flush __P((int, char *, int));
|
||||
void rdfile_close __P((ARCHD *, int *));
|
||||
@ -225,6 +226,7 @@ extern int Zflag;
|
||||
extern int vfpart;
|
||||
extern int patime;
|
||||
extern int pmtime;
|
||||
extern int pfflags;
|
||||
extern int pmode;
|
||||
extern int pids;
|
||||
extern int exit_val;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file_subs.c,v 1.12 1999/10/22 10:43:11 mrg Exp $ */
|
||||
/* $NetBSD: file_subs.c,v 1.13 1999/11/01 01:35:58 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: file_subs.c,v 1.12 1999/10/22 10:43:11 mrg Exp $");
|
||||
__RCSID("$NetBSD: file_subs.c,v 1.13 1999/11/01 01:35:58 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -181,6 +181,8 @@ file_close(arcn, fd)
|
||||
set_pmode(arcn->name, arcn->sb.st_mode);
|
||||
if (patime || pmtime)
|
||||
set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
|
||||
if (pfflags)
|
||||
set_chflags(arcn->name, arcn->sb.st_flags);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -533,6 +535,8 @@ node_creat(arcn)
|
||||
|
||||
if (patime || pmtime)
|
||||
set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0);
|
||||
if (pfflags)
|
||||
set_chflags(arcn->name, arcn->sb.st_flags);
|
||||
return(0);
|
||||
}
|
||||
|
||||
@ -786,6 +790,26 @@ set_pmode(fnm, mode)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* set_chflags()
|
||||
* Set 4.4BSD file flags
|
||||
*/
|
||||
#if __STDC__
|
||||
void
|
||||
set_chflags(char *fnm, u_int32_t flags)
|
||||
#else
|
||||
void
|
||||
set_pmode(fnm, flags)
|
||||
char *fnm;
|
||||
u_int32_t flags;
|
||||
#endif
|
||||
{
|
||||
|
||||
if (chflags(fnm, flags) < 0)
|
||||
syswarn(1, errno, "Could not set file flags on %s", fnm);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* file_write()
|
||||
* Write/copy a file (during copy or archive extract). This routine knows
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: options.c,v 1.23 1999/10/22 20:59:08 is Exp $ */
|
||||
/* $NetBSD: options.c,v 1.24 1999/11/01 01:35:59 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: options.c,v 1.23 1999/10/22 20:59:08 is Exp $");
|
||||
__RCSID("$NetBSD: options.c,v 1.24 1999/11/01 01:35:59 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -301,11 +301,19 @@ pax_options(argc, argv)
|
||||
/*
|
||||
* preserve user id, group id, file
|
||||
* mode, access/modification times
|
||||
* and file flags.
|
||||
*/
|
||||
pids = 1;
|
||||
pmode = 1;
|
||||
patime = 1;
|
||||
pmtime = 1;
|
||||
pfflags = 1;
|
||||
break;
|
||||
case 'f':
|
||||
/*
|
||||
* do not preserve file flags
|
||||
*/
|
||||
pfflags = 0;
|
||||
break;
|
||||
case 'm':
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: pax.1,v 1.20 1999/09/26 21:19:54 jdolecek Exp $
|
||||
.\" $NetBSD: pax.1,v 1.21 1999/11/01 01:35:59 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1992 Keith Muller.
|
||||
.\" Copyright (c) 1992, 1993
|
||||
@ -529,7 +529,7 @@ The
|
||||
option-argument is a string specifying file characteristics to be retained or
|
||||
discarded on extraction.
|
||||
The string consists of the specification characters
|
||||
.Cm a , e , m , o ,
|
||||
.Cm a , e , f , m , o ,
|
||||
and
|
||||
.Cm p .
|
||||
Multiple characteristics can be concatenated within the same string
|
||||
@ -556,6 +556,9 @@ flag is the sum of the
|
||||
and
|
||||
.Cm p
|
||||
flags.
|
||||
.It Cm f
|
||||
Do not preserve file flags.
|
||||
By default, file flags are preserved whenever possible.
|
||||
.It Cm m
|
||||
Do not preserve file modification times.
|
||||
By default, file modification times are preserved whenever possible.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pax.c,v 1.10 1999/08/24 07:57:07 tron Exp $ */
|
||||
/* $NetBSD: pax.c,v 1.11 1999/11/01 01:35:59 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: pax.c,v 1.10 1999/08/24 07:57:07 tron Exp $");
|
||||
__RCSID("$NetBSD: pax.c,v 1.11 1999/11/01 01:35:59 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -94,6 +94,7 @@ int Zflag; /* same as uflg except after name mode */
|
||||
int vfpart; /* is partial verbose output in progress */
|
||||
int patime = 1; /* preserve file access time */
|
||||
int pmtime = 1; /* preserve file modification times */
|
||||
int pfflags = 1; /* preserve file flags */
|
||||
int pmode; /* preserve file mode bits */
|
||||
int pids; /* preserve file uid/gid */
|
||||
int exit_val; /* exit value */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tables.c,v 1.9 1999/07/03 14:42:39 kleink Exp $ */
|
||||
/* $NetBSD: tables.c,v 1.10 1999/11/01 01:35:59 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -42,7 +42,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tables.c,v 1.9 1999/07/03 14:42:39 kleink Exp $");
|
||||
__RCSID("$NetBSD: tables.c,v 1.10 1999/11/01 01:35:59 mrg Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -1286,6 +1286,7 @@ add_dir(name, nlen, psb, frc_mode)
|
||||
dblk.mode = psb->st_mode & 0xffff;
|
||||
dblk.mtime = psb->st_mtime;
|
||||
dblk.atime = psb->st_atime;
|
||||
dblk.fflags = psb->st_flags;
|
||||
dblk.frc_mode = frc_mode;
|
||||
if ((write(dirfd, name, dblk.nlen) == dblk.nlen) &&
|
||||
(write(dirfd, (char *)&dblk, sizeof(dblk)) == sizeof(dblk))) {
|
||||
@ -1345,6 +1346,8 @@ proc_dir()
|
||||
set_pmode(name, dblk.mode);
|
||||
if (patime || pmtime)
|
||||
set_ftime(name, dblk.mtime, dblk.atime, 0);
|
||||
if (pfflags)
|
||||
set_chflags(name, dblk.fflags);
|
||||
}
|
||||
|
||||
(void)close(dirfd);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tables.h,v 1.3 1995/03/21 09:07:47 cgd Exp $ */
|
||||
/* $NetBSD: tables.h,v 1.4 1999/11/01 01:35:59 mrg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Keith Muller.
|
||||
@ -170,5 +170,6 @@ typedef struct dirdata {
|
||||
mode_t mode; /* file mode to restore */
|
||||
time_t mtime; /* mtime to set */
|
||||
time_t atime; /* atime to set */
|
||||
long fflags; /* file flags to set */
|
||||
int frc_mode; /* do we force mode settings? */
|
||||
} DIRDATA;
|
||||
|
Loading…
Reference in New Issue
Block a user