clean up import, fix a few bugs, etc.
This commit is contained in:
parent
82f956cd93
commit
d03f028e33
|
@ -1,5 +1,4 @@
|
|||
# from: @(#)Makefile 5.6 (Berkeley) 2/19/92
|
||||
# $Id: Makefile,v 1.6 1994/12/22 11:36:40 cgd Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
|
||||
PROG= mtree
|
||||
#CFLAGS+=-DDEBUG
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -32,8 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)compare.c 5.10 (Berkeley) 3/31/92"; */
|
||||
static char *rcsid = "$Id: compare.c,v 1.6 1994/03/27 09:09:42 cgd Exp $";
|
||||
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -166,11 +165,18 @@ typeerr: LABEL;
|
|||
tab, s->st_size, p->fts_statp->st_size);
|
||||
tab = "\t";
|
||||
}
|
||||
if (s->flags & F_TIME && s->st_mtime != p->fts_statp->st_mtime) {
|
||||
/*
|
||||
* XXX
|
||||
* Catches nano-second differences, but doesn't display them.
|
||||
*/
|
||||
if (s->flags & F_TIME &&
|
||||
s->st_mtimespec.ts_sec != p->fts_statp->st_mtimespec.ts_sec ||
|
||||
s->st_mtimespec.ts_nsec != p->fts_statp->st_mtimespec.ts_nsec) {
|
||||
LABEL;
|
||||
(void)printf("%smodification time (%.24s, ",
|
||||
tab, ctime(&s->st_mtime));
|
||||
(void)printf("%.24s)\n", ctime(&p->fts_statp->st_mtime));
|
||||
tab, ctime(&s->st_mtimespec.ts_sec));
|
||||
(void)printf("%.24s)\n",
|
||||
ctime(&p->fts_statp->st_mtimespec.ts_sec));
|
||||
tab = "\t";
|
||||
}
|
||||
if (s->flags & F_CKSUM)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -32,8 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)create.c 5.19 (Berkeley) 3/2/92"; */
|
||||
static char *rcsid = "$Id: create.c,v 1.7 1994/03/27 09:09:49 cgd Exp $";
|
||||
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -152,7 +151,9 @@ statf(p)
|
|||
if (keys & F_SIZE)
|
||||
output(&indent, "size=%qd", p->fts_statp->st_size);
|
||||
if (keys & F_TIME)
|
||||
output(&indent, "time=%ld", p->fts_statp->st_mtime);
|
||||
output(&indent, "time=%ld.%ld",
|
||||
p->fts_statp->st_mtimespec.ts_sec,
|
||||
p->fts_statp->st_mtimespec.ts_nsec);
|
||||
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
|
||||
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
|
||||
crc(fd, &val, &len))
|
||||
|
@ -272,17 +273,16 @@ output(offset, fmt, va_alist)
|
|||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
int len;
|
||||
char buf[1024];
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
len = vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (*offset + len > MAXLINELEN - 3) {
|
||||
if (*offset + strlen(buf) > MAXLINELEN - 3) {
|
||||
(void)printf(" \\\n%*s", INDENTNAMELEN, "");
|
||||
*offset = INDENTNAMELEN;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ The utility
|
|||
compares the file hierarchy rooted in the current directory against a
|
||||
specification read from the standard input.
|
||||
Messages are written to the standard output for any files whose
|
||||
characteristics do not match the specifications, or which are
|
||||
characteristics do not match the specification, or which are
|
||||
missing from either the file hierarchy or the specification.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1989, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -32,14 +32,13 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1990, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)mtree.c 5.10 (Berkeley) 4/17/92"; */
|
||||
static char *rcsid = "$Id: mtree.c,v 1.3 1993/11/02 07:51:12 cgd Exp $";
|
||||
static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -30,8 +30,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)mtree.h 5.9 (Berkeley) 2/19/92
|
||||
* $Id: mtree.h,v 1.4 1994/04/25 18:21:23 cgd Exp $
|
||||
* @(#)mtree.h 8.1 (Berkeley) 6/6/93
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -46,7 +45,7 @@ typedef struct _node {
|
|||
struct _node *parent, *child; /* up, down */
|
||||
struct _node *prev, *next; /* left, right */
|
||||
off_t st_size; /* size */
|
||||
struct timespec st_mtimespec; /* last modification time */
|
||||
struct timespec st_mtimespec; /* last modification time */
|
||||
u_long cksum; /* check sum */
|
||||
char *slink; /* symbolic link reference */
|
||||
uid_t st_uid; /* uid */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -32,8 +32,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)spec.c 5.17 (Berkeley) 4/17/92"; */
|
||||
static char *rcsid = "$Id: spec.c,v 1.4 1994/03/27 09:09:54 cgd Exp $";
|
||||
static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -215,7 +214,11 @@ set(t, ip)
|
|||
err("%s", strerror(errno));
|
||||
break;
|
||||
case F_TIME:
|
||||
ip->st_mtime = strtoul(val, &ep, 10);
|
||||
ip->st_mtimespec.ts_sec = strtoul(val, &ep, 10);
|
||||
if (*ep != '.')
|
||||
err("invalid time %s", val);
|
||||
val = ep + 1;
|
||||
ip->st_mtimespec.ts_nsec = strtoul(val, &ep, 10);
|
||||
if (*ep)
|
||||
err("invalid time %s", val);
|
||||
break;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -32,16 +32,15 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)verify.c 5.11 (Berkeley) 4/17/92"; */
|
||||
static char *rcsid = "$Id: verify.c,v 1.7 1993/11/02 08:44:00 cgd Exp $";
|
||||
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <fts.h>
|
||||
#include <unistd.h>
|
||||
#include <fnmatch.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include "mtree.h"
|
||||
|
@ -108,8 +107,8 @@ vwalk()
|
|||
}
|
||||
|
||||
for (ep = level; ep; ep = ep->next)
|
||||
if (ep->flags & F_MAGIC && !fnmatch(ep->name,
|
||||
p->fts_name, FNM_PATHNAME) ||
|
||||
if (ep->flags & F_MAGIC &&
|
||||
!fnmatch(ep->name, p->fts_name, FNM_PATHNAME) ||
|
||||
!strcmp(ep->name, p->fts_name)) {
|
||||
ep->flags |= F_VISIT;
|
||||
if (compare(ep->name, ep, p))
|
||||
|
|
Loading…
Reference in New Issue