diff options
Diffstat (limited to 'src/usr.bin/nc/scripts/ncp')
-rw-r--r-- | src/usr.bin/nc/scripts/ncp | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/usr.bin/nc/scripts/ncp b/src/usr.bin/nc/scripts/ncp deleted file mode 100644 index be87e9343b..0000000000 --- a/src/usr.bin/nc/scripts/ncp +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | # $OpenBSD: ncp,v 1.2 2001/01/29 01:58:13 niklas Exp $ | ||
3 | |||
4 | ## Like "rcp" but uses netcat on a high port. | ||
5 | ## do "ncp targetfile" on the RECEIVING machine | ||
6 | ## then do "ncp sourcefile receivinghost" on the SENDING machine | ||
7 | ## if invoked as "nzp" instead, compresses transit data. | ||
8 | |||
9 | ## pick your own personal favorite port, which will be used on both ends. | ||
10 | ## You should probably change this for your own uses. | ||
11 | MYPORT=23456 | ||
12 | |||
13 | ## if "nc" isn't systemwide or in your PATH, add the right place | ||
14 | # PATH=${HOME}:${PATH} ; export PATH | ||
15 | |||
16 | test "$3" && echo "too many args" && exit 1 | ||
17 | test ! "$1" && echo "no args?" && exit 1 | ||
18 | me=`echo $0 | sed 's+.*/++'` | ||
19 | test "$me" = "nzp" && echo '[compressed mode]' | ||
20 | |||
21 | # if second arg, it's a host to send an [extant] file to. | ||
22 | if test "$2" ; then | ||
23 | test ! -f "$1" && echo "can't find $1" && exit 1 | ||
24 | if test "$me" = "nzp" ; then | ||
25 | compress -c < "$1" | nc -v -w 2 $2 $MYPORT && exit 0 | ||
26 | else | ||
27 | nc -v -w 2 $2 $MYPORT < "$1" && exit 0 | ||
28 | fi | ||
29 | echo "transfer FAILED!" | ||
30 | exit 1 | ||
31 | fi | ||
32 | |||
33 | # fall here for receiver. Ask before trashing existing files | ||
34 | if test -f "$1" ; then | ||
35 | echo -n "Overwrite $1? " | ||
36 | read aa | ||
37 | test ! "$aa" = "y" && echo "[punted!]" && exit 1 | ||
38 | fi | ||
39 | # 30 seconds oughta be pleeeeenty of time, but change if you want. | ||
40 | if test "$me" = "nzp" ; then | ||
41 | nc -v -w 30 -p $MYPORT -l < /dev/null | uncompress -c > "$1" && exit 0 | ||
42 | else | ||
43 | nc -v -w 30 -p $MYPORT -l < /dev/null > "$1" && exit 0 | ||
44 | fi | ||
45 | echo "transfer FAILED!" | ||
46 | # clean up, since even if the transfer failed, $1 is already trashed | ||
47 | rm -f "$1" | ||
48 | exit 1 | ||