diff options
author | ache <ache@FreeBSD.org> | 2001-03-21 13:33:09 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-03-21 13:33:09 +0000 |
commit | 0a97601c2df9aca30e03348625559503f252c39b (patch) | |
tree | c51b28f3273c777d0d73805fb4c66af3b73937a8 /bin/pax/gen_subs.c | |
parent | 222bae808450e1260199e3b663fe39ef21f4077b (diff) | |
download | FreeBSD-src-0a97601c2df9aca30e03348625559503f252c39b.zip FreeBSD-src-0a97601c2df9aca30e03348625559503f252c39b.tar.gz |
Use nl_langinfo instead of %Ef
Diffstat (limited to 'bin/pax/gen_subs.c')
-rw-r--r-- | bin/pax/gen_subs.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/bin/pax/gen_subs.c b/bin/pax/gen_subs.c index bd04aa8..02845b7 100644 --- a/bin/pax/gen_subs.c +++ b/bin/pax/gen_subs.c @@ -46,6 +46,7 @@ static const char rcsid[] = #include <sys/types.h> #include <sys/time.h> #include <sys/stat.h> +#include <langinfo.h> #include <stdio.h> #include <utmp.h> #include <unistd.h> @@ -64,13 +65,17 @@ static const char rcsid[] = #define MODELEN 20 #define DATELEN 64 #define SIXMONTHS ((365 / 2) * 86400) -#define CURFRMT "%Ef %H:%M" -#define OLDFRMT "%Ef %Y" +#define CURFRMTM "%b %e %H:%M" +#define OLDFRMTM "%b %e %Y" +#define CURFRMTD "%e %b %H:%M" +#define OLDFRMTD "%e %b %Y" #ifndef UT_NAMESIZE #define UT_NAMESIZE 8 #endif #define UT_GRPSIZE 6 +static int d_first = -1; + /* * ls_list() * list the members of an archive in ls format @@ -100,6 +105,8 @@ ls_list(arcn, now) return; } + if (d_first < 0) + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); /* * user wants long mode */ @@ -110,9 +117,9 @@ ls_list(arcn, now) * time format based on age compared to the time pax was started. */ if ((sbp->st_mtime + SIXMONTHS) <= now) - timefrmt = OLDFRMT; + timefrmt = d_first ? OLDFRMTD : OLDFRMTM; else - timefrmt = CURFRMT; + timefrmt = d_first ? CURFRMTD : CURFRMTM; /* * print file mode, link count, uid, gid and time @@ -174,10 +181,13 @@ ls_tty(arcn) char f_mode[MODELEN]; char *timefrmt; + if (d_first < 0) + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); + if ((arcn->sb.st_mtime + SIXMONTHS) <= time((time_t *)NULL)) - timefrmt = OLDFRMT; + timefrmt = d_first ? OLDFRMTD : OLDFRMTM; else - timefrmt = CURFRMT; + timefrmt = d_first ? CURFRMTD : CURFRMTM; /* * convert time to string, and print |