int lflag= 0; /* Make a hard link if possible. */
int cflag= 0; /* Copy if you can't link, otherwise symlink. */
int dflag= 0; /* Create a directory. */
+int pflag= 0; /* Preserve timestamps. */
int strip= 0; /* Strip the copy. */
char **compress= nil; /* Compress utility to make a compressed executable. */
char *zcat= nil; /* Line one to decompress. */
/* Set the mode again, chown may have wrecked it. */
(void) chmod(dir, mode);
}
+
+ if (pflag) {
+ struct utimbuf ubuf;
+
+ ubuf.actime= st.st_atime;
+ ubuf.modtime= st.st_mtime;
+
+ if (utime(dir, &ubuf) < 0 && errno != EPERM) {
+ report(dir); return;
+ }
+ }
}
}
/* Set the mode again, chown may have wrecked it. */
(void) chmod(dest, mode);
}
- if (!change) {
+ if (!change || pflag) {
struct utimbuf ubuf;
ubuf.actime= dst.st_atime;
{
fprintf(stderr, "\
Usage:\n\
- install [-lcsz#] [-o owner] [-g group] [-m mode] [-S stack] [file1] file2\n\
- install [-lcsz#] [-o owner] [-g group] [-m mode] [-S stack] file ... dir\n\
+ install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] [file1] file2\n\
+ install [-lcpsz#] [-o owner] [-g group] [-m mode] [-S stack] file ... dir\n\
install -d [-o owner] [-g group] [-m mode] directory\n");
exit(1);
}
case 'c': cflag= 1; break;
case 's': strip= 1; break;
case 'd': dflag= 1; break;
+ case 'p': pflag= 1; break;
case 'z':
if (compress == nil) {
compress= COMPRESS;
.in +5
.ti -5
.B install
-.RB [ \-lcsz\fIN\fP "] [" \-o
+.RB [ \-lcpsz\fIN\fP "] [" \-o
.IR owner ]
.RB [ \-g
.IR group ]
.br
.ti -5
.B install
-.RB [ \-lcsz\fIN\fP "] [" \-o
+.RB [ \-lcpsz\fIN\fP "] [" \-o
.IR owner ]
.RB [ \-g
.IR group ]
.BR \-l ,
the file is copied if the link fails.
.TP
+.B \-p
+Preserve timestamp on source file or directory.
+.TP
.B \-s
Strip the destination file of its symbol table,
.I if