#include <com_err.h>
#include "menu.h"
+#ifndef __STDC__
+#define const
+#endif
+
#define MAX(A,B) ((A) > (B) ? (A) : (B))
#define MIN(A,B) ((A) < (B) ? (A) : (B))
#define CTL(ch) ((ch) & 037)
* curses instead of around it.
*/
-int
+void
menu_com_err_hook(who, code, fmt, args)
- char *who;
- int code;
- char *fmt;
+ const char *who;
+ long code;
+ const char *fmt;
va_list args;
{
char buf[BUFSIZ], *cp;
Menu *m;
{
struct menu_screen *make_ms();
- register int (*old_hook)() = set_com_err_hook(menu_com_err_hook);
+#ifdef __STDC__
+ register void (*old_hook)(const char *, long, const char *, va_list) = set_com_err_hook(menu_com_err_hook);
+#else
+ register void (*old_hook)() = set_com_err_hook(menu_com_err_hook);
+#endif
if (initscr() == ERR) {
fputs("Can't initialize curses!\n", stderr);
int margc;
char *margv[];
{
- struct menu_screen *my_ms, *old_cur_ms;
+ struct menu_screen *my_ms = NULLMS, *old_cur_ms = NULLMS;
char argvals[MAX_ARGC][MAX_ARGLEN]; /* This is where args are stored */
char buf[MAX_ARGC * MAX_ARGLEN];
char *argv[MAX_ARGC];
{
int c;
char *p;
- int y, x, oldx;
+ int y, x, oldx, oldy;
if (cur_ms != NULLMS) {
more_flg = 1;
getyx(cur_ms->ms_input, y, x);
oldx = x;
+ oldy = y;
p = buf;
while(1) {
(void) wmove(cur_ms->ms_input, y, x);
refresh_ms(cur_ms);
#endif notdef
getyx(cur_ms->ms_input, y, x);
+ oldy = y;
+ oldx = x;
+ p = buf;
break;
case '\n':
if (p > buf) {
p--;
x--;
+ if (x < 0) {
+ (void) wmove(cur_ms->ms_input, y, 0);
+ (void) wclrtoeol(cur_ms->ms_input);
+ y--;
+ x = cur_ms->ms_input->_maxx-1;
+ }
}
break;
case CTL('U'):
case CTL('G'):
case CTL('['):
x = oldx;
+ y = oldy;
p = buf;
break;
default:
(void) waddch(cur_ms->ms_input, c);
*p++ = c;
x++;
+ if (x >= cur_ms->ms_input->_maxx) {
+ x = 0;
+ y++;
+ }
} else
putchar(CTL('G'));
break;