Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Mar 2002 10:40:08 +0100 (CET)
From:      Bjoern Fischer <bfischer@techfak.uni-bielefeld.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/35886: [patch] Enhancement: custom time format for list mode -v
Message-ID:  <200203140940.g2E9e8S01074@broccoli.no-support.loc>

next in thread | raw e-mail | index | archive | help

>Number:         35886
>Category:       bin
>Synopsis:       [patch] Enhancement: custom time format for list mode -v
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 14 01:50:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bjoern Fischer
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
>Environment:
System: FreeBSD broccoli 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Fri Mar 1 23:44:15 CET 2002 root@frolic:/usr/src/sys/compile/CLIENT i386


>Description:

This is a patch that extends pax(1) to use an user specified strftime() format
string for the verbose list mode. The feature makes it a lot easier to
index pax readible archives for backup applications, etc.

>How-To-Repeat:
>Fix:

---------------snip--------------------
--- ./extern.h	2002/03/14 08:39:54	1.1
+++ ./extern.h	2002/03/14 08:42:17
@@ -190,6 +190,7 @@
 int opt_add __P((register char *));
 int bad_opt __P((void));
 char *chdname;
+char *customtimefrmt;
 
 /*
  * pat_rep.c
--- ./gen_subs.c	2002/03/14 08:33:41	1.1
+++ ./gen_subs.c	2002/03/14 08:39:38
@@ -110,10 +110,14 @@
 	/*
 	 * time format based on age compared to the time pax was started.
 	 */
-	if ((sbp->st_mtime + SIXMONTHS) <= now)
-		timefrmt = OLDFRMT;
-	else
-		timefrmt = CURFRMT;
+	if (customtimefrmt != 0)
+		timefrmt = customtimefrmt;
+	else {
+		if ((sbp->st_mtime + SIXMONTHS) <= now)
+			timefrmt = OLDFRMT;
+		else
+			timefrmt = CURFRMT;
+	}
 
 	/*
 	 * print file mode, link count, uid, gid and time
--- ./options.c	2002/03/14 08:42:31	1.1
+++ ./options.c	2002/03/14 09:01:07
@@ -205,7 +205,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:HLPS:T:U:XYZ"))
 	    != -1) {
 		switch (c) {
 		case 'a':
@@ -464,6 +464,14 @@
 			 */
 			Lflag = 0;
 			flg |= CPF;
+			break;
+		case 'S':
+			/*
+			 * non-standard option for specifying a custom
+			 * strftime() format on list operations with -v
+			 */
+			customtimefrmt = optarg;
+			flg |= CSF;
 			break;
 		case 'T':
 			/*
--- ./options.h	2002/03/14 08:42:33	1.1
+++ ./options.h	2002/03/14 08:45:24
@@ -81,17 +81,18 @@
 #define	CHF	0x00400000	/* nonstandard extension */
 #define	CLF	0x00800000	/* nonstandard extension */
 #define	CPF	0x01000000	/* nonstandard extension */
-#define	CTF	0x02000000	/* nonstandard extension */
-#define	CUF	0x04000000	/* nonstandard extension */
-#define	CXF	0x08000000
-#define	CYF	0x10000000	/* nonstandard extension */
-#define	CZF	0x20000000	/* nonstandard extension */
+#define	CSF	0x02000000	/* nonstandard extension */
+#define	CTF	0x04000000	/* nonstandard extension */
+#define	CUF	0x08000000	/* nonstandard extension */
+#define	CXF	0x10000000
+#define	CYF	0x20000000	/* nonstandard extension */
+#define	CZF	0x40000000	/* nonstandard extension */
 
 /*
  * ascii string indexed by bit position above (alter the above and you must
  * alter this string) used to tell the user what flags caused us to complain
  */
-#define FLGCH	"abcdfiklnoprstuvwxBDEGHLPTUXYZ"
+#define FLGCH	"abcdfiklnoprstuvwxBDEGHLPSTUXYZ"
 
 /*
  * legal pax operation bit patterns
--- ./pax.1	2002/03/14 08:45:44	1.1
+++ ./pax.1	2002/03/14 09:18:48
@@ -50,6 +50,9 @@
 .Ek
 .Bk -words
 .Op Fl s Ar replstr
+.Ek
+.Bk -words
+.Op Fl S Ar timefmt
 .Ar ...\&
 .Ek
 .Bk -words
@@ -845,6 +848,16 @@
 .It Fl P
 Do not follow symbolic links, perform a physical file system traversal.
 This is the default mode.
+.It Fl S Ar timefmt
+Specify an alternative time format used in
+.Em list
+mode while the
+.Fl v
+option is used. The format string
+.Ar timefmt
+may contain any of the conversion specifications described in the
+.Xr strftime 3
+manual page, as well as any arbitrary text.
 .It Fl T Ar [from_date][,to_date][/[c][m]]
 Allow files to be selected based on a file modification or inode change
 time falling within a specified time range of
---------------snip--------------------

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203140940.g2E9e8S01074>