comparison toys/netcat.c @ 233:d4176f3f3835

Zap toys/Config.in and instead create generated/Config.in from contents of toys/*.c. Move relevant info into comment at the top of each toys/*.c. Also convert more of Makefile into a thin wrapper around shell scripts that actually do the work. (Makefile is only still there for the user interface.)
author Rob Landley <rob@landley.net>
date Sat, 19 Jan 2008 17:08:39 -0600
parents 30a6db5a95c2
children 163498bf547b
comparison
equal deleted inserted replaced
232:cd4d5630c978 233:d4176f3f3835
1 /* vi: set sw=4 ts=4: */ 1 /* vi: set sw=4 ts=4:
2 /* nc: mini-netcat - Forward stdin/stdout to a file or network connection. 2 *
3 * nc: mini-netcat - Forward stdin/stdout to a file or network connection.
3 * 4 *
4 * Copyright 2007 Rob Landley <rob@landley.net> 5 * Copyright 2007 Rob Landley <rob@landley.net>
5 * 6 *
6 * Not in SUSv3. 7 * Not in SUSv3.
7 */ 8
9 config NETCAT
10 bool "netcat"
11 default n
12 help
13 usage: netcat [-iwlp] {IPADDR PORTNUM|-f FILENAME} [-e COMMAND]
14
15 -e exec the rest of the command line
16 -i SECONDS delay after each line sent
17 -w SECONDS timeout for connection
18 -f filename use file (ala /dev/ttyS0) instead of network
19 -l listen for incoming connection (twice for persistent connection)
20 -p local port number
21 -s local source address
22 -q SECONDS quit this many seconds after EOF on stdin.
23
24 Use -l twice with -e for a quick-and-dirty server.
25
26 Use "stty 115200 -F /dev/ttyS0 && stty raw -echo -ctlecho" with
27 netcat -f to connect to a serial port.
28 */
8 29
9 #include "toys.h" 30 #include "toys.h"
10 #include "toynet.h" 31 #include "toynet.h"
11
12 #include <sys/socket.h>
13 #include <netinet/in.h>
14 #include <arpa/inet.h>
15 32
16 #define TT toy.netcat 33 #define TT toy.netcat
17 34
18 static void timeout(int signum) 35 static void timeout(int signum)
19 { 36 {