Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ukma!xanth!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!uva!dik From: dik@uva.UUCP (Casper H.S. Dik) Newsgroups: comp.unix.questions Subject: Re: Reading long lines from TTY Summary: Use stty cbreak, but beware Message-ID: <612@uva.UUCP> Date: 3 Feb 89 13:58:26 GMT References: <3134@uhccux.uhcc.hawaii.edu> Sender: news@uva.UUCP Reply-To: dik@uva.UUCP (Casper H.S. Dik) Organization: Faculteit Wiskunde & Informatica, Universiteit van Amsterdam Lines: 46 In article <3134@uhccux.uhcc.hawaii.edu> david@uhccux.uhcc.hawaii.edu (David Lassner) writes: >Any suggestions on using standard utilities to read VERY >long lines from the TTY using Unix (Ultrix 2.2). The >intuitive: > %cat > filename >and > %cp /dev/ttyxx filename >both stop accepting characters after about 250 without a CR. > >Our user basically wants to do the equivalent of a TOPS-20 > @copy tty: filename >to upload text that does not contain line breaks. Yes, we >know about Kermit and other protocols, but they can't be >used in this case. Normally the terminal driver buffers all characters until it sees a line terminator or special character (intr del, etc). The buffer holds a maximum of 256 chars. You can get around this. All you have to change is the terminal settings. Put your tty in cbreak mode. This will cause each character typed to be send to the reading process directly. You can do this with: % stty cbreak % cat > file % stty -cbreak But beware: If you use a shell that fiddles with the terminal settings this won't work. (E.g. ksh, or csh with filec set) So in csh do: % unset filec Or use /bin/sh, to be on the save side. >-- >David Lassner, University of Hawaii Computing Center, 808/948-7351 >INTERNET: david@uhccux.uhcc.hawaii.edu BITNET: david@uhccux >UUCP: ...!ucsd!nosc!uhccux!david PLATO: david/p/hawaii --cd ____________________________________________________________________________ Casper H.S. Dik University of Amsterdam | dik@uva.uucp The Netherlands | ...!uunet!mcvax!uva!dik