abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit fd34b98db77accb3a43f220a0639cba8132834c3
parent c901f2bbb8ac7eb8d3daf15be948bc1c0da80ea5
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sat, 17 Mar 2018 12:29:31 +0100

Add explicit option for command pass through

This allows commands to be send interactively (i.e. when stdin refers
to a terminal). Also imply attach action if none is given, hence:

    $ abduco -p session
    cowsay hi
    ^D

can also be used to send input to a session.

Diffstat:
abduco.1 | 12++++++++++--
abduco.c | 9+++++++--
2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/abduco.1 b/abduco.1 @@ -77,8 +77,9 @@ domain socket representing a session is deleted, sending .BR SIGUSR1 to the server process will recreate it. -If standard input does not refer to a terminal, its content is passed -through to the underlying session. +If standard input does not refer to a terminal (or the +.B -p +option was given), its content is passed through to the underlying session. .SH OPTIONS If no command line arguments are given all currently active sessions are printed sorted by their respective creation date. Lines starting with an @@ -120,6 +121,13 @@ Attach with the lowest priority, meaning this client will be the last to control .TP .BI \-q Be quiet, do not print informative messages. +.TP +.BI \-p +Pass through content of standard input to the session. Implies the +.B \-q +and +.B \-l +options. .SH EXAMPLE Start a new session (assuming .BR dvtm(1) diff --git a/abduco.c b/abduco.c @@ -222,7 +222,7 @@ static void die(const char *s) { } static void usage(void) { - fprintf(stderr, "usage: abduco [-a|-A|-c|-n] [-r] [-q] [-l] [-f] [-e detachkey] name command\n"); + fprintf(stderr, "usage: abduco [-a|-A|-c|-n] [-p] [-r] [-q] [-l] [-f] [-e detachkey] name command\n"); exit(EXIT_FAILURE); } @@ -590,7 +590,7 @@ int main(int argc, char *argv[]) { passthrough = !isatty(STDIN_FILENO); - while ((opt = getopt(argc, argv, "aAclne:fqrv")) != -1) { + while ((opt = getopt(argc, argv, "aAclne:fpqrv")) != -1) { switch (opt) { case 'a': case 'A': @@ -608,6 +608,9 @@ int main(int argc, char *argv[]) { case 'f': force = true; break; + case 'p': + passthrough = true; + break; case 'q': quiet = true; break; @@ -626,6 +629,8 @@ int main(int argc, char *argv[]) { } if (passthrough) { + if (!action) + action = 'a'; quiet = true; client.flags |= CLIENT_LOWPRIORITY; }