vasoll%okstate.csnet@CSNET-RELAY.ARPA (09/04/84)
From: Mark Vasoll <vasoll%okstate.csnet@CSNET-RELAY.ARPA> Hello. There is not a bug in cu. The system that you are communicating with must send you the ~>filename sequence for this to work. Usually this is the result of using the ~%take command of cu. Obviously this restricts the program's usefulness when talking to non-unix systems (~%take requires the cat, stty, and echo commands on the remote system). So, if you are not talking to another UNIX system and cannot implement the cat, stty and echo commands on whatever system you are using, you will not be able to use the ~>filename diversion. Hope this helps. Mark
gordon@sneaky.UUCP (09/08/84)
#R:sri-arpa:-1312000:sneaky:-1336091:000:1470 sneaky!gordon Sep 8 11:16:00 1984 [Bug eater line. Munch, munch, munch ...] In order to use the redirection of received data in 'cu', you need to have the system on the other end send the redirection command. ~>file It has to start at the beginning of a line. If the other system has a prompt that leaves the cursor at the beginning of the line, you can sometimes type in the command with an extra ~ in front, depending on how badly the other system objects to it. Usually, however, you need to type in a command like: echo "~>file"; cat file; echo "~>" or its equivalent on other operating systems. If it doesn't have an equivalent to echo, you can edit the commands onto the beginning and end of the file. If it's a Unix*-like system on the other end, use ~%take, and cu will construct a suitable command line for you. Note that putting redirection commands at the beginning of a line in netnews articles is probably going to draw flames from lots of people who use cu to log in to another system to read netnews. Another possibility, useful for capturing entire sessions, is: cu <various parameters go here> | tee session.log Gordon Burditt convex!ctvax!trsvax!sneaky!gordon * Unix is** a** trademark of** some** telephone bill*** company or** other. ** is, a, of, some, and or are hopefully not trademarks of some telephone bill company or other. *** telephone bill is probably a trademark of AT&T****. **** AT&T is a trademark of AT&T****. (infinitely recursive).
rpw3@redwood.UUCP (Rob Warnock) (09/18/84)
I also use 'cu' to talk to certain non-UNIX systems, most (all?) of which have command prompts which do NOT leave the cursor at the beginning of the line. Now on those systems where I am permitted to write programs (or even to create & type out files), a trivial program (file) can be used to turn logging on/off. But on the others...? I tried the "cu | tee" approach, and found it very UNsatisfactory, since shell escapes (such as "vi replyfile") have all of their output going through the "tee", and also since stdout is a pipe, programs which use "termcap/curses" screw up. Fortunately, (1) the operating system on my machine has the 4.1bsd IOCTL for stuffing characters back INTO a tty input, and (2) I have priviledges for making programs setuid root (needed for the IOCTL). A simple program (attached, below) which uses this IOCTL can then be run from "~!culog [file]" to turn logging on/off/on-again, as desired. This has been quite satisfactory. I have fallen into a style of use which consists of a shell script of the following general form: : call system "x", log to file "cu.log" CUDEV=${CUDEV-/dev/cul0} (stty raw -echo # so "culog" doesn't echo to the dialer sleep 5 # long enough for "cu" so say "Connected" culog cu.log # stuff the "~>>cu.log" into the pipe echo # Cermetek modem needs <LF><CR><LF><CR> echo -n ' ' # to wake up echo echo -n ' ' echo # some delay for dialer to say "what number?" echo echo echo -n '8005551212 ' # put your own number here sleep 25 # long enough to dial and get through echo -n ' ' echo -n ' ' # baud-detect at the other end # # put stuff to do login and password here # sleep 1 )>$CUDEV & exec cu -s 1200 -l $CUDEV Notice that I leave output to the terminal ON ("~>>file", not "~>>:file"), since that permits monitoring the whole process in case something goes wrong (as does "cu|tee"). Also, note that everything but the final "cu" is run in the background, so that "cu" can get started up before the "culog". Hope this is of use to someone... Rob Warnock UUCP: {ihnp4,ucbvax!amd}!fortune!redwood!rpw3 DDD: (415)369-7437 Envoy: rob.warnock/kingfisher USPS: Suite 203, 4012 Farm Hill Blvd, Redwood City, CA 94061 ------------------Attachment----------------------------------- /* * culog.c - hack to control cu logging when talking to a non-UNIX system * * usage: culog [ <filename> ] # usually from within cu with a ~! escape * # If no filename given, logging is turned off. * * 840904 rpw3 This program uses the Berkeley ioctl TIOCSTI to stuff the * magic characters into the "other" port of a cu connection * to cause the "reverse path cu" to start/stop copying to a * file. Restrictions of first implementation: Only /dev/cul0 * is used. Logging ALWAYS appends (never creates). Logging * is always done in non-silent mode (you see what you get). * (Even with that, it's QUITE useful!) * * Note: must be installed setuid root, since TIOCSTI is * (for good reason) priviledged. */ /* Futures/Bugs: * * flow control - maybe should use FIONREAD or something to make sure * the entire CULOG_ON string will fit into the tty's input * cu device - should really be an argument; if not, check to see if * stdout is a tty, and if so, try to use that */ #include <sys/ioctl.h> /* These have "extra" newlines at the beginning, which can sometimes get * into the log file, but better that than not being able to close a * connection that didn't end in a newline! */ #define CULOG_ON "\n~>>%s\n" /* Append, leaving tty copy on */ #define CULOG_OFF "\n~>\n" #define CUDEV "/dev/cul0" /* (future) should be an arg */ main(argc,argv) int argc; char **argv; { register char *p; register int cul0; char buf[1024]; if((cul0 = open(CUDEV,1)) < 0){ perror(argv[0]); exit(1); } if(argv[1]) sprintf(buf, CULOG_ON, argv[1]); else sprintf(buf, CULOG_OFF); for(p = buf; *p != '\0'; ++p){ if(ioctl(cul0, TIOCSTI, p) != 0){ perror(argv[0]); exit(1); } } close(cul0); exit(0); } ------------------Attachment ends-----------------------------------