From owner-freebsd-bugs Thu Mar 14 1:50:31 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5E8D237B41A for ; Thu, 14 Mar 2002 01:50:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2E9o1G16614; Thu, 14 Mar 2002 01:50:01 -0800 (PST) (envelope-from gnats) Received: from mailout01.sul.t-online.com (mailout01.sul.t-online.com [194.25.134.80]) by hub.freebsd.org (Postfix) with ESMTP id 2EEE437B405 for ; Thu, 14 Mar 2002 01:40:50 -0800 (PST) Received: from fwd08.sul.t-online.de by mailout01.sul.t-online.com with smtp id 16lRj6-00082B-03; Thu, 14 Mar 2002 10:40:48 +0100 Received: from frolic.no-support.loc (520094253176-0001@[217.225.32.206]) by fmrl08.sul.t-online.com with esmtp id 16lRio-0pWT9kC; Thu, 14 Mar 2002 10:40:30 +0100 Received: from broccoli.no-support.loc (root@broccoli.no-support.loc [192.168.43.99]) by frolic.no-support.loc (8.11.6/8.9.3) with ESMTP id g2E9e8W01592 for ; Thu, 14 Mar 2002 10:40:08 +0100 (CET) (envelope-from bjoern@no-support.loc) Received: (from bjoern@localhost) by broccoli.no-support.loc (8.11.6/8.9.3) id g2E9e8S01074; Thu, 14 Mar 2002 10:40:08 +0100 (CET) (envelope-from bjoern@no-support.loc) Message-Id: <200203140940.g2E9e8S01074@broccoli.no-support.loc> Date: Thu, 14 Mar 2002 10:40:08 +0100 (CET) From: Bjoern Fischer Reply-To: Bjoern Fischer To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/35886: [patch] Enhancement: custom time format for list mode -v Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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