From ade001ac129da722dc2cc4268666525394af3f97 Mon Sep 17 00:00:00 2001 From: mbays Date: Wed, 12 Jul 2023 00:00:00 +0000 Subject: [PATCH] add --no-link option --- main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index dc35d31..ea4934a 100644 --- a/main.c +++ b/main.c @@ -55,6 +55,7 @@ typedef struct State { int max_children; int read_timeout; int pause_timeout; + bool nolink; int num_children; Child children[MAX_CHILDREN]; @@ -304,6 +305,8 @@ static Child *get_session(State *state, const Request_Info *request_info, int so child->newborn = true; set_child_last_active(child); + child->nolink = state->nolink; + put("30 "); put(request_info->script_path); put("/"); @@ -560,6 +563,7 @@ static void usage() printf(" -t MS --read-timeout=MS Time to wait for child to start writing (%d)\n", DEF_READ_TIMEOUT); printf(" -T MS --pause-timeout=MS Silence period after which child is paused (%d)\n", DEF_PAUSE_TIMEOUT); printf(" -S --synchronous Disable timeouts. Use fd 3 instead (see docs).\n"); + printf(" -L --no-link Don't write input links.\n"); printf(" -n --lf-crlf Convert \\n to \\r\\n (default unless --format=raw)\n"); printf(" -N --no-lf-crlf Preserve newlines\n"); printf(" -f FMT --format=FMT Format of output of command. Possible formats:\n"); @@ -605,6 +609,7 @@ int main(int argc, char **argv) { { "help", 0, NULL, 'h' } , { "socket", 1, NULL, 's' } , { "format", 1, NULL, 'f' } + , { "no-link", 1, NULL, 'L' } , { "max-children", 1, NULL, 'm' } , { "read-timeout", 1, NULL, 't' } , { "pause-timeout", 1, NULL, 'T' } @@ -615,7 +620,7 @@ int main(int argc, char **argv) }; int o; const char *socketname = NULL; - while (-1 != (o = getopt_long(argc, argv, "+hs:f:m:t:T:SnN", longoptions, NULL))) { + while (-1 != (o = getopt_long(argc, argv, "+hs:f:Lm:t:T:SnN", longoptions, NULL))) { switch (o) { case 'h': case '?': @@ -634,6 +639,9 @@ int main(int argc, char **argv) exit(1); } break; + case 'L': + state.nolink = true; + break; case 'm': state.max_children = atoi(optarg); if (state.max_children <= 0 || state.max_children > MAX_CHILDREN) { -- 2.11.4.GIT