Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!seismo!hao!hplabs!sri-unix!gwyn@brl-vld From: gwyn%brl-vld@sri-unix.UUCP Newsgroups: net.unix Subject: Re: CR defeat Message-ID: <13755@sri-arpa.UUCP> Date: Thu, 17-Nov-83 18:37:20 EST Article-I.D.: sri-arpa.13755 Posted: Thu Nov 17 18:37:20 1983 Date-Received: Sun, 20-Nov-83 00:34:24 EST Lines: 28 From: Doug Gwyn (VLD/VMB) You have not described the system behavior correctly. The only time a CR is supplied before a newline (LF) is when the output is via the terminal driver and the appropriate ioctl bit is on. On older UNIXes, this was coupled to the input mapping of CR to newline, using the CRMOD bit in the sg_flags member of the sgttyb struct; on newer UNIXes, input and output CR,LF handling are separately available by flag bits in the termio struct. For example, on UNIX System V (or, in your case, the BRL emulation thereof) the following C routine will turn off the CR before LF, and a similar routine would turn it on. You can also do this with the "stty" command if you need it in a shell script. #include #include NoCR() /* disables CR before LF on stdout */ { struct termio tbuf; if ( ioctl( fileno( stdout ), TCGETA, (int)&tbuf ) == 0 ) { tbuf.c_oflag &= ~ONLCR; (void)ioctl( fileno( stdout ), TCSETAW, (int)&tbuf ); } }