File: kill-last-fprintf-stderr-stragglers.patch

package info (click to toggle)
xtrs 4.9d-2.1
  • links: PTS
  • area: contrib
  • in suites: sid, trixie
  • size: 5,480 kB
  • sloc: ansic: 72,545; makefile: 1,633; sh: 554; csh: 132
file content (30 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (2)
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
29
30
Convert only remaining uses of fprintf(stderr, ...) in xtrs to use the
functions in error.c instead.

Upstream may prefer to simply migrate an error from XOpenDisplay() to
fatal(); my approach preserves the unique exit status of this situation.

-- Branden Robinson, 2017-04-17T01:43:21-0400
--- a/trs_xinterface.c
+++ b/trs_xinterface.c
@@ -255,7 +255,7 @@
   (void) XrmGetResource(command_db, option, "Xtrs.Display", &type, &value);
   /* open display */
   if ( (display = XOpenDisplay (value.addr)) == NULL) {
-    fprintf(stderr, "Unable to open display.");
+    error("unable to open display");
     exit(-1);
   }
 
--- a/main.c
+++ b/main.c
@@ -119,8 +119,7 @@
 
     argc = trs_parse_command_line(argc, argv, &debug);
     if (argc > 1) {
-      fprintf(stderr, "%s: erroneous argument %s\n", program_name, argv[1]);
-      exit(1);
+      fatal("erroneous argument \"%s\"", argv[1]);
     }
     mem_init();
     trs_screen_init();