[PATCH]: who -r empty last runlevel + missing informations about some who options in coreutils.texi

2008-07-02 Thread Ondřej Vašík
Hello,
In rhbz #453249 Gian Piero De Lolliis ([EMAIL PROTECTED]) reported missing last
runlevel in who -r. Command runlevel displayed last runlevel 'N' - which
should be displayed as last=S in who -r. Attached patch fixes that issue
(another possibility could be to not display last= at all for this
case). As this is just a small change I think it doesn't deserve
mentioning in NEWS.

Additionally I found that there are some options missing in
coreutils.texi who section. I added just the options + basic info from
help, it would be good to extend it, but this is at least first step.

Greetings,
 Ondrej Vasik

From 275644abc591d1e8652263e1ace62012f1292994 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED]
Date: Wed, 2 Jul 2008 13:38:15 +0200
Subject: [PATCH] *src/who.c: handle empty last runlevel in who -r  as 'S'.


Signed-off-by: Ondřej Vašík [EMAIL PROTECTED]
---
 src/who.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/who.c b/src/who.c
index 5529618..952023a 100644
--- a/src/who.c
+++ b/src/who.c
@@ -508,7 +508,7 @@ print_runlevel (const STRUCT_UTMP *utmp_ent)
 
   if (!comment)
 comment = xmalloc (strlen (_(last=)) + 2);
-  sprintf (comment, %s%c, _(last=), (last == 'N') ? 'S' : last);
+  sprintf (comment, %s%c, _(last=), (!last || last == 'N') ? 'S' : last);
 
   print_line (-1, , ' ', -1, runlevline, time_string (utmp_ent),
 	  , , comment, );
-- 
1.5.2.2


From 10db2e5e05c67eea205b3ec76a2408f46356a7fd Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED]
Date: Wed, 2 Jul 2008 14:11:05 +0200
Subject: [PATCH] *doc/coreutils.texi: Mention some missing options for who command


Signed-off-by: Ondřej Vašík [EMAIL PROTECTED]
---
 doc/coreutils.texi |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 155ba8d..c0ea237 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12710,6 +12710,24 @@ automatic dial-up internet access.
 @opindex --heading
 Print a line of column headings.
 
[EMAIL PROTECTED] -p
[EMAIL PROTECTED] --process
[EMAIL PROTECTED] -p
[EMAIL PROTECTED] --process
+Print active processes spawned by init.
+
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] --runlevel
[EMAIL PROTECTED] -r
[EMAIL PROTECTED] --runlevel
+Print current and last runlevel. 
+
[EMAIL PROTECTED] -t
[EMAIL PROTECTED] --time
[EMAIL PROTECTED] -t
[EMAIL PROTECTED] --time
+Print last system clock change. 
+
 @item -w
 @itemx -T
 @itemx --mesg
-- 
1.5.2.2



signature.asc
Description: Toto je digitálně	 podepsaná část	 zprávy
___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


echo -e bug

2008-07-02 Thread Andrew Panin
Hi!

I can't make echo to show \n and \r symbols. According to 'man echo',
there's a way to do this by using '-e' option.

However, this doesn't help. Doesn't even matter which option I choose
(even 'echo -e \015'), it just shows '015' literally.

A bug?



-- 
ICQ: 343-260-671 | Skype: andrew.panin | +7 (923) 401-14-88


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: [PATCH]: Fix for several getdate.y issues

2008-07-02 Thread Jim Meyering
Ondřej Vašík [EMAIL PROTECTED] wrote:
...
 From 9eb2711cd03b3825e36cff33e7e7fccbbfc504d1 Mon Sep 17 00:00:00 2001
 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= [EMAIL PROTECTED]
 Date: Fri, 27 Jun 2008 17:37:40 +0200
 Subject: [PATCH] *lib/getdate.y: Factorize duplicate code for relative time 
 offset and hhmmss times.

I'm looking at this factorization-only patch, now.
Here are the changes I'm merging with yours:
  - add a ChangeLog entry
  - don't add trailing blanks
  - don't add lines longer than 80
  - adjust indentation and formatting to match existing style
  - renamed the new functions

diff --git a/ChangeLog b/ChangeLog
index b9076e2..b5d4f05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-02  Ondřej Vašík  [EMAIL PROTECTED]
+
+   getdate.y: factor out common actions
+   * lib/getdate.y (apply_relative_time, set_hhmmss): New functions.
+   Use them in place of open-coded actions.
+
 2008-07-01  Simon Josefsson  [EMAIL PROTECTED]

Add self-test for getdate module.
diff --git a/lib/getdate.y b/lib/getdate.y
index b9566a5..9171147 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -246,28 +246,29 @@ digits_to_date_time (parser_control *pc, textint text_int)
 }
 }

-/* Extract relative time multiplied by factor into *pc */
+/* Increment PC-rel by FACTOR * REL (FACTOR is 1 or -1).  */
 static void
-extract_relative_time (parser_control *pc, relative_time rel, int factor)
+apply_relative_time (parser_control *pc, relative_time rel, int factor)
 {
-   pc-rel.ns += factor*rel.ns;
-   pc-rel.seconds += factor*rel.seconds;
-   pc-rel.minutes += factor*rel.minutes;
-   pc-rel.hour += factor*rel.hour;
-   pc-rel.day += factor*rel.day;
-   pc-rel.month += factor*rel.month;
-   pc-rel.year += factor*rel.year;
-   pc-rels_seen = true;
-} 
-
-/* Extract hours, minutes, seconds and nanoseconds from arguments into *pc */
-static void 
-extract_hhmmss (parser_control *pc, long int ho, long int mi, time_t sec, long 
int nsec)
+  pc-rel.ns += factor * rel.ns;
+  pc-rel.seconds += factor * rel.seconds;
+  pc-rel.minutes += factor * rel.minutes;
+  pc-rel.hour += factor * rel.hour;
+  pc-rel.day += factor * rel.day;
+  pc-rel.month += factor * rel.month;
+  pc-rel.year += factor * rel.year;
+  pc-rels_seen = true;
+}
+
+/* Set PC- hour, minutes, seconds and nanoseconds members from arguments.  */
+static void
+set_hhmmss (parser_control *pc, long int hour, long int minutes,
+   time_t sec, long int nsec)
 {
-   pc-hour = ho;
-   pc-minutes = mi;
-   pc-seconds.tv_sec = sec;
-   pc-seconds.tv_nsec = nsec;
+  pc-hour = hour;
+  pc-minutes = minutes;
+  pc-seconds.tv_sec = sec;
+  pc-seconds.tv_nsec = nsec;
 }

 %}
@@ -344,29 +345,29 @@ item:
 time:
 tUNUMBER tMERIDIAN
   {
-   extract_hhmmss (pc, $1.value, 0, 0, 0);
+   set_hhmmss (pc, $1.value, 0, 0, 0);
pc-meridian = $2;
   }
   | tUNUMBER ':' tUNUMBER o_merid
   {
-   extract_hhmmss (pc, $1.value, $3.value, 0, 0);
+   set_hhmmss (pc, $1.value, $3.value, 0, 0);
pc-meridian = $4;
   }
   | tUNUMBER ':' tUNUMBER tSNUMBER o_colon_minutes
   {
-   extract_hhmmss (pc, $1.value, $3.value, 0, 0);
+   set_hhmmss (pc, $1.value, $3.value, 0, 0);
pc-meridian = MER24;
pc-zones_seen++;
pc-time_zone = time_zone_hhmm ($4, $5);
   }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds o_merid
   {
-   extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+   set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
pc-meridian = $6;
   }
   | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER o_colon_minutes
   {
-   extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
+   set_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec);
pc-meridian = MER24;
pc-zones_seen++;
pc-time_zone = time_zone_hhmm ($6, $7);
@@ -391,7 +392,7 @@ zone:
   { pc-time_zone = $1; }
   | tZONE relunit_snumber
   { pc-time_zone = $1;
-  extract_relative_time (pc, $2, 1); }
+   apply_relative_time (pc, $2, 1); }
   | tZONE tSNUMBER o_colon_minutes
   { pc-time_zone = $1 + time_zone_hhmm ($2, $3); }
   | tDAYZONE
@@ -498,9 +499,9 @@ date:

 rel:
 relunit tAGO
-  {extract_relative_time (pc, $1, -1); }
+  { apply_relative_time (pc, $1, -1); }
   | relunit
-  { extract_relative_time (pc, $1, 1); }
+  { apply_relative_time (pc, $1, 1); }
   ;

 relunit:
@@ -587,7 +588,7 @@ hybrid:
/* Hybrid all-digit and relative offset, so that we accept e.g.,
   MMDD +N days as well as MMDD N days.  */
digits_to_date_time (pc, $1);
-   extract_relative_time (pc, $2, 1);
+   apply_relative_time (pc, $2, 1);
   }
   ;



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: echo -e bug

2008-07-02 Thread Micah Cowan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Andrew Panin wrote:
 Hi!
 
 I can't make echo to show \n and \r symbols. According to 'man echo',
 there's a way to do this by using '-e' option.
 
 However, this doesn't help. Doesn't even matter which option I choose
 (even 'echo -e \015'), it just shows '015' literally.

More likely, shell interpretation. The shell will turn a bare \015 into
015. Try quoting it, such as with '\015' or \\015.

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer,
and GNU Wget Project Maintainer.
http://micah.cowan.name/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIa6Yd7M8hyUobTrERAuGWAJ9qMK0eAqzi6VFYN9ciuXGoX1pOnQCfX3rU
Yxce1wcigJKUviZcnBFHeUk=
=/M09
-END PGP SIGNATURE-


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils