#define F_SIGINT 0x08 /* restore default SIGINT handler */
#define F_NORMAL 0x80 /* spawn child process in non-curses regular mode */
+#define exitcurses() endwin()
+#define clearprompt() printmsg("")
+#define printwarn() printmsg(strerror(errno))
+
typedef unsigned long ulong;
typedef unsigned int uint;
typedef unsigned char uchar;
/* Forward declarations */
static void printmsg(char *);
-static void printwarn(void);
static void printerr(int, char *);
static void redraw(char *path);
int status;
if (flag & F_NORMAL)
- endwin();
+ exitcurses();
pid = fork();
if (pid == 0) {
mvprintw(LINES - 1, 0, "%s\n", msg);
}
-/* Display warning as a message */
-static void
-printwarn(void)
-{
- printmsg(strerror(errno));
-}
-
/* Kill curses and display error before exiting */
static void
printerr(int ret, char *prefix)
{
- endwin();
+ exitcurses();
fprintf(stderr, "%s: %s\n", prefix, strerror(errno));
exit(ret);
}
-/* Clear the last line */
-static void
-clearprompt(void)
-{
- printmsg("");
-}
-
/* Print prompt on the last line */
static void
printprompt(char *str)
close(fd);
- endwin();
+ exitcurses();
get_output(NULL, 0, "cat", tmp, NULL, 1);
unlink(tmp);
initcurses();
if (!get_output(g_buf, MAX_CMD_LEN, "which", metaviewer, NULL, 0))
return -1;
- endwin();
+ exitcurses();
get_output(NULL, 0, metaviewer, fpath, arg, 1);
initcurses();
return 0;
dprintf(fd, "\n");
close(fd);
- endwin();
+ exitcurses();
get_output(NULL, 0, "cat", tmp, NULL, 1);
unlink(tmp);
initcurses();
goto nochange;
}
- endwin();
+ exitcurses();
tmp = readline("chdir: ");
initcurses();
#endif
initcurses();
browse(ipath, ifilter);
- endwin();
+ exitcurses();
#ifdef DEBUGMODE
disabledbg();
#endif