[comp.unix.wizards] bug in "portable way to do nap

andrew@frip.gwd.tek.com (Andrew Klossner) (10/11/88)

>	int baudrate[] = {
>		50,

This is followed by code which subscripts baudrate[tty.c_cflags&CBAUD].
There's an off-by-one here.  baudrate[1], not baudrate[0], should be
50, and the baudrate array should contain 16, not 15, elements.  See
the termio(7) man page for details.

  -=- Andrew Klossner   (uunet!tektronix!tekecs!frip!andrew)    [UUCP]
                        (andrew%frip.gwd.tek.com@relay.cs.net)  [ARPA]

allbery@ncoast.UUCP (Brandon S. Allbery) (10/18/88)

As quoted from <10450@tekecs.TEK.COM> by andrew@frip.gwd.tek.com (Andrew Klossner):
+---------------
| >	int baudrate[] = {
| >		50,
| 
| This is followed by code which subscripts baudrate[tty.c_cflags&CBAUD].
| There's an off-by-one here.  baudrate[1], not baudrate[0], should be
+---------------

Oops (*blush*).  I knew that, but I was "coding on the run" and didn't stop
to think about baud rate B0....

++Brandon
-- 
Brandon S. Allbery, comp.sources.misc moderator and one admin of ncoast PA UN*X
uunet!hal.cwru.edu!ncoast!allbery  <PREFERRED!>	    ncoast!allbery@hal.cwru.edu
allbery@skybridge.sdi.cwru.edu	      <ALSO>		   allbery@uunet.uu.net
comp.sources.misc is moving off ncoast -- please do NOT send submissions direct
  (But the aliases are NOT on UUNET yet, use the aliases at backbone sites!)

zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (10/18/88)

I sent my very simple nap() for Sys V "device driver" to comp.sources.misc. 
-- 
Jon Zeeff      			Branch Technology,
umix!b-tech!zeeff  		zeeff@b-tech.ann-arbor.mi.us