The nghook utility creates a ng_socket(4) socket type node and connects it to hook hookname of the node found at path. If hookname is omitted, "debug" is assumed.
If the -e option is given, the third argument is interpreted as the path to a program, and this program is executed with the remaining arguments as its arguments. Before executing, the program Netgraph messages (specified by the -m option) are sent to the node. The program is executed with its standard input (unless closed by -n ) and output connected to the hook.
If the -e option is not given, all data written to standard input is sent to the node, and all data received from the node is relayed to standard output. Messages specified with -m are sent to the node before the loop is entered. The nghook utility exits when EOF is detected on standard input in this case.
The options are as follows: