summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-04-21 12:39:30 +0000
committerLaurent Bercot <ska@appnovation.com>2023-04-21 12:39:30 +0000
commit74ee963d3b9c8a007d3dd357fae21d710fd61d34 (patch)
tree2d45cfff8eed4dfcb310730ef4fc4be5beb119ef
parentaaaad5c4d2196adb4907f09d161bf8f9146fa0ae (diff)
downloadexecline-74ee963d3b9c8a007d3dd357fae21d710fd61d34.tar.gz
execline-74ee963d3b9c8a007d3dd357fae21d710fd61d34.tar.xz
execline-74ee963d3b9c8a007d3dd357fae21d710fd61d34.zip
Add dummy -e option to execlineb
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--doc/execlineb.html10
-rw-r--r--src/execline/execlineb.c5
2 files changed, 11 insertions, 4 deletions
diff --git a/doc/execlineb.html b/doc/execlineb.html
index f9d3e4d..ff9fe5c 100644
--- a/doc/execlineb.html
+++ b/doc/execlineb.html
@@ -27,7 +27,7 @@ then executes into that command line.
 <h2> Interface </h2>
 
 <pre>
-     execlineb [ -q | -w | -W ] [ -p | -P | -S <em>nmin</em> | -s <em>nmin</em> ] -c <em>script</em> [ <em>args...</em> ]
+     execlineb [ -q | -w | -W ] [ -p | -P | -S <em>nmin</em> | -s <em>nmin</em> ] [ -e ] -c <em>script</em> [ <em>args...</em> ]
 </pre>
 
 <p>
@@ -35,7 +35,7 @@ or
 </p>
 
 <pre>
-     execlineb [ -q | -w | -W ] [ -p | -P | -S <em>nmin</em> | -s <em>nmin</em> ] <em>scriptfile</em> [ <em>args...</em> ]
+     execlineb [ -q | -w | -W ] [ -p | -P | -S <em>nmin</em> | -s <em>nmin</em> ] [ -e ] <em>scriptfile</em> [ <em>args...</em> ]
 </pre>
 
 <p>
@@ -100,6 +100,12 @@ not stay in memory like a traditional <em>interpreter</em> would. </li>
 <h2> Options </h2>
 
 <ul>
+ <li> <tt>-e</tt>&nbsp;: this option is ignored. This is meant to support
+the use of execlineb in conjuction with programs that invoke
+<tt>$SHELL -ec <em>script</em></tt>; the effect of <tt>/bin/sh -e</tt>
+can be natively replicated in execline scripts if you use the
+<a href="if.html">if</a> command instead of the
+<a href="foreground.html">foreground</a> command. </li>
  <li> <tt>-c&nbsp;<em>script</em></tt>&nbsp;: execute <em>script</em>, do not
 look for a file. </li>
 </ul>
diff --git a/src/execline/execlineb.c b/src/execline/execlineb.c
index 89688f6..5b081a0 100644
--- a/src/execline/execlineb.c
+++ b/src/execline/execlineb.c
@@ -18,7 +18,7 @@
 #include <execline/execline.h>
 #include "exlsn.h"
 
-#define USAGE "execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W ] [ -c commandline ] script args"
+#define USAGE "execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W ] [ -e ] [ -c commandline ] script args"
 
 static int myexlp (stralloc *sa, char const *const *argv, unsigned int argc, unsigned int nmin, char const *dollar0, int doshift)
 {
@@ -83,7 +83,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
     subgetopt l = SUBGETOPT_ZERO ;
     for (;;)
     {
-      int opt = subgetopt_r(argc, argv, "pPqwWc:S:s:", &l) ;
+      int opt = subgetopt_r(argc, argv, "pPqwWec:S:s:", &l) ;
       if (opt == -1) break ;
       switch (opt)
       {
@@ -93,6 +93,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
         case 'w' : flagstrict = 1 ; break ;
         case 'W' : flagstrict = 2 ; break ;
         case 'c' : stringarg = l.arg ; break ;
+        case 'e' : break ;
         case 'S' :
         case 's' :
         {