home *** CD-ROM | disk | FTP | other *** search
- /*
- * Exit pcomm. A user requested abort. There are a lot of things to do
- * before we exit!
- */
-
- #include <stdio.h>
- #include <curses.h>
- #include "dial_dir.h"
- #include "misc.h"
- #include "param.h"
- #include "status.h"
-
- void
- pexit(fd)
- int fd;
- {
- WINDOW *ex_win, *newwin();
- void cleanup(), status_line();
-
- ex_win = newwin(5, 33, 3, 7);
-
- box(ex_win, '|', '-');
- mvwattrstr(ex_win, 0, 3, A_BOLD, " Exit ");
- if (yes_prompt(ex_win, 2, 4, A_BLINK, "Exit to Unix")) {
- status_line(" exiting");
- cleanup(0);
- }
- if (fd == -1) {
- werase(ex_win);
- wrefresh(ex_win);
- }
- delwin(ex_win);
- return;
- }
-
- /*
- * Do the cleanup detail before we exit.
- */
-
- void
- cleanup(val)
- int val;
- {
- void release_port(), input_off(), exit(), status_line();
- char *ttyname();
- /* kill the input routine */
- input_off();
- /* zap the virtual screen file */
- unlink(status->vs_path);
- /* release the port */
- release_port(0);
- /* erase the window we made */
- touchwin(stdscr);
- clear();
- refresh();
- endwin();
- /* return the tty chmod */
- chmod(ttyname(0), status->msg);
- exit(val);
- }
-
- /*
- * Open a window to display an error message. Handles both fatal and
- * non-fatal errors
- */
-
- void
- error_win(code, line_one, line_two)
- int code;
- char *line_one, *line_two;
- {
- WINDOW *e_win, *newwin();
- void cleanup(), status_line();
-
- e_win = newwin(7, 70, 9, 5);
- /* display the nasty note */
- mvwaddstr(e_win, 2, 4, line_one);
- mvwaddstr(e_win, 3, 4, line_two);
- box(e_win, '|', '-');
-
- if (code) {
- mvwattrstr(e_win, 0, 4, A_BOLD, " Error ");
- mvwattrstr(e_win, 5, 24, A_BLINK, "Press any key to exit");
- wmove(e_win, 5, 46);
- }
- else {
- mvwattrstr(e_win, 0, 4, A_BOLD, " Warning ");
- mvwattrstr(e_win, 5, 22, A_BLINK, "Press any key to continue");
- wmove(e_win, 5, 48);
- }
- beep();
- wrefresh(e_win);
-
- wgetch(e_win);
- werase(e_win);
- wrefresh(e_win);
- delwin(e_win);
-
- if (code) {
- /*
- * Since this routine gets called if there is an error reading
- * the support files, the dir and param structures can't be
- * guaranteed to exist yet.
- */
- if (dir != NULL && param != NULL)
- status_line(" exiting");
- cleanup(code);
- }
- return;
- }
-