#include <mit-copyright.h>
#include <sys/types.h>
#include <stdio.h>
+#include <string.h>
#include <signal.h>
#include <curses.h>
-#ifdef _AUX_SOURCE
-#include <sys/termio.h>
-#include <sys/ttychars.h>
-#endif /* _AUX_SOURCE */
+#ifdef POSIX
+#include <unistd.h>
+#include <termios.h>
+#endif /* POSIX */
#include <ctype.h>
-#include <strings.h>
+#ifndef sun
#include <varargs.h>
+#endif
#include <com_err.h>
+#include <moira.h>
#include "menu.h"
#ifndef __STDC__
extern int interrupt; /* will be set if ^C is received */
extern FILE *fdopen();
+#ifndef sgi
extern int getpid();
+#endif
extern char *calloc();
extern char *whoami;
FILE *log_file = (FILE *) NULL; /* file stream of log file */
int more_flg = 1;
+#ifdef POSIX
+extern char *malloc();
+#endif
+
/* Structure for holding current displayed menu */
struct menu_screen {
WINDOW *ms_screen; /* Window for this menu */
register void (*old_hook)() = set_com_err_hook(menu_com_err_hook);
#endif
- if (initscr() == ERR) {
+ if (initscr() == (WINDOW *)ERR) {
fputs("Can't initialize curses!\n", stderr);
Start_no_menu(m);
} else {
int length;
{
struct menu_screen *ms;
- char *malloc();
if (MAX_TITLE + length + MIN_INPUT > LINES) {
fputs("Menu too big!\n", stderr);
(void) wclear(cur_ms->ms_input);
(void) waddstr(cur_ms->ms_input, prompt);
(void) touchwin(cur_ms->ms_input);
- (void) mvcur(0, COLS - 1, LINES - 1, 0);
+ (void) move(LINES - 1, 0);
(void) wrefresh(curscr);
getyx(cur_ms->ms_input, y, x);
oldy = y;
}
end_input:
(void) waddch(cur_ms->ms_input, '\n');
- (void) waddch(cur_ms->ms_input, '\r');
(void) wclrtoeol(cur_ms->ms_input);
refresh_ms(cur_ms);
(void) wclear(cur_ms->ms_input);
(void) waddstr(cur_ms->ms_input, prompt);
refresh_ms(cur_ms);
- (void) mvcur(0, COLS - 1, LINES - 1, 0);
+ (void) move(LINES - 1, 0);
(void) wrefresh(curscr);
getyx(cur_ms->ms_input, y, x);
break;
case '\n':
case '\r':
(void) waddch(cur_ms->ms_input, '\n');
- (void) waddch(cur_ms->ms_input, '\r');
(void) wclrtoeol(cur_ms->ms_input);
refresh_ms(cur_ms);
}
}
else {
-#ifdef _AUX_SOURCE
- struct termio ttybuf, nttybuf;
+#ifdef POSIX
+ struct termios ttybuf, nttybuf;
#else
struct sgttyb ttybuf, nttybuf;
-#endif /* _AUX_SOURCE */
+#endif /* POSIX */
printf("%s", prompt);
/* turn off echoing */
-#ifdef _AUX_SOURCE
- (void) ioctl(0, TCGETA, (char *)&ttybuf);
+#ifdef POSIX
+ tcgetattr(0, &ttybuf);
nttybuf = ttybuf;
nttybuf.c_lflag &= ~ECHO;
- (void)ioctl(0, TCSETA, (char *)&nttybuf);
+ tcsetattr(0, TCSANOW, &nttybuf);
if (gets(buf) == NULL) {
- (void) ioctl(0, TCSETA, (char *)&ttybuf);
+ tcsetattr(0, TCSANOW, &ttybuf);
putchar('\n');
return 0;
}
}
putchar('\n');
(void) ioctl(0, TIOCSETP, (char *)&ttybuf);
-#endif /* _AUX_SOURCE */
+#endif /* POSIX */
Start_paging();
return 1;
}