aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2001-03-21 20:47:43 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2001-03-21 20:47:43 +0000
commitf1b3d8240698fdfb5a161be7ec2e002efc0c3dc4 (patch)
treebbbd18ba69fe8e94910446adb1cb6a838e7bafb1 /usr.bin
parent6ab831378a9421c38b61fde49aba85458c7da1e8 (diff)
Notes
Diffstat (limited to 'usr.bin')
-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 e31cd639acfa3..c92f2a7dd4039 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)