X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/6c42153ad9362cc676ea66563bf400d7511b3b68..ec18722d02bd307bd09f30715dc8ba4e1b8a6716:/sbr/discard.c diff --git a/sbr/discard.c b/sbr/discard.c index 7c132ceb..a77240b7 100644 --- a/sbr/discard.c +++ b/sbr/discard.c @@ -1,8 +1,4 @@ - -/* - * discard.c -- discard output on a file pointer - * - * $Id$ +/* discard.c -- discard output on a file pointer * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for @@ -11,59 +7,11 @@ #include -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_TERMIO_H -# include -# else -# include -# endif -#endif - -#ifdef SCO_5_STDIO -# define _ptr __ptr -# define _cnt __cnt -# define _base __base -# define _filbuf(fp) ((fp)->__cnt = 0, __filbuf(fp)) -#endif - +#include void discard (FILE *io) { -#ifndef HAVE_TERMIOS_H -# ifdef HAVE_TERMIO_H - struct termio tio; -# else - struct sgttyb tio; -# endif -#endif - - if (io == NULL) - return; - -#ifdef HAVE_TERMIOS_H - tcflush (fileno(io), TCOFLUSH); -#else -# ifdef HAVE_TERMIO_H - if (ioctl (fileno(io), TCGETA, &tio) != -1) - ioctl (fileno(io), TCSETA, &tio); -# else - if (ioctl (fileno(io), TIOCGETP, (char *) &tio) != -1) - ioctl (fileno(io), TIOCSETP, (char *) &tio); -# endif -#endif - -#ifdef _FSTDIO - fpurge (io); -#else -# ifdef LINUX_STDIO - io->_IO_write_ptr = io->_IO_write_base; -# else - if ((io->_ptr = io->_base)) - io->_cnt = 0; -# endif -#endif + if (io) + tcflush (fileno(io), TCOFLUSH); } -