mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-20 15:43:16 +00:00
Add the '-l' flag to nghook which loops the received data back.
This commit is contained in:
parent
e2f7ff26d3
commit
f928d1a2f2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=63436
@ -71,16 +71,20 @@ main(int ac, char *av[])
|
||||
char *path = NULL, *hook = DEFAULT_HOOKNAME;
|
||||
int csock, dsock;
|
||||
int asciiFlag = 0;
|
||||
int loopFlag = 0;
|
||||
int ch;
|
||||
|
||||
/* Parse flags */
|
||||
while ((ch = getopt(ac, av, "da")) != EOF) {
|
||||
while ((ch = getopt(ac, av, "adl")) != EOF) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
asciiFlag = 1;
|
||||
break;
|
||||
case 'd':
|
||||
NgSetDebug(NgSetDebug(-1) + 1);
|
||||
break;
|
||||
case 'a':
|
||||
asciiFlag = 1;
|
||||
case 'l':
|
||||
loopFlag = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
@ -152,6 +156,11 @@ main(int ac, char *av[])
|
||||
rl, wl);
|
||||
}
|
||||
}
|
||||
/* Loopback */
|
||||
if (loopFlag) {
|
||||
if (NgSendData(dsock, NG_SOCK_HOOK_NAME, buf, rl) < 0)
|
||||
err(EX_OSERR, "write(hook)");
|
||||
}
|
||||
}
|
||||
|
||||
/* Check data from stdin */
|
||||
|
@ -45,6 +45,7 @@ node
|
||||
.Nm
|
||||
.Op Fl a
|
||||
.Op Fl d
|
||||
.Op Fl l
|
||||
.Ar path
|
||||
.Op Ar hookname
|
||||
.Sh DESCRIPTION
|
||||
@ -73,6 +74,9 @@ Output each read packet in
|
||||
.Tn ASCII .
|
||||
.It Fl d
|
||||
Increase the debugging verbosity level.
|
||||
.It Fl l
|
||||
Loops all received data back to the hook in addition to writing it
|
||||
to standard output.
|
||||
.El
|
||||
.Sh BUGS
|
||||
Although all input is read in unbuffered mode,
|
||||
|
Loading…
Reference in New Issue
Block a user