|
|
1.1 ! root 1: /* discard.c - discard output on a file pointer */ ! 2: ! 3: #include "../h/mh.h" ! 4: #include <stdio.h> ! 5: #ifndef SYS5 ! 6: #include <sgtty.h> ! 7: #else SYS5 ! 8: #include <sys/types.h> ! 9: #include <termio.h> ! 10: #include <sys/ioctl.h> ! 11: #endif SYS5 ! 12: ! 13: ! 14: void discard (io) ! 15: FILE *io; ! 16: { ! 17: #ifndef SYS5 ! 18: struct sgttyb sg; ! 19: #else SYS5 ! 20: struct termio sg; ! 21: #endif SYS5 ! 22: ! 23: if (io == NULL) ! 24: return; ! 25: ! 26: #ifndef SYS5 ! 27: if (ioctl (fileno (io), TIOCGETP, (char *) &sg) != NOTOK) ! 28: (void) ioctl (fileno (io), TIOCSETP, (char *) &sg); ! 29: #else SYS5 ! 30: if (ioctl (fileno (io), TCGETA, &sg) != NOTOK) ! 31: (void) ioctl (fileno (io), TCSETA, &sg); ! 32: #endif SYS5 ! 33: ! 34: if (io -> _ptr = io -> _base) ! 35: io -> _cnt = 0; ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.