than six months old. And ls(1) needs more options anyway.
SCCS-vsn: bin/ls/ls.1 6.14
SCCS-vsn: bin/ls/ls.c 5.43
SCCS-vsn: bin/ls/ls.h 5.11
SCCS-vsn: bin/ls/print.c 5.23
SCCS-vsn: bin/ls/util.c 5.8
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
-.\" @(#)ls.1 6.13 (Berkeley) %G%
+.\" @(#)ls.1 6.14 (Berkeley) %G%
-.B \-1AaCcdFfgikLlqRrstu
+.B \-1AaCcdFfgikLlqRrsTtu
] [ file ... ]
.br
.SH DESCRIPTION
] [ file ... ]
.br
.SH DESCRIPTION
.B \-s
Display the sizes of files and directories in 512-byte blocks.
.TP
.B \-s
Display the sizes of files and directories in 512-byte blocks.
.TP
+.B \-T
+By default, file times less than six months in the past are
+displayed as month, day, hour and minute, and file times more
+than six months in the past are displayed as month, day and
+year.
+The \-T option causes
+.I ls
+to display all file times as month, day, hour, and minute.
+.TP
.B \-t
Sort by time modified (latest first) instead of
by name.
.B \-t
Sort by time modified (latest first) instead of
by name.
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ls.c 5.42 (Berkeley) %G%";
+static char sccsid[] = "@(#)ls.c 5.43 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
int f_nosort; /* don't sort output */
int f_recursive; /* ls subdirectories also */
int f_reversesort; /* reverse whatever sort is used */
int f_nosort; /* don't sort output */
int f_recursive; /* ls subdirectories also */
int f_reversesort; /* reverse whatever sort is used */
+int f_sectime; /* print the real time for all files */
int f_singlecol; /* use single column output */
int f_size; /* list size in short listing */
int f_statustime; /* use time of last mode change */
int f_singlecol; /* use single column output */
int f_size; /* list size in short listing */
int f_statustime; /* use time of last mode change */
if (!getuid())
f_listdot = 1;
if (!getuid())
f_listdot = 1;
- while ((ch = getopt(argc, argv, "1ACFLRacdfgiklqrstu")) != EOF) {
+ while ((ch = getopt(argc, argv, "1ACFLRTacdfgiklqrstu")) != EOF) {
switch (ch) {
/*
* -1, -C and -l all override each other
switch (ch) {
/*
* -1, -C and -l all override each other
case 's':
f_size = 1;
break;
case 's':
f_size = 1;
break;
+ case 'T':
+ f_sectime = 1;
+ break;
case 't':
f_timesort = 1;
break;
case 't':
f_timesort = 1;
break;
*
%sccs.include.redist.c%
*
*
%sccs.include.redist.c%
*
- * @(#)ls.h 5.10 (Berkeley) %G%
+ * @(#)ls.h 5.11 (Berkeley) %G%
*/
typedef struct _lsstruct {
*/
typedef struct _lsstruct {
extern int f_inode; /* print inode */
extern int f_kblocks; /* print size in kilobytes */
extern int f_longform; /* long listing format */
extern int f_inode; /* print inode */
extern int f_kblocks; /* print size in kilobytes */
extern int f_longform; /* long listing format */
+extern int f_sectime; /* print the real time for all files */
extern int f_singlecol; /* use single column output */
extern int f_size; /* list size in short listing */
extern int f_statustime; /* use time of last mode change */
extern int f_singlecol; /* use single column output */
extern int f_size; /* list size in short listing */
extern int f_statustime; /* use time of last mode change */
-static char sccsid[] = "@(#)print.c 5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)print.c 5.23 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
(void)putchar(longstring[i]);
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
(void)putchar(longstring[i]);
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
- if (ftime + SIXMONTHS > time((time_t *)NULL))
+ if (f_sectime || ftime + SIXMONTHS > time((time_t *)NULL))
for (i = 11; i < 16; ++i)
(void)putchar(longstring[i]);
else {
for (i = 11; i < 16; ++i)
(void)putchar(longstring[i]);
else {
-static char sccsid[] = "@(#)util.c 5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 5.8 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
- (void)fprintf(stderr, "usage: ls [-1ACFLRacdfgiklqrstu] [file ...]\n");
+ (void)fprintf(stderr, "usage: ls [-1ACFLRTacdfgiklqrstu] [file ...]\n");