]> andersk Git - moira.git/commitdiff
menu.c: fix Linux/NetBSD ncurses display problems
authordanw <danw>
Mon, 1 Sep 1997 19:40:42 +0000 (19:40 +0000)
committerdanw <danw>
Mon, 1 Sep 1997 19:40:42 +0000 (19:40 +0000)
main.c, namespace.c: use fgets() instead of gets() to make NetBSD (and
other?) cc not complain about possible buffer overruns

clients/moira/main.c
clients/moira/menu.c
clients/moira/namespace.c

index 30e543328c2266a8ad9b921b17a458ab5bc8593f..7295830eb8d10456baa163a62ddd2c994ff7b474 100644 (file)
@@ -119,7 +119,7 @@ main(argc, argv)
        if (status == MR_USER_AUTH) {
            char buf[BUFSIZ];
            com_err(program_name, status, "\nPress [RETURN] to continue");
-           gets(buf);
+           fgets(buf, BUFSIZ, stdin);
        } else {
          if (status >= ERROR_TABLE_BASE_krb &&
              status <= ERROR_TABLE_BASE_krb + 256)
index 7df215b1769fef0eaa6ff3dd4975a1e0aea843ec..015d7e170ce118ccfb704c624b539f3c70d5b594 100644 (file)
@@ -241,7 +241,8 @@ Do_menu(m, margc, margv)
        cur_ms = my_ms = make_ms(m->m_length + 2 + (is_topmenu ? 0 : 1));
 
        /* Now print the title and the menu */
-       (void) wclear(my_ms->ms_menu);
+       (void) wclear(my_ms->ms_screen);
+       (void) wrefresh(my_ms->ms_screen);
        (void) wmove(my_ms->ms_title, 0, MAX(0, (COLS -
                                                 strlen(m->m_title)) >> 1));
        (void) wstandout(my_ms->ms_title);
@@ -289,8 +290,10 @@ Do_menu(m, margc, margv)
        /* This will be set by a return val from func or submenu */
        quitflag = DM_NORMAL;
        /* This is here because we may be coming from another menu */
-       if (cur_ms != NULL)
+       if (cur_ms != NULL) {
            touchwin(my_ms->ms_screen);
+           wrefresh(my_ms->ms_screen);
+       }
        if (margc > 1) {
            /* Initialize argv */
            for (argc = 0; argc < MAX_ARGC; argc++)
@@ -439,7 +442,7 @@ int Prompt_input(prompt, buf, buflen)
        p = buf;
        while(1) {
            (void) wmove(cur_ms->ms_input, y, x);
-               (void) touchwin(cur_ms->ms_screen);
+           (void) touchwin(cur_ms->ms_screen);
            (void) wclrtoeol(cur_ms->ms_input);
            (void) wrefresh(cur_ms->ms_input);
            c = getchar() & 0x7f;
@@ -449,14 +452,14 @@ int Prompt_input(prompt, buf, buflen)
                return 0;
            case CTL('Z'):
                (void) kill(getpid(), SIGTSTP);
-               touchwin(curscr);
+               touchwin(cur_ms->ms_screen);
                break;
            case CTL('L'):
                (void) wclear(cur_ms->ms_input);
+               (void) wmove(cur_ms->ms_input, 0, 0);
                (void) waddstr(cur_ms->ms_input, prompt);
                (void) touchwin(cur_ms->ms_input);
-               (void) move(LINES - 1, 0);
-               (void) wrefresh(curscr);
+               (void) wrefresh(cur_ms->ms_screen);
                getyx(cur_ms->ms_input, y, x);
                oldy = y;
                oldx = x;
@@ -520,7 +523,7 @@ int Prompt_input(prompt, buf, buflen)
        goto gotit;
     } else {
        printf("%s", prompt);
-       if (gets(buf) == NULL)
+       if (fgets(buf, buflen, stdin) == NULL)
            return 0;
        if (interrupt) {
            interrupt = 0;
index 415a85432763e97130bcedd3b085fb929b33d980..d07b9775bba081c0d3e2a2b36987f9fcc351ffb2 100644 (file)
@@ -247,7 +247,7 @@ main(argc, argv)
        if (status == MR_USER_AUTH) {
            char buf[BUFSIZ];
            com_err(program_name, status, "\nPress [RETURN] to continue");
-           gets(buf);
+           fgets(buf, BUFSIZ, stdin);
        } else
          ErrorExit("\nAuthorization failed -- please run kinit", status);
     }
This page took 0.051685 seconds and 5 git commands to generate.