X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=uip%2Fprompter.c;h=2f39f29d4cc1e72dbb6609164a37f38f986549ed;hb=fc71710f8695ea07d852284286b058ecb3955317;hp=db61fb34d755be86ad1a706c111960b4add5f935;hpb=5b792c4424571f05bc2008e3109797d18d7d00d1;p=mmh diff --git a/uip/prompter.c b/uip/prompter.c index db61fb3..2f39f29 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -13,15 +13,7 @@ #include #include -#ifdef HAVE_TERMIOS_H -# include -#else -# ifdef HAVE_TERMIO_H -# include -# else -# include -# endif -#endif +#include #define QUOTE '\\' @@ -62,25 +54,10 @@ static struct swit switches[] = { }; -#ifdef HAVE_TERMIOS_H static struct termios tio; -# define ERASE tio.c_cc[VERASE] -# define KILL tio.c_cc[VKILL] -# define INTR tio.c_cc[VINTR] -#else -# ifdef HAVE_TERMIO_H -static struct termio tio; -# define ERASE tio.c_cc[VERASE] -# define KILL tio.c_cc[VKILL] -# define INTR tio.c_cc[VINTR] -# else -static struct sgttyb tio; -static struct tchars tc; -# define ERASE tio.sg_erase -# define KILL tio.sg_kill -# define INTR tc.t_intrc -# endif -#endif +#define ERASE tio.c_cc[VERASE] +#define KILL tio.c_cc[VKILL] +#define INTR tio.c_cc[VINTR] static int wtuser = 0; static int sigint = 0; @@ -92,7 +69,7 @@ static jmp_buf sigenv; int getln(char *, int); static int chrcnv(char *); static void chrdsp(char *, char); -static RETSIGTYPE intrser(int); +static void intrser(int); int @@ -195,23 +172,10 @@ main(int argc, char **argv) ** Are we changing the kill or erase character? */ if (killp || erasep) { -#ifdef HAVE_TERMIOS_H cc_t save_erase, save_kill; -#else - int save_erase, save_kill; -#endif /* get the current terminal attributes */ -#ifdef HAVE_TERMIOS_H tcgetattr(0, &tio); -#else -# ifdef HAVE_TERMIO_H - ioctl(0, TCGETA, &tio); -# else - ioctl(0, TIOCGETP, (char *) &tio); - ioctl(0, TIOCGETC, (char *) &tc); -# endif -#endif /* save original kill, erase character for later */ save_kill = KILL; @@ -222,15 +186,7 @@ main(int argc, char **argv) ERASE = erasep ? chrcnv(erasep) : save_erase; /* set the new terminal attributes */ -#ifdef HAVE_TERMIOS_H tcsetattr(0, TCSADRAIN, &tio); -#else -# ifdef HAVE_TERMIO_H - ioctl(0, TCSETAW, &tio); -# else - ioctl(0, TIOCSETN, (char *) &tio); -# endif -#endif /* print out new kill erase characters */ chrdsp("erase", ERASE); @@ -286,15 +242,7 @@ main(int argc, char **argv) if (i == -1) { abort: if (killp || erasep) { -#ifdef HAVE_TERMIOS_H tcsetattr(0, TCSADRAIN, &tio); -#else -# ifdef HAVE_TERMIO - ioctl(0, TCSETA, &tio); -# else - ioctl(0, TIOCSETN, (char *) &tio); -# endif -#endif } unlink(tmpfil); done(1); @@ -379,15 +327,7 @@ no_body: SIGNAL(SIGINT, SIG_IGN); if (killp || erasep) { -#ifdef HAVE_TERMIOS_H tcsetattr(0, TCSADRAIN, &tio); -#else -# ifdef HAVE_TERMIO_H - ioctl(0, TCSETAW, &tio); -# else - ioctl(0, TIOCSETN, (char *) &tio); -# endif -#endif } if ((fdi = open(tmpfil, O_RDONLY)) == NOTOK) @@ -454,7 +394,7 @@ getln(char *buffer, int n) } -static RETSIGTYPE +static void intrser(int i) { #ifndef RELIABLE_SIGNALS