Bug 35886 - [patch] pax(1) enhancement: custom time format for list mode -v
Summary: [patch] pax(1) enhancement: custom time format for list mode -v
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 4.5-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-14 09:50 UTC by Bjoern Fischer
Modified: 2017-12-31 22:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern Fischer 2002-03-14 09:50:01 UTC
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.

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--------------------
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:45 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped