summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-11-27 16:13:33 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-11-27 16:13:33 +0000
commit839f58e99af49deaa14da76a10635086175145d6 (patch)
treef10d165c087bdeeb242683cb8c4909d86f7294fb /sys/src/cmd/aux
parentff2ebe6cfdacd890a74a6d2f9b0acd062d2633b7 (diff)
trampoline: Add -o option to send protocol-specific ctl string
Diffstat (limited to 'sys/src/cmd/aux')
-rw-r--r--sys/src/cmd/aux/trampoline.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/src/cmd/aux/trampoline.c b/sys/src/cmd/aux/trampoline.c
index c775fa61a..8e16d099e 100644
--- a/sys/src/cmd/aux/trampoline.c
+++ b/sys/src/cmd/aux/trampoline.c
@@ -28,10 +28,13 @@ int macok(char*);
int timeout;
int activity;
+int nopts;
+char *opts[16];
+
void
usage(void)
{
- fprint(2, "usage: trampoline [-9] [-a addr] [-m netdir] [-t timeout] addr\n");
+ fprint(2, "usage: trampoline [-9] [-a addr] [-m netdir] [-o opt] [-t timeout] addr\n");
exits("usage");
}
@@ -39,7 +42,7 @@ void
main(int argc, char **argv)
{
char *altaddr, *checkmac, *mac;
- int fd, fd0, fd1;
+ int fd, fd0, fd1, ctl, i;
void (*x)(int, int);
Endpoints *ep;
@@ -59,6 +62,11 @@ main(int argc, char **argv)
case 't':
timeout = atoi(EARGF(usage()));
break;
+ case 'o':
+ if(nopts >= nelem(opts))
+ sysfatal("too many -o options");
+ opts[nopts++] = EARGF(usage());
+ break;
default:
usage();
}ARGEND;
@@ -87,10 +95,16 @@ main(int argc, char **argv)
sysfatal("dial %s: %r", altaddr);
fd1 = fd0;
}
- fd = dial(argv[0], 0, 0, 0);
+ fd = dial(argv[0], 0, 0, &ctl);
if(fd < 0)
sysfatal("dial %s: %r", argv[0]);
+ for(i = 0; i < nopts; i++){
+ if(write(ctl, opts[i], strlen(opts[i])) < 0)
+ fprint(2, "%s: can't write %s: %r\n", argv0, opts[i]);
+ }
+ close(ctl);
+
rfork(RFNOTEG);
if(timeout > 0){
alarm(0);