ref: 5f5d088f3b4df982a67164526043394648987c68
parent: 9fe184eb7f41fc76c2196e8d84d6f188c3469a93
author: Jacob Moody <[email protected]>
date: Thu Jul 20 11:16:25 EDT 2023
add -b flag to fork in to background
--- a/cpu.c
+++ b/cpu.c
@@ -106,7 +106,7 @@
void
usage(void)
{
- fprint(2, "Usage: %s [ -R ] [ -u user ] [ -h host ] [ -a authserver ] -p port cmd...\n", argv0);
+ fprint(2, "Usage: %s [ -Rb ] [ -u user ] [ -h host ] [ -a authserver ] -p port cmd...\n", argv0);
exits("usage");
}
@@ -114,6 +114,7 @@
main(int argc, char **argv)
{
int Rflag;
+ int bflag;
int fd;
char buf2[1024];
char buf[1024];
@@ -127,7 +128,7 @@
pid_t xferc;
xferc = 0;
- Rflag = 0;
+ Rflag = bflag = 0;
infd = 0;
outfd = 1;
user = getenv("USER");
@@ -142,6 +143,8 @@
case 'a': authserver = EARGF(usage()); break;
case 'p': port = EARGF(usage()); break;
case 'R': Rflag++; break;
+ case 'b': bflag++; break;
+ default: usage(); break;
} ARGEND
if(Rflag)
@@ -214,6 +217,17 @@
snprint(buf2, sizeof buf2, "%7d\n", i);
tls_send(-1, buf2, strlen(buf2));
tls_send(-1, buf, i);
+ }
+
+ if(bflag){
+ switch(fork()){
+ case -1:
+ sysfatal("fork");
+ case 0:
+ break;
+ default:
+ return 0;
+ }
}
signal(SIGUSR1, suicide);
--- a/tlsclient.1
+++ b/tlsclient.1
@@ -4,7 +4,7 @@
.SH SYNOPSIS
.B tlsclient
[
-.B -R
+.B -bR
]
[
.B -u
@@ -51,6 +51,9 @@
mode, if
.I command
is not specified a rc login shell is used.
+The
+.B -b
+flag causes tlsclient to fork into the background.
.SH PASSWORDS
By default
.B tlsclient