chiark / gitweb /
prefork-interp: fix a comment char
[chiark-utils.git] / cprogs / prefork-interp.c
index 6ee253fbd09ca96fad8e6489a76b6e865c9e9880..22cdc7d32daf985231593e6460a26786a22f595d 100644 (file)
@@ -6,6 +6,12 @@
  *   prefork-interp  [<option> ..] <interpreter>  [<script> [<args> ...]]
  *   prefork-interp  [<option>,..],<interpreter>   <script> [<args> ...]
  *   prefork-interp '[<option> ..] <interpreter>'  <script> [<args> ...]
+ *
+ * Options must specify argument laundering mode.
+ * Currently the only mode supported is:
+ *   -U    unlaundered: setup and executor both get all arguments and env vars
+ *         ident covers only env vars specified  with -E
+ *         ident covers only arguments interpreter and (if present) script
  */
 /*
  * Process structure:
@@ -33,7 +39,7 @@
  *                            forks for server
  *                [2]         exits
  *
#        server (pm) [1]     [fd0: null],
*        server (pm) [1]     [fd0: null],
  *                            [fd[12]: fd2-from-outer]
  *                            right away, forks init monitor
  *                    [2]     closes outer caller fds and call(fake)
@@ -95,8 +101,11 @@ void fusagemessage(FILE *f) {
   fprintf(f, "usage: #!/usr/bin/prefork-interp [<options>]\n");
 }
 
+static int laundering;
+
 const struct cmdinfo cmdinfos[]= {
   PREFORK_CMDINFOS
+  { 0, 'U',   0,                    .iassignto= &laundering,    .arg= 'U' },
   { 0 }
 };
 
@@ -381,6 +390,11 @@ static FILE *connect_or_spawn(void) {
 }
 
 static void make_executor_argv(const char *const *argv) {
+  switch (laundering) {
+  case 'U': break;
+  default: die("need -U (specifying unlaundered argument handling)");
+  }
+
   const char *arg;
   #define EACH_NEW_ARG(EACH) {                 \
     arg = interp; { EACH }                     \