summaryrefslogtreecommitdiffstats
path: root/usr.bin/ar
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2001-03-21 20:47:43 +0000
committerache <ache@FreeBSD.org>2001-03-21 20:47:43 +0000
commit5114629fd93a66765762345ff4679beb4fe744fa (patch)
tree9d218bce5aef204ec7ca2ec5069561cb70a61041 /usr.bin/ar
parent313dba18c965663c3c879ee9e864c56532665a36 (diff)
downloadFreeBSD-src-5114629fd93a66765762345ff4679beb4fe744fa.zip
FreeBSD-src-5114629fd93a66765762345ff4679beb4fe744fa.tar.gz
Don't attempt to parse %c
Diffstat (limited to 'usr.bin/ar')
-rw-r--r--usr.bin/ar/contents.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.bin/ar/contents.c b/usr.bin/ar/contents.c
index e31cd63..c92f2a7 100644
--- a/usr.bin/ar/contents.c
+++ b/usr.bin/ar/contents.c
@@ -32,6 +32,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#ifndef lint
@@ -45,6 +47,7 @@ static const char sccsid[] = "@(#)contents.c 8.3 (Berkeley) 4/2/94";
#include <ar.h>
#include <dirent.h>
#include <fcntl.h>
+#include <langinfo.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -63,7 +66,7 @@ contents(argv)
{
int afd, all;
struct tm *tp;
- char *file, buf[25];
+ char *file, buf[80];
afd = open_archive(O_RDONLY);
@@ -73,14 +76,20 @@ contents(argv)
else if (!(file = files(argv)))
goto next;
if (options & AR_V) {
+ static int d_first = -1;
+
(void)strmode(chdr.mode, buf);
(void)printf("%s %6d/%-6d %8qd ",
buf + 1, chdr.uid, chdr.gid, chdr.size);
+
+ if (d_first < 0)
+ d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
tp = localtime(&chdr.date);
- (void)strftime(buf, sizeof(buf), "%c", tp);
- buf[16] = '\0';
- buf[24] = '\0';
- (void)printf("%s %s %s\n", buf + 4, buf + 20, file);
+ (void)strftime(buf, sizeof(buf),
+ d_first ? "%e %b %R %Y" :
+ "%b %e %R %Y",
+ tp);
+ (void)printf("%s %s\n", buf, file);
} else
(void)printf("%s\n", file);
if (!all && !*argv)
OpenPOWER on IntegriCloud