Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!otter!jp From: jp@otter.hpl.hp.com (Julian Perry) Newsgroups: comp.sys.hp Subject: Re: buggy hp9000/800 3.01 code? Message-ID: <2980004@otter.hpl.hp.com> Date: 1 Apr 89 08:10:04 GMT References: <659@kcdev.UUCP> Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 27 >The code we are using for raw input was extracted directly from Marc Roshkind's >"Advanced UNIX Programming". Specifically, pages 88-89. He suggests >termio.c_cc[VMIN] = 5 and termio.c_cc[VTIME] = 2. I wasn't sure whether >or not the bug was related to VMIN and VTIME or else ICANON. I was >finally able to get it to work by setting the VMIN value to 1 and the >VTIME value to 0. The following code fragment is the correct way to set the terminal modes to read one character at a time (blocking for each one): ioctl(0,TCGETA,&modes); /* Read the current settings */ modes.c_lflag &= ~ICANON; /* Off with line mode */ modes.c_cc[VMIN] = 1; /* Ask for 1 at a time */ modes.c_cc[VTIME] = 0; /* Ignore the timer */ ioctl(0,TCSETAW,&modes); /* Use the new settings */ I think that many implemetations of VMIN and VTIME are to ignore the timer completely and effectively VMIN is always 1. HP-UX used to be like this a long time ago. It's very MUX dependant. Jules ----- E-MAIL: jp@hplb.hpl.hp.com || jp@hplb.hp.co.uk || jp@hplb.uucp IN-REAL-LIFE: Julian Perry ORGANISATION: Hewlett-Packard Laboratories, Bristol ADDRESS: Filton Road, Stoke Gifford, Bristol, England, BS12 6QZ TELEPHONE: +44 272 799910 x 24019