Category : Miscellaneous Language Source Code
Archive   : ADATUT12.ZIP
Filename : ONECHAR.C

 
Output of file : ONECHAR.C contained in archive : ADATUT12.ZIP
/*
ONECHAR.C Ver. 1.20 21-DEC-1988

Software Innovations Technology
1083 Mandarin Drive NE, Palm Bay, FL 32905-4706 (407)951-0233

This file is for use with UNIX.ADA. It is a Unix System V routine to allow
the capture and return of one character from the terminal.

This program was written by Dave Hill, 7549 Wynford Street, Salt Lake City, UT
84121. Software Innovations Technology is grateful to Mr. Hill for permission
to include ONECHAR.C with ADA-TUTR.
*/

#include
#include
char onechar()
{
static struct termio newsets, oldsets;
char c;
ioctl(fileno(stdin), TCGETA, &newsets);
ioctl(fileno(stdin), TCGETA, &oldsets); /* used by cooked */
newsets.c_cc[4] = '\001';
newsets.c_cc[5] = '\0';
newsets.c_lflag &= ~ (ICANON);
ioctl(fileno(stdin), TCSETAF, &newsets);
c = getchar();
ioctl(fileno(stdin), TCSETAF, &oldsets);
return (c);
}


  3 Responses to “Category : Miscellaneous Language Source Code
Archive   : ADATUT12.ZIP
Filename : ONECHAR.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/