]> diplodocus.org Git - nmh/blobdiff - sbr/discard.c
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / sbr / discard.c
index dbc865c49441c01a3484d7e0028dac7b71f1dead..83b0bfbc0c5ee9d420f96fbbc9b636130ed7ccfb 100644 (file)
@@ -9,59 +9,18 @@
 
 #include <h/mh.h>
 
-#ifdef HAVE_TERMIOS_H
-# include <termios.h>
-#else
-# ifdef HAVE_TERMIO_H
-#  include <termio.h>
-# else
-#  include <sgtty.h>
-# 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 <termios.h>
 
 
 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
 
-#if defined(_FSTDIO) || defined(__DragonFly__)
-    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
+    /* There used to be an fpurge() here on some platforms, stdio
+       hackery on others.  But it didn't seem necessary. */
 }