From 34f474570fed4c538ddd9716e673459321116476 Mon Sep 17 00:00:00 2001 From: wesommer Date: Fri, 21 Aug 1987 23:31:37 +0000 Subject: [PATCH] Now passes lint with minimal difficulties. --- clients/moira/menu.c | 47 +++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/clients/moira/menu.c b/clients/moira/menu.c index a2331157..6f9bbe28 100644 --- a/clients/moira/menu.c +++ b/clients/moira/menu.c @@ -7,9 +7,12 @@ * $Author$ * $Header$ * $Log$ - * Revision 1.8 1987-08-21 22:52:37 wesommer - * [changes from poto] + * Revision 1.9 1987-08-21 23:31:37 wesommer + * Now passes lint with minimal difficulties. * + * Revision 1.8 87/08/21 22:52:37 wesommer + * [changes from poto] + * * Revision 1.7 87/08/17 14:23:05 jtkohl * add Password_input * @@ -50,10 +53,12 @@ static char rcsid_menu_c[] = "$Header$"; #endif lint +#include #include #include #include #include +#include #include "menu.h" #define MAX(A,B) ((A) > (B) ? (A) : (B)) @@ -62,8 +67,7 @@ static char rcsid_menu_c[] = "$Header$"; #define MIN_INPUT 2 /* Minimum number of lines for input window */ -char *strcpy(); -char *strncpy(); +extern char *calloc(); int more_flg = 1; /* Structure for holding current displayed menu */ @@ -94,8 +98,8 @@ Start_menu(m) fputs("Can't initialize curses!\n", stderr); Start_no_menu(m); } - raw(); /* We parse & print everything ourselves */ - noecho(); + (void) raw(); /* We parse & print everything ourselves */ + (void) noecho(); cur_ms = make_ms(0); /* So we always have some current */ /* menu_screen */ top_menu = m; @@ -107,8 +111,8 @@ Start_menu(m) Cleanup_menu() { if (cur_ms) { - wclear(cur_ms->ms_screen); - wrefresh(cur_ms->ms_screen); + (void) wclear(cur_ms->ms_screen); + (void) wrefresh(cur_ms->ms_screen); } endwin(); } @@ -343,13 +347,13 @@ int Prompt_input(prompt, buf, buflen) case CTL('C'): return 0; case CTL('Z'): - kill(getpid(), SIGTSTP); + (void) kill(getpid(), SIGTSTP); touchwin(curscr); break; case CTL('L'): (void) wclear(cur_ms->ms_input); (void) waddstr(cur_ms->ms_input, prompt); - wrefresh(curscr); + (void) wrefresh(curscr); getyx(cur_ms->ms_input, y, x); break; case '\n': @@ -427,13 +431,13 @@ int Password_input(prompt, buf, buflen) case CTL('C'): return 0; case CTL('Z'): - kill(getpid(), SIGTSTP); + (void) kill(getpid(), SIGTSTP); touchwin(curscr); break; case CTL('L'): (void) wclear(cur_ms->ms_input); (void) waddstr(cur_ms->ms_input, prompt); - wrefresh(curscr); + (void) wrefresh(curscr); getyx(cur_ms->ms_input, y, x); break; case '\n': @@ -467,20 +471,21 @@ int Password_input(prompt, buf, buflen) struct sgttyb ttybuf, nttybuf; printf("%s", prompt); /* turn off echoing */ - (void) ioctl(0, TIOCGETP, &ttybuf); + (void) ioctl(0, TIOCGETP, (char *)&ttybuf); nttybuf = ttybuf; nttybuf.sg_flags &= ~ECHO; - (void)ioctl(0, TIOCSETP, &nttybuf); + (void)ioctl(0, TIOCSETP, (char *)&nttybuf); if (gets(buf) == NULL) { - (void) ioctl(0, TIOCSETP, &ttybuf); + (void) ioctl(0, TIOCSETP, (char *)&ttybuf); putchar('\n'); return 0; } putchar('\n'); - (void) ioctl(0, TIOCSETP, &ttybuf); + (void) ioctl(0, TIOCSETP, (char *)&ttybuf); Start_paging(); return 1; } + return 0; } int lines_left; @@ -510,15 +515,15 @@ char *msg; { char *copy, *line, *s; - copy = (char *) malloc(COLS); + copy = (char *) malloc((u_int)COLS); s = line = msg; while(*s++) { if (s - line >= COLS-1) { - strncpy(copy, line, COLS-1); + (void) strncpy(copy, line, COLS-1); line += COLS-1; } else if (*s == '\n') { *s = '\0'; - strcpy(copy, line); + (void) strcpy(copy, line); line = ++s; } else continue; @@ -552,6 +557,8 @@ char *msg; return; } getyx(cur_ms->ms_input, y, x); + /* x is a bitbucket; avoid lint problems */ + x=x; (void) wmove(cur_ms->ms_input, y, 0); (void) wclrtoeol(cur_ms->ms_input); } @@ -564,7 +571,7 @@ char *msg; } if (cur_ms != NULLMS) { - msg1 = (char *) calloc(COLS, 1); + msg1 = (char *) calloc((u_int)COLS, 1); (void) strncpy(msg1, msg, COLS-1); for (i = strlen(msg1); i < COLS - 1; i++) msg1[i] = ' '; -- 2.45.2