* in cases involving special characters. Here a C version.
*/
#include <stdio.h>
-#include <stdio_ext.h>
+#ifdef HAVE_STDIO_EXT_H
+# include <stdio_ext.h>
+#endif
+#ifdef HAVE_FPURGE
+# define HAVE___FPURGE 1
+# define __fpurge fpurge
+#endif
#include <string.h>
#include <stdlib.h>
#include <errno.h>
else {
buf[0] = c;
if (c != '\n' && tty_cbreak) {
+#ifdef HAVE___FPURGE
/* Possibly purge a multi-byte character; or do a
required purge of the rest of the line (including
the newline) if the tty has been put back in
canonical mode (for example by a shell after a
SIGTSTP signal). */
__fpurge(stdin);
+#endif
printf("\n");
}
else if (c != '\n')