add modification time keyword
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 26 May 1990 07:50:51 +0000 (23:50 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sat, 26 May 1990 07:50:51 +0000 (23:50 -0800)
SCCS-vsn: usr.sbin/mtree/compare.c 5.7
SCCS-vsn: usr.sbin/mtree/create.c 5.12
SCCS-vsn: usr.sbin/mtree/mtree.8 5.5
SCCS-vsn: usr.sbin/mtree/mtree.h 5.7
SCCS-vsn: usr.sbin/mtree/spec.c 5.12

usr/src/usr.sbin/mtree/compare.c
usr/src/usr.sbin/mtree/create.c
usr/src/usr.sbin/mtree/mtree.8
usr/src/usr.sbin/mtree/mtree.h
usr/src/usr.sbin/mtree/spec.c

index d263d30..710703a 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)compare.c  5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)compare.c  5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -14,6 +14,7 @@ static char sccsid[] = "@(#)compare.c 5.6 (Berkeley) %G%";
 #include <fts.h>
 #include <errno.h>
 #include <stdio.h>
 #include <fts.h>
 #include <errno.h>
 #include <stdio.h>
+#include <time.h>
 #include "mtree.h"
 
 #define        LABEL \
 #include "mtree.h"
 
 #define        LABEL \
@@ -115,6 +116,12 @@ typeerr:           LABEL;
                        (void)printf("\n\tlink ref (%s, %s)", cp, s->slink);
                }
        }
                        (void)printf("\n\tlink ref (%s, %s)", cp, s->slink);
                }
        }
+       if (s->flags & F_TIME && s->st_mtime != p->fts_statb.st_mtime) {
+               LABEL;
+               (void)printf("\n\tmodification time (%.24s, ",
+                   ctime(&s->st_mtime));
+               (void)printf("%.24s)", ctime(&p->fts_statb.st_mtime));
+       }
        if (label) {
                exitval = 2;
                putchar('\n');
        if (label) {
                exitval = 2;
                putchar('\n');
index 29dee19..08b6990 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)create.c   5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)create.c   5.12 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -127,6 +127,8 @@ cwalk()
                }
                LABEL;
                (void)printf("size=%ld", p->fts_statb.st_size);
                }
                LABEL;
                (void)printf("size=%ld", p->fts_statb.st_size);
+               LABEL;
+               (void)printf("time=%ld", p->fts_statb.st_mtime);
 
                if (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE) {
                        LABEL;
 
                if (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE) {
                        LABEL;
index b7b9f7a..70dfd14 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\" %sccs.include.redist.man%
 .\"
 .\"
 .\" %sccs.include.redist.man%
 .\"
-.\"    @(#)mtree.8     5.4 (Berkeley) %G%
+.\"    @(#)mtree.8     5.5 (Berkeley) %G%
 .\"
 .TH MTREE 8 ""
 .UC 7
 .\"
 .TH MTREE 8 ""
 .UC 7
@@ -97,6 +97,9 @@ The size, in bytes, of the file.
 .B link
 The file a symbolic link is expected to reference.
 .TP
 .B link
 The file a symbolic link is expected to reference.
 .TP
+.B time
+The last modification time of the file.
+.TP
 .B type
 The type of the file; may be set to any one of the following:
 .RS
 .B type
 The type of the file; may be set to any one of the following:
 .RS
@@ -173,6 +176,10 @@ chmod(1), chown(1), chgrp(1), cksum(1), find(1), stat(2), fts(3), mkproto(8)
 The
 .I cksum
 keyword is not yet implemented.
 The
 .I cksum
 keyword is not yet implemented.
+.br
+The
+.I time
+keyword should be specifiable in human readable terms.
 .SH EXAMPLE
 .nf
 #        fs: /a/staff/rick/mybin
 .SH EXAMPLE
 .nf
 #        fs: /a/staff/rick/mybin
index 30e5a91..81c9e67 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)mtree.h     5.6 (Berkeley) %G%
+ *     @(#)mtree.h     5.7 (Berkeley) %G%
  */
 
 #include <string.h>
  */
 
 #include <string.h>
@@ -14,6 +14,7 @@ typedef struct _node {
        struct _node    *parent, *child;        /* up, down */
        struct _node    *prev, *next;           /* left, right */
        off_t   st_size;                        /* size */
        struct _node    *parent, *child;        /* up, down */
        struct _node    *prev, *next;           /* left, right */
        off_t   st_size;                        /* size */
+       time_t  st_mtime;                       /* last modification time */
        u_long  cksum;                          /* check sum */
        char    *slink;                         /* symbolic link reference */
        uid_t   st_uid;                         /* owner */
        u_long  cksum;                          /* check sum */
        char    *slink;                         /* symbolic link reference */
        uid_t   st_uid;                         /* owner */
@@ -31,18 +32,19 @@ typedef struct _node {
 #define        F_SOCK  0x040                           /* socket */
        u_short type;                           /* file type */
 
 #define        F_SOCK  0x040                           /* socket */
        u_short type;                           /* file type */
 
-#define        F_CKSUM 0x001                           /* check sum */
-#define        F_DONE  0x002                           /* directory done */
-#define        F_GROUP 0x004                           /* group */
-#define        F_IGN   0x008                           /* ignore */
-#define        F_MAGIC 0x010                           /* name has magic chars */
-#define        F_MODE  0x020                           /* mode */
-#define        F_NLINK 0x040                           /* number of links */
-#define        F_OWNER 0x080                           /* owner */
-#define        F_SIZE  0x100                           /* size */
-#define        F_SLINK 0x200                           /* link count */
-#define        F_TYPE  0x400                           /* file type */
-#define        F_VISIT 0x800                           /* file visited */
+#define        F_CKSUM 0x0001                          /* check sum */
+#define        F_DONE  0x0002                          /* directory done */
+#define        F_GROUP 0x0004                          /* group */
+#define        F_IGN   0x0008                          /* ignore */
+#define        F_MAGIC 0x0010                          /* name has magic chars */
+#define        F_MODE  0x0020                          /* mode */
+#define        F_NLINK 0x0040                          /* number of links */
+#define        F_OWNER 0x0080                          /* owner */
+#define        F_SIZE  0x0100                          /* size */
+#define        F_SLINK 0x0200                          /* link count */
+#define        F_TIME  0x0400                          /* modification time */
+#define        F_TYPE  0x0800                          /* file type */
+#define        F_VISIT 0x1000                          /* file visited */
        u_short flags;                          /* items set */
 
        char    name[1];                        /* file name (must be last) */
        u_short flags;                          /* items set */
 
        char    name[1];                        /* file name (must be last) */
index ba3cb18..7a050c8 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)spec.c     5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)spec.c     5.12 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -147,6 +147,9 @@ set(ip)
                        if (!(ip->slink = strdup(val)))
                                nomem();
                        break;
                        if (!(ip->slink = strdup(val)))
                                nomem();
                        break;
+               case F_TIME:
+                       ip->st_mtime = atol(val);
+                       break;
                case F_TYPE:
                        switch(*val) {
                        case 'b':
                case F_TYPE:
                        switch(*val) {
                        case 'b':
@@ -233,6 +236,8 @@ key(p)
        case 't':
                if (!strcmp(p, "type"))
                        return(F_TYPE);
        case 't':
                if (!strcmp(p, "type"))
                        return(F_TYPE);
+               if (!strcmp(p, "time"))
+                       return(F_TIME);
                break;
        }
        (void)fprintf(stderr, "mtree: unknown keyword %s.\n", p);
                break;
        }
        (void)fprintf(stderr, "mtree: unknown keyword %s.\n", p);