Hi,

I'm not sure I can follow you here:

> Alternatively, you can call bye_bye() with the
> dont_care_sig parameter, but be aware that there are a few functions
> that take the dont_care_sig parameter, but throw that value away.

The other installed signal-handlers suspend() and wins_resize_sighandler()
are throwing it away because their action doesn't depend on the exact
signal delivered - but end_pgm() should certainly base the exit code
that it's going to pass on to bye_bye() on the incoming parameter.

Patch attached.


Regards,

Jan
#! /bin/sh /usr/share/dpatch/dpatch-run
## 45_top_exitcode.dpatch by  <[EMAIL PROTECTED]>
##
## DP: Make top exit with return code 0 if the program was closed
## DP: cleanly ('q' or end of iteration loop).

@DPATCH@
--- procps-3.2.7/top.cO 2007-08-06 15:57:04.000000000 +0200
+++ procps-3.2.7/top.c  2007-08-06 16:04:07.000000000 +0200
@@ -402,14 +402,13 @@
 
 
         /*
-         * Normal end of execution.
+         * Normal end of execution. Exit with 1 if signaled, else 0.
          * catches:
          *    SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */
-static void end_pgm (int dont_care_sig) NORETURN;
-static void end_pgm (int dont_care_sig)
+static void end_pgm (int sig) NORETURN;
+static void end_pgm (int sig)
 {
-   (void)dont_care_sig;
-   bye_bye(stdout, 1, NULL);
+   bye_bye(stdout, !!sig, NULL);
 }
 
 

Attachment: signature.asc
Description: Digital signature

Reply via email to