diff options
| author | ericj <> | 2002-02-19 23:19:39 +0000 |
|---|---|---|
| committer | ericj <> | 2002-02-19 23:19:39 +0000 |
| commit | 31a22424aa35acd1cf9df9a6c4c3487c347da1c4 (patch) | |
| tree | cabff89a2fb4291caf9ecdacb0746aafacaf299e /src/usr.bin/nc/scripts/irc | |
| parent | a03c0e851f1aaa82f73eef4a7673768cae02b444 (diff) | |
| download | openbsd-31a22424aa35acd1cf9df9a6c4c3487c347da1c4.tar.gz openbsd-31a22424aa35acd1cf9df9a6c4c3487c347da1c4.tar.bz2 openbsd-31a22424aa35acd1cf9df9a6c4c3487c347da1c4.zip | |
remove more old cruft
Diffstat (limited to 'src/usr.bin/nc/scripts/irc')
| -rw-r--r-- | src/usr.bin/nc/scripts/irc | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/usr.bin/nc/scripts/irc b/src/usr.bin/nc/scripts/irc deleted file mode 100644 index e45942c0bc..0000000000 --- a/src/usr.bin/nc/scripts/irc +++ /dev/null | |||
| @@ -1,81 +0,0 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | # $OpenBSD: irc,v 1.2 2001/01/29 01:58:12 niklas Exp $ | ||
| 3 | |||
| 4 | ## Shit-simple script to supply the "privmsg <recipient>" of IRC typein, and | ||
| 5 | ## keep the connection alive. Pipe this thru "nc -v -w 5 irc-server port". | ||
| 6 | ## Note that this mechanism makes the script easy to debug without being live, | ||
| 7 | ## since it just echoes everything bound for the server. | ||
| 8 | ## if you want autologin-type stuff, construct some appropriate files and | ||
| 9 | ## shovel them in using the "<" mechanism. | ||
| 10 | |||
| 11 | # magic arg: if "tick", do keepalive process instead of main loop | ||
| 12 | if test "$1" = "tick" ; then | ||
| 13 | # ignore most signals; the parent will nuke the kid | ||
| 14 | # doesn't stop ^Z, of course. | ||
| 15 | trap '' 1 2 3 13 14 15 16 | ||
| 16 | while true ; do | ||
| 17 | sleep 60 | ||
| 18 | echo "PONG !" | ||
| 19 | done | ||
| 20 | fi | ||
| 21 | |||
| 22 | # top level: fire ourselves off as the keepalive process, and keep track of it | ||
| 23 | sh $0 tick & | ||
| 24 | ircpp=$! | ||
| 25 | echo "[Keepalive: $ircpp]" >&2 | ||
| 26 | # catch our own batch of signals: hup int quit pipe alrm term urg | ||
| 27 | trap 'kill -9 $ircpp ; exit 0' 1 2 3 13 14 15 16 | ||
| 28 | sleep 2 | ||
| 29 | |||
| 30 | sender='' | ||
| 31 | savecmd='' | ||
| 32 | |||
| 33 | # the big honkin' loop... | ||
| 34 | while read xx yy ; do | ||
| 35 | case "${xx}" in | ||
| 36 | # blank line: do nothing | ||
| 37 | "") | ||
| 38 | continue | ||
| 39 | ;; | ||
| 40 | # new channel or recipient; if bare ">", we're back to raw literal mode. | ||
| 41 | ">") | ||
| 42 | if test "${yy}" ; then | ||
| 43 | sender="privmsg ${yy} :" | ||
| 44 | else | ||
| 45 | sender='' | ||
| 46 | fi | ||
| 47 | continue | ||
| 48 | ;; | ||
| 49 | # send crud from a file, one line per second. Can you say "skr1pt kidz"?? | ||
| 50 | # *Note: uses current "recipient" if set. | ||
| 51 | "<") | ||
| 52 | if test -f "${yy}" ; then | ||
| 53 | ( while read zz ; do | ||
| 54 | sleep 1 | ||
| 55 | echo "${sender}${zz}" | ||
| 56 | done ) < "$yy" | ||
| 57 | echo "[done]" >&2 | ||
| 58 | else | ||
| 59 | echo "[File $yy not found]" >&2 | ||
| 60 | fi | ||
| 61 | continue | ||
| 62 | ;; | ||
| 63 | # do and save a single command, for quick repeat | ||
| 64 | "/") | ||
| 65 | if test "${yy}" ; then | ||
| 66 | savecmd="${yy}" | ||
| 67 | fi | ||
| 68 | echo "${savecmd}" | ||
| 69 | ;; | ||
| 70 | # default case goes to recipient, just like always | ||
| 71 | *) | ||
| 72 | echo "${sender}${xx} ${yy}" | ||
| 73 | continue | ||
| 74 | ;; | ||
| 75 | esac | ||
| 76 | done | ||
| 77 | |||
| 78 | # parting shot, if you want it | ||
| 79 | echo "quit :Bye all!" | ||
| 80 | kill -9 $ircpp | ||
| 81 | exit 0 | ||
