* SUMMARY: A new kind of ls
@ 1998-08-18 19:55 Spalding, Stephen
0 siblings, 0 replies; only message in thread
From: Spalding, Stephen @ 1998-08-18 19:55 UTC (permalink / raw)
To: tru64-unix-managers
My original message is as follows:
"Hello all!
> We want to be able to use the ls function where it will return the month,
> day, and year each time it is run instead of returning the month, day, and
> time for files up to six months old and then displaying the year.
> Examples:
>
> > ls -l reins*18*
> -rw-rw-r-- 1 isabatch dba 0 Aug 18 10:13
> reins_policy_19980818.lst
>
> This is NOT what we want.
>
>
> > ls -l reins*18*
> -rw-rw-r-- 1 isabatch dba 0 Aug 18 1998
> reins_policy_19980818.lst
>
> This IS what we are looking for.
>
>
> I've looked through the man pages and have found that ls doesn't seem to
> have this functionality included with it, so I figured that I would have
> to
> write my own version of ls to do this. Does anyone have any examples that
> I
> can look at?
>
> Thank you very much!
>
>
> Stephen Spalding
> Associate System Administrator
> Missouri Employers Mutual Insurance
> sspaldin@mem-ins.com
> 1000 West Nifong
> Columbia, MO 65203
> (573) 499 - 4230
> (800) 442 - 0590
> fax (573) 499 - 4310"
>
>
I received responses from several people, most of which said that I needed
to get my hands on the GNU version of ls which comes with it's own set of
source code. From there, I can modify the source code to get it to do what
ever I want.
I downloaded a whole set of utilities from
ftp://ftp.gnu.org/pub/gnu/fileutils-3.16.tar.gz
and here is the change that I made to ls.c:
if (full_time)
{
fmt = "%a %b %d %H:%M:%S %Y";
}
else
{
/* Added 08-18-98 StephenS */
/* fmt = "%b %e %Y"; */
fmt = "%d-%b-%Y";
/* if (current_time > when + 6L * 30L * 24L * 60L * 60L */ /*
Old. */
/* || current_time < when - 60L * 60L) */ /* In the
future. */
/* { */
/* The file is fairly old or in the future.
POSIX says the cutoff is 6 months old;
approximate this by 6*30 days.
Allow a 1 hour slop factor for what is considered "the future",
to allow for NFS server/client clock disagreement.
Show the year instead of the time of day. */
/* fmt = "%b %e %Y"; */
/* } */
/* else */
/* { */
/* fmt = "%b %e %H:%M"; */
/* } */
}
Now, the output of ls looks like this:
-rwxr-xr-x 1 sspaldin wcis 270336 18-Aug-1998 14:54 vdir
Thanks to all who responded!
-Stephen Spalding
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1998-08-18 19:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-08-18 19:55 SUMMARY: A new kind of ls Spalding, Stephen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox