[gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Willie Wong
On Sat, Jan 07, 2006 at 04:17:11PM +0100, Penguin Lover Holly Bostick squawked:
 (how do you get ls to also include the @#$%#$ *year*??)

Sorry, couldn't help with the rest of your problem, but I think it is
assumed that ls will display the year only for files older than a year
old. Quite clever, in my opinion. 

Of course, you can also pass it the --full-time option, but the result
gets rather ugly:

[01:09 PM]wwong lunar-2.1 $ ls -l
total 96
-rw-r--r--  1 wwong root91 Aug 11  1992 Makefile
-rwxr-xr-x  1 wwong root 27121 Jul 14 21:53 lunar
-rw-r--r--  1 wwong root  2938 Aug 11  1992 lunar.1
-rw-r--r--  1 wwong root  1731 Jun 21  1991 lunar.bitmap
-rw-r--r--  1 wwong root 18447 Aug 11  1992 lunar.c
-rw-r--r--  1 wwong root 22096 Jul 14 21:53 lunar.o
-rw-r--r--  1 wwong root 11140 Aug 11  1992 tables.h
[01:09 PM]wwong lunar-2.1 $ ls  --full-time
total 96
-rw-r--r--  1 wwong root91 1992-08-11 00:14:48.0 -0400 Makefile
-rwxr-xr-x  1 wwong root 27121 2005-07-14 21:53:10.0 -0400 lunar
-rw-r--r--  1 wwong root  2938 1992-08-11 00:14:48.0 -0400 lunar.1
-rw-r--r--  1 wwong root  1731 1991-06-21 02:35:16.0 -0400 lunar.bitmap
-rw-r--r--  1 wwong root 18447 1992-08-11 00:14:48.0 -0400 lunar.c
-rw-r--r--  1 wwong root 22096 2005-07-14 21:53:09.0 -0400 lunar.o
-rw-r--r--  1 wwong root 11140 1992-08-11 00:14:48.0 -0400 tables.h

HTH, 

W
-- 
One man's vacuum is another man's sewer.
~N. Milleron
Sortir en Pantoufles: up 56 days, 10:27
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Holly Bostick
Willie Wong schreef:
 On Sat, Jan 07, 2006 at 04:17:11PM +0100, Penguin Lover Holly Bostick
 squawked:
 
 (how do you get ls to also include the @#$%#$ *year*??)
 
 
 Sorry, couldn't help with the rest of your problem, but I think it is
  assumed that ls will display the year only for files older than a
 year old. Quite clever, in my opinion.

OK, I see what you mean-- or maybe I don't:

la ~/docs/
totaal 3714
drwxrwxr-x  15 motub somegroup1136 okt 28 00:56 .
drwxrwxr-x  16 motub somegroup1720 nov 21 02:46 ..
-rw-r--r--   1 motub somegroup 1292758 okt 18 20:17 autosc102.exe
drwxr-xr-x   6 motub somegroup 192 okt 30 15:25 books
-r-xr-xr-x   1 motub somegroup2778 jan 27  2003 Buddies.xml
drwxrwxr-x   2 motub somegroup1216 jan  6 22:42 cmds
-rw-rw-r--   1 motub somegroup 581 jan 31  2005 computeruniverse_rma.txt
drwxrwxr-x   5 motub somegroup3192 nov 21 16:55 config
-rw-rw-r--   1 motub somegroup3904 nov  3  2004 depclean_data.txt
-rw-r--r--   1 motub somegroup 204 sep 27 17:40 general_cvs.txt
drwxrwxr-x   3 motub somegroup1360 sep  6 23:23 hardware_man
drwxrwxr-x  10 motub somegroup 528 apr 26  2005 +hb_pers
drwxrwxr-x   6 motub somegroup3448 apr 26  2005 infodocs
-rw-rw-r--   1 motub somegroup  56 nov  3  2004 install_notes.txt
-rw-r--r--   1 motub somegroup   99957 okt 18 20:17 Manual.pdf
drwxrwxr-x   2 motub somegroup 240 sep  4 17:45 misc
drwxrwxr-x   3 motub somegroup1320 dec  9 21:46 miscpost
drwxrwxr-x   8 motub somegroup5808 mei 29  2005 misctech
-rw-r--r--   1 motub somegroup1661 jul 13 13:52 more_what works.txt
-rw-r--r--   1 motub somegroup1410 jul  2  2005 more_what works.txt~
drwxrwxr-x   2 motub somegroup3360 okt 19 01:38 my_scripts
-rw-r--r--   1 motub somegroup 262 okt  4 17:03
new_wine_install_notes.txt
drwxrwxr-x   2 motub somegroup2312 dec 24 15:42 output
-rw-rw-r--   1 motub somegroup5351 nov  6  2004 readme-queen.txt
-rw-rw-r--   1 motub somegroup   50744 nov  6  2004 README-scummvm.txt
drwxr-xr--   2 motub somegroup 120 okt 18 20:41 registry
drwx--   2 motub somegroup 112 jun 15  2005 .Trash-motub
-rw-r--r--   1 motub somegroup   75612 jun 16  2005 what_works.html

I see that many files that are more than a year old then are followed by
the year, but some are not, and some which are less than a year old are
followed by a year.

-rw-r--r--   1 motub somegroup1661 jul 13 13:52 more_what works.txt
(this must have been created in 2005)

but this file is less than a year old and is still fully dated:

-rw-rw-r--   1 motub somegroup 581 jan 31  2005 computeruniverse_rma.txt

But even leaving aside the inconsistencies (only for the purposes of
this discussion), this is not the behaviour I expect or in fact desire.
I normally expect the year to be displayed whenever the current calendar
year is different from that associated with the file-- thus, if the file
was created in 2006, I would not expect the year to be shown, but if it
was created in 2005, I would expect the year to be shown, whether or not
the current date was one year or more from the month and day that the
file was created.

Rather than go off on a rant, I will ask mildly: is there any way to
change the default behaviour to more reflect my expected behaviour? Not
so much asking you to tell me how to do it as asking if those of you who
have already read man ls whether there is a solution to be found when I
have the time to read it myself.

Thanks,
Holly
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Sergio Polini
Holly Bostick:
  [...]
  Sorry, couldn't help with the rest of your problem, but I think
  it is assumed that ls will display the year only for files older
  than a year old. Quite clever, in my opinion.

 OK, I see what you mean-- or maybe I don't:
 [...]
 I see that many files that are more than a year old then are
 followed by the year, but some are not, and some which are less
 than a year old are followed by a year.

Why bother?
Untar coreutils and look at src/ls.c:

static char const *long_time_format[2] =
  {
   /* strftime format for non-recent files (older than 6 months), in
  -l output when --time-style=locale is specified.  This should
  contain the year, month and day (at least), in an order that is
  understood by people in your locale's territory.
  Please try to keep the number of used screen columns small,
  because many people work in windows with only 80 columns. But
  make this as wide as the other string below, for recent files.*/
   N_(%b %e  %Y),
   /* strftime format for recent files (younger than 6 months), in
  -l output when --time-style=locale is specified.  This should
  contain the month, day and time (at least), in an order that is
  understood by people in your locale's territory.
  Please try to keep the number of used screen columns small,
  because many people work in windows with only 80 columns.  But
  make this as wide as the other string above, for non-recent
  files.  */
   N_(%b %e %H:%M)
  };

 But even leaving aside the inconsistencies (only for the purposes of
 this discussion), this is not the behaviour I expect or in fact
 desire. I normally expect the year to be displayed whenever the
 current calendar year is different from that associated with the
 file-- thus, if the file was created in 2006, I would not expect the
 year to be shown, but if it was created in 2005, I would expect the
 year to be shown, whether or not the current date was one year or
 more from the month and day that the file was created.

The code you should change is here:

static void print_long_format (const struct fileinfo *f) {
  char modebuf[12];
  

  if ((when_local = localtime (when)))
{
  time_t six_months_ago;
  int recent;
  char const *fmt;

  /* If the file appears to be in the future, update the current
 time, in case the file happens to have been modified since
 the last time we checked the clock.  */
  if (current_time  when
  || (current_time == when  current_time_ns  when_ns))
{
  /* Note that get_current_time calls gettimeofday which, on some non-
   compliant systems, clobbers the buffer used for localtime's result.
   But it's ok here, because we use a gettimeofday wrapper that
   saves and restores the buffer around the gettimeofday call.  */
  get_current_time ();
}

  /* Consider a time to be recent if it is within the past six
 months.  A Gregorian year has 365.2425 * 24 * 60 * 60 ==
 31556952 seconds on the average.  Write this value as an
 integer constant to avoid floating point hassles.  */
  six_months_ago = current_time - 31556952 / 2;
  recent = (six_months_ago = when
 (when  current_time
|| (when == current_time  when_ns = current_time_ns)));
  fmt = long_time_format[recent];
   
}

May be, you could add a command-line option ;-)

HTH
Sergio
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Willie Wong
On Sat, Jan 07, 2006 at 08:37:12PM +0100, Penguin Lover Sergio Polini squawked:
 May be, you could add a command-line option ;-)
 

And don't forget to open a bug and send in a patch! =)

W
-- 
Ugh! It's 1/2 C U ^2, saved by the bell, we've ran out of time.
   ~Prof. Kirk T. McDonald, DeathEM, P-town PHY 304
Sortir en Pantoufles: up 56 days, 13:05
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Willie Wong
On Sat, Jan 07, 2006 at 08:01:25PM +0100, Penguin Lover Holly Bostick squawked:
 Rather than go off on a rant, I will ask mildly: is there any way to
 change the default behaviour to more reflect my expected behaviour? Not
 so much asking you to tell me how to do it as asking if those of you who
 have already read man ls whether there is a solution to be found when I
 have the time to read it myself.
 

No command line option is listed in `man ls'

But you could, theoretically, with some awk magic, invoke 
ls --full-time, chop it up, use `date' to put the date into a format
you prefer, and put it back together. 

W
-- 
This class makes me feel like Ralph Wiggam...
~DeathMech, Some Student. P-town PHY 205
Sortir en Pantoufles: up 56 days, 13:06
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Mariusz Pękala
On 2006-01-07 20:01:25 +0100 (Sat, Jan), Holly Bostick wrote:
 Willie Wong schreef:
  On Sat, Jan 07, 2006 at 04:17:11PM +0100, Penguin Lover Holly Bostick
  squawked:
  
  (how do you get ls to also include the @#$%#$ *year*??)
  
  
  Sorry, couldn't help with the rest of your problem, but I think it is
   assumed that ls will display the year only for files older than a
  year old. Quite clever, in my opinion.
 
 OK, I see what you mean-- or maybe I don't:
 
 I see that many files that are more than a year old then are followed by
 the year, but some are not, and some which are less than a year old are
 followed by a year.
 
 -rw-r--r--   1 motub somegroup1661 jul 13 13:52 more_what works.txt
 (this must have been created in 2005)
 
 but this file is less than a year old and is still fully dated:
 
 -rw-rw-r--   1 motub somegroup 581 jan 31  2005 computeruniverse_rma.txt
 
 But even leaving aside the inconsistencies (only for the purposes of
 this discussion), this is not the behaviour I expect or in fact desire.
 I normally expect the year to be displayed whenever the current calendar
 year is different from that associated with the file-- thus, if the file
 was created in 2006, I would not expect the year to be shown, but if it
 was created in 2005, I would expect the year to be shown, whether or not
 the current date was one year or more from the month and day that the
 file was created.

It's a matter of taste, but I would rather keep this historical
behaviour. On January the 1st you would see tiestamps from yesterday
similiar to the 'very-old-ones'.

 Rather than go off on a rant, I will ask mildly: is there any way to
 change the default behaviour to more reflect my expected behaviour? Not
 so much asking you to tell me how to do it as asking if those of you who
 have already read man ls whether there is a solution to be found when I
 have the time to read it myself.

info ls, section * Formatting file timestamps::
 A timestamp is considered to be recent if it is less than six
months old, and is not dated in the future.

and further:
 For example, `--time-style=+%Y-%m-%d %H:%M:%S' causes...

HTH

-- 
No virus found in this outgoing message.
Checked by grep -i virus $MESSAGE


pgpspS7m4PXuO.pgp
Description: PGP signature


Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem

2006-01-07 Thread Willie Wong
On Sat, Jan 07, 2006 at 09:56:59PM +0100, Penguin Lover Mariusz P?kala squawked:
 info ls, section * Formatting file timestamps::
  A timestamp is considered to be recent if it is less than six
 months old, and is not dated in the future.
 
 and further:
  For example, `--time-style=+%Y-%m-%d %H:%M:%S' causes...
 
 HTH
 

grrr... curse gnu info. For some reason I *never* remember to look
there. Now, if only fvwm has a easily navigable info page instead of
the big man page...

W
-- 
Ford grabbed him by the lapels of his dressing gown and 
spoke to him as slowly and distinctly and patiently as if 
he were somebody from a telephone company accounts 
department. 

- Ford trying to rectify that situation. 
Sortir en Pantoufles: up 56 days, 14:29
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem [Date issue SOLVED]

2006-01-07 Thread Holly Bostick
Mariusz Pękala schreef:
 On 2006-01-07 20:01:25 +0100 (Sat, Jan), Holly Bostick wrote:
 
 Willie Wong schreef:
 
 On Sat, Jan 07, 2006 at 04:17:11PM +0100, Penguin Lover Holly 
 Bostick squawked:
 
 (how do you get ls to also include the @#$%#$ *year*??)
 
 Sorry, couldn't help with the rest of your problem, but I think 
 it is assumed that ls will display the year only for files older 
 than a year old. Quite clever, in my opinion.
 
 snip
 
 But even leaving aside the inconsistencies (only for the purposes 
 of this discussion), this is not the behaviour I expect or in fact 
 desire. I normally expect the year to be displayed whenever the 
 current calendar year is different from that associated with the 
 file
 
 snip
 
 Rather than go off on a rant, I will ask mildly: is there any way 
 to change the default behaviour to more reflect my expected 
 behaviour?
 
 info ls, section * Formatting file timestamps::


A-HA The 'Info' command, which I also always forget, not least
because I don't know how to navigate info files.

But this caused me to take another whack at it, and I got along well
enough to find a mostly acceptable way to reform the la alias to the
following:

alias la=ls --color -lAGbh --time-style='+%b %d %Y %H:%M'

which produces

zo 01/08/06 02:25
~/docs
motub - la
totaal 3,7M
-rw-r--r--   1 motub 1,3M okt 18 2005 20:17 autosc102.exe
drwxr-xr-x   6 motub  192 okt 30 2005 15:25 books
-r-xr-xr-x   1 motub 2,8K jan 27 2003 01:05 Buddies.xml
drwxrwxr-x   2 motub 1,2K jan 06 2006 22:42 cmds
-rw-rw-r--   1 motub  581 jan 31 2005 15:36 computeruniverse_rma.txt
drwxrwxr-x   5 motub 3,2K nov 21 2005 16:55 config
-rw-rw-r--   1 motub 3,9K nov 03 2004 19:18 depclean_data.txt
-rw-r--r--   1 motub  204 sep 27 2005 17:40 general_cvs.txt
drwxrwxr-x   3 motub 1,4K sep 06 2005 23:23 hardware_man
drwxrwxr-x  10 motub  528 apr 26 2005 01:30 +hb_pers
drwxrwxr-x   6 motub 3,4K apr 26 2005 01:29 infodocs
-rw-rw-r--   1 motub   56 nov 03 2004 15:47 install_notes.txt
-rw-r--r--   1 motub  98K okt 18 2005 20:17 Manual.pdf
drwxrwxr-x   2 motub  240 sep 04 2005 17:45 misc
drwxrwxr-x   3 motub 1,3K dec 09 2005 21:46 miscpost
drwxrwxr-x   8 motub 5,7K mei 29 2005 16:32 misctech
-rw-r--r--   1 motub 1,7K jul 13 2005 13:52 more_what\ works.txt
-rw-r--r--   1 motub 1,4K jul 02 2005 02:24 more_what\ works.txt~
drwxrwxr-x   2 motub 3,3K okt 19 2005 01:38 my_scripts
-rw-r--r--   1 motub  262 okt 04 2005 17:03 new_wine_install_notes.txt
-rwxrwxr-x   1 motub 2,6K jul 01 2004 20:28 nfo.nfo
drwxrwxr-x   2 motub 2,3K dec 24 2005 15:42 output
-rw-rw-r--   1 motub 5,3K nov 06 2004 02:48 readme-queen.txt
-rw-rw-r--   1 motub  50K nov 06 2004 02:48 README-scummvm.txt
drwxr-xr--   2 motub  120 okt 18 2005 20:41 registry
drwx--   2 motub  112 jun 15 2005 14:55 .Trash-motub
-rw-r--r--   1 motub  74K jun 16 2005 17:24 what_works.html

which is much more informative for me with 1) the group names removed
and 2) a more comprehensive and comprehensible date and size display.
Don't think I really need the inodes (if that's what they are, I
couldn't quite deciper info ls that far) before the owner name, but I
can live with that. The output doesn't even wrap in T-bird anymore, it's
so compact :D .

Anyway, not quite what I asked for, but it will definitely do. And I
kinda learned how to use info.

Thanks for all the help!

Holly
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem [Date issue SOLVED]

2006-01-07 Thread Richard Fish
On 1/7/06, Holly Bostick [EMAIL PROTECTED] wrote:
 Don't think I really need the inodes (if that's what they are, I

That is link count.  For a regular file, it tells how many hard
links exist to the file.  For a directory, it tells how many files are
in that directory +2, since . and .. count as links.

-Richard

-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem [Date issue SOLVED]

2006-01-07 Thread Holly Bostick
Richard Fish schreef:
 On 1/7/06, Holly Bostick [EMAIL PROTECTED] wrote:
 
 Don't think I really need the inodes (if that's what they are, I
 
 
 That is link count.  For a regular file, it tells how many hard 
 links exist to the file.  For a directory, it tells how many files
 are in that directory +2, since . and .. count as links.
 
 -Richard
 

Oh, thanks. They *are* useful then (not that everything isn't useful,
but I guess I mean to me), so I'll eye them with more respect in the
future.

:-)

Holly
-- 
gentoo-user@gentoo.org mailing list



Re: [gentoo-user] Re: ls date was: Bizarre etc/cfg-update problem [Date issue SOLVED]

2006-01-07 Thread Willie Wong
On Sun, Jan 08, 2006 at 02:41:35AM +0100, Penguin Lover Holly Bostick squawked:
 A-HA The 'Info' command, which I also always forget, not least
 because I don't know how to navigate info files.
 
 But this caused me to take another whack at it, and I got along well
 enough to find a mostly acceptable way to reform the la alias to the
 following:
 
 alias la=ls --color -lAGbh --time-style='+%b %d %Y %H:%M'
 

How about 
  alias ls='ls --color --time-style=+%b %d %Y %H:%M'
Really no need to link a command you are so familiar with to another name. 

[10:30 PM]wwong Sanskrit CD $ alias ls='ls --color --time-style=+%b %d %Y 
%H:%M'
[10:30 PM]wwong Sanskrit CD $ ls
track01.mp3  track03.mp3  track05.mp3  track07.mp3  track09.mp3
track02.mp3  track04.mp3  track06.mp3  track08.mp3
[10:31 PM]wwong Sanskrit CD $ ls -l
total 141484
-rw-r--r--  1 wwong root 45646253 Sep 13 2004 00:41 track01.mp3
-rw-r--r--  1 wwong root  5120539 Sep 13 2004 00:42 track02.mp3
-rw-r--r--  1 wwong root  7508899 Sep 13 2004 00:44 track03.mp3
-rw-r--r--  1 wwong root 10678627 Sep 13 2004 00:46 track04.mp3
-rw-r--r--  1 wwong root  8695930 Sep 13 2004 00:48 track05.mp3
-rw-r--r--  1 wwong root 17730432 Dec 11 2004 08:57 track06.mp3
-rw-r--r--  1 wwong root 16987392 Dec 11 2004 08:58 track07.mp3
-rw-r--r--  1 wwong root 14897664 Dec 11 2004 09:01 track08.mp3
-rw-r--r--  1 wwong root 17447040 Dec 11 2004 09:03 track09.mp3

W
-- 
I'll get to something useful in a moment.
~DeathMech, S. Sondhi. P-town PHY 205
Sortir en Pantoufles: up 56 days, 19:48
-- 
gentoo-user@gentoo.org mailing list