File: 45_top_exitcode.dpatch

package info (click to toggle)
procps 1%3A3.2.7-11
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,620 kB
  • ctags: 1,764
  • sloc: ansic: 14,645; sh: 5,299; makefile: 216
file content (28 lines) | stat: -rw-r--r-- 847 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/sh /usr/share/dpatch/dpatch-run
## 45_top_exitcode.dpatch by  <hesso@pool.math.tu-berlin.de>
##
## 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);
 }