diff options
author | ache <ache@FreeBSD.org> | 2001-03-21 15:13:50 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-03-21 15:13:50 +0000 |
commit | 2a47a8991925b07c213a528f3cb70e0f1b4db7f1 (patch) | |
tree | 67d3df91503734658a35467fb7512a1f99246ffc /gnu | |
parent | a159b331cb0cd8c67aca6f112fa4b227b3041b8c (diff) | |
download | FreeBSD-src-2a47a8991925b07c213a528f3cb70e0f1b4db7f1.zip FreeBSD-src-2a47a8991925b07c213a528f3cb70e0f1b4db7f1.tar.gz |
Don't attempt to parse %c output, use nl_langinfo instead
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/tar/list.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gnu/usr.bin/tar/list.c b/gnu/usr.bin/tar/list.c index a3329c9..911170b 100644 --- a/gnu/usr.bin/tar/list.c +++ b/gnu/usr.bin/tar/list.c @@ -15,7 +15,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Tar; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +$FreeBSD$ + +*/ /* * List a tar archive. @@ -29,6 +33,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <ctype.h> #include <sys/types.h> #include <errno.h> +#include <langinfo.h> #ifndef STDC_HEADERS extern int errno; #endif @@ -564,6 +569,7 @@ print_header () char size[24]; /* Holds a formatted long or maj, min */ time_t longie; int pad; + static int d_first = -1; char *name; extern long baserec; @@ -640,10 +646,12 @@ print_header () demode ((unsigned) hstat.st_mode, modes + 1); /* Timestamp */ + if (d_first < 0) + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); longie = hstat.st_mtime; - strftime(timestamp, sizeof(timestamp), "%c", localtime(&longie)); - timestamp[16] = '\0'; - timestamp[24] = '\0'; + strftime(timestamp, sizeof(timestamp), + d_first ? "%e %b %H:%M %Y" : "%b %e %H:%M %Y", + localtime(&longie)); /* User and group names */ if (*head->header.uname && head_standard) @@ -694,14 +702,14 @@ print_header () name = quote_copy_string (current_file_name); if (!name) name = current_file_name; - fprintf (msg_file, "%s %s/%s %*s%s %s %s %s", + fprintf (msg_file, "%s %s/%s %*s%s %s %s", modes, user, group, ugswidth - pad, "", size, - timestamp + 4, timestamp + 20, + timestamp, name); if (name != current_file_name) |