tAdd modal plumber - sacc - sacc (saccomys): simple gopher client.
Log
Files
Refs
LICENSE
---
commit 12b8b8a338d1791ce2d200f7cad99c9f0b5804d1
parent 7e0793d8395184b5b21ecdd0b13bccb524d1e414
Author: escapeinsert 
Date:   Sat,  2 Oct 2021 15:19:30 -0400

Add modal plumber

With this option activated, sacc will wait for the plumber to return
before continuing its execution.

Diffstat:
  M config.def.h                        |       3 +++
  M sacc.c                              |       5 +++++

2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/config.def.h b/config.def.h
t@@ -23,6 +23,9 @@
 /* default plumber */
 static char *plumber = "xdg-open";
 
+/* modal plumber will make sacc wait for the plumber to return */
+static int modalplumber = 0;
+
 /* temporary directory template (must end with six 'X' characters) */
 static char tmpdir[] = "/tmp/sacc-XXXXXX";
 
diff --git a/sacc.c b/sacc.c
t@@ -651,6 +651,11 @@ plumb(char *url)
                 dup2(devnullfd, 2);
                 if (execlp(plumber, plumber, url, NULL) == -1)
                         _exit(1);
+        default:
+                if (modalplumber) {
+                        while (waitpid(-1, NULL, 0) != -1)
+                                ;
+                }
         }
 
         diag("Plumbed \"%s\"", url);