Re: finger pinky commands reports improper exit status
On 7/4/08, Jim Meyering [EMAIL PROTECTED] wrote: Halesh S [EMAIL PROTECTED] wrote: The last patch has missied for no-args. The attached patch will fix the issue. Thanks for the work and patches. However, before I can accept it, here are some things you'll need to do: - also work with -l (long_pinky) Done and tested. - pinky (with no arguments) should not fail when there are no entries. Done and tested. - use error (EXIT_FAILURE, 0,... , not fprintf (stderr...+exit 1. Done. - don't use negation in a variable name: use bool match = false;, not... Done. - use indentation that's consistent with surrounding code Followed. Also, please read the guidelines in the relatively new file, HACKING. (get a copy via git clone git://git.sv.gnu.org/coreutils) In particular, you'll have to write a ChangeLog entry that will serve as commit log message and to run git format-patch to produce the patch you eventually send. I am not able to it.. I have attached a patch. If possible you do the git. Thanks, Halesh pinky.c.patch Description: Binary data ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
finger pinky commands reports improper exit status
Test 1: -- $ finger some-user finger: 1: no such user. $echo $? 0 Test 2: -- $pinky some-user LoginName TTY Idle When Where $echo $? 0 Verified in coreutils-6.9 Patch to fix the issue in pinky(1) ---old.src/pinky.c 2008-07-03 12:48:49.0 +0530 +++ src/pinky.c 2008-07-03 12:48:18.0 +0530 @@ -438,6 +438,7 @@ scan_entries (size_t n, const STRUCT_UTMP *utmp_buf, const int argc_names, char *const argv_names[]) { + int not_found_flg = 1; if (hard_locale (LC_TIME)) { time_format = %Y-%m-%d %H:%M; @@ -464,6 +465,7 @@ if (strncmp (UT_USER (utmp_buf), argv_names[i], UT_USER_SIZE) == 0) { + not_found_flg = 0; print_entry (utmp_buf); break; } @@ -473,6 +475,12 @@ } utmp_buf++; } + if (not_found_flg) + { +fprintf (stderr, _(no user found.\n), + program_name); + exit(1); + } } /* Display a list of who is on the system, according to utmp file FILENAME. */ === After applaying patch Test 2 - $pinky some-user LoginName TTY Idle When Where no user found. $echo $? 1 Thanks, Halesh ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: finger pinky commands reports improper exit status
The last patch has missied for no-args. The attached patch will fix the issue. Thanks, Halesh n 7/3/08, Halesh S [EMAIL PROTECTED] wrote: Test 1: -- $ finger some-user finger: 1: no such user. $echo $? 0 Test 2: -- $pinky some-user LoginName TTY Idle When Where $echo $? 0 Verified in coreutils-6.9 Patch to fix the issue in pinky(1) ---old.src/pinky.c 2008-07-03 12:48:49.0 +0530 +++ src/pinky.c 2008-07-03 12:48:18.0 +0530 @@ -438,6 +438,7 @@ scan_entries (size_t n, const STRUCT_UTMP *utmp_buf, const int argc_names, char *const argv_names[]) { + int not_found_flg = 1; if (hard_locale (LC_TIME)) { time_format = %Y-%m-%d %H:%M; @@ -464,6 +465,7 @@ if (strncmp (UT_USER (utmp_buf), argv_names[i], UT_USER_SIZE) == 0) { + not_found_flg = 0; print_entry (utmp_buf); break; } @@ -473,6 +475,12 @@ } utmp_buf++; } + if (not_found_flg) + { +fprintf (stderr, _(no user found.\n), + program_name); + exit(1); + } } /* Display a list of who is on the system, according to utmp file FILENAME. */ === After applaying patch Test 2 - $pinky some-user LoginName TTY Idle When Where no user found. $echo $? 1 Thanks, Halesh pinky.c.patch Description: Binary data ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils