- if (!drft)
- adios (NULL, "usage: %s [switches] file", invo_name);
- if ((in = fopen (drft, "r")) == NULL)
- adios (drft, "unable to open");
-
- strncpy (tmpfil, m_tmpfil (invo_name), sizeof(tmpfil));
- if ((out = fopen (tmpfil, "w")) == NULL)
- adios (tmpfil, "unable to create");
- chmod (tmpfil, 0600);
-
- /*
- * 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;
- save_erase = ERASE;
-
- /* set new kill, erase character in terminal structure */
- KILL = killp ? chrcnv (killp) : save_kill;
- 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);
- chrdsp (", kill", KILL);
- chrdsp (", intr", INTR);
- putchar ('\n');
- fflush (stdout);
+ if (!drft) {
+ adios(EX_USAGE, NULL, "usage: %s [switches] file", invo_name);
+ }
+ if ((in = fopen(drft, "r")) == NULL) {
+ adios(EX_IOERR, drft, "unable to open");
+ }
+
+ tfile = m_mktemp2(NULL, invo_name, NULL, &out);
+ if (tfile == NULL) {
+ adios(EX_CANTCREAT, "prompter", "unable to create temporary file");
+ }
+ chmod(tmpfil, 0600);
+ strncpy(tmpfil, tfile, sizeof(tmpfil));
+
+ sigint = 0;
+ SIGNAL2(SIGINT, intrser);