summaryrefslogtreecommitdiff
path: root/src/daemontools-extras/s6-log.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2019-12-23 13:05:25 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2019-12-23 13:05:25 +0000
commit07491df186d562d0efa6a7fca2b7f8d07dbd0652 (patch)
treed66a8709a82b4c621c5f21a7f346362e8a243a3f /src/daemontools-extras/s6-log.c
parent8bbfc319248c0cbeb57edc45f26d1c972d32f505 (diff)
downloads6-07491df186d562d0efa6a7fca2b7f8d07dbd0652.tar.xz
Make execline dependency optional
This includes: - adding a configure option to disable execline support - duplicating el_semicolon() and el_getstrict() into the s6 library when execline is disabled at build time, making a compat shim and using it where needed (s6-svlisten, s6-ftrig-listen) - Creating alternatives for execlineb script spawning: * s6-log: '?' directive (done in the previous commit) * s6-notifyoncheck: require hardcoding the check in ./data/check * s6-ipcserver-access: no support for exec files, add a warning - Updating the relevant parts of the doc --enable-execline will remain the default, and whiners can choke on their tears.
Diffstat (limited to 'src/daemontools-extras/s6-log.c')
-rw-r--r--src/daemontools-extras/s6-log.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
index 6b2035e..54b945f 100644
--- a/src/daemontools-extras/s6-log.c
+++ b/src/daemontools-extras/s6-log.c
@@ -34,7 +34,11 @@
#include <skalibs/skamisc.h>
#include <skalibs/environ.h>
+#include <s6/config.h>
+
+#ifdef S6_USE_EXECLINE
#include <execline/config.h>
+#endif
#define USAGE "s6-log [ -d notif ] [ -q | -v ] [ -b ] [ -p ] [ -t ] [ -e ] [ -l linelimit ] logging_script"
#define dieusage() strerr_dieusage(100, USAGE)
@@ -304,7 +308,11 @@ static int finish (logdir_t *ldp, char const *name, char suffix)
static inline void exec_processor (logdir_t *ldp)
{
+#ifdef S6_USE_EXECLINE
char const *cargv[4] = { ldp->flags & 4 ? "/bin/sh" : EXECLINE_EXTBINPREFIX "execlineb", ldp->flags & 4 ? "-c" : "-Pc", ldp->processor, 0 } ;
+#else
+ char const *cargv[4] = { "/bin/sh", "-c", ldp->processor, 0 } ;
+#endif
int fd ;
PROG = "s6-log (processor child)" ;
if (chdir(ldp->dir) < 0) strerr_diefu2sys(111, "chdir to ", ldp->dir) ;
@@ -713,7 +721,9 @@ static inline void script_firstpass (char const *const *argv, unsigned int *sell
case 'r' :
case 'E' :
case '^' :
+#ifdef S6_USE_EXECLINE
case '!' :
+#endif
case '?' :
break ;
case 't' :
@@ -838,10 +848,12 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
case '^' :
if (!uint0_scan(*argv + 1, &status_size)) goto fail ;
break ;
+#ifdef S6_USE_EXECLINE
case '!' :
processor = (*argv)[1] ? *argv + 1 : 0 ;
flags &= ~4 ;
break ;
+#endif
case '?' :
processor = (*argv)[1] ? *argv + 1 : 0 ;
flags |= 4 ;