]> andersk Git - moira.git/commitdiff
make it work correctly without curses.
authormar <mar>
Tue, 26 Jan 1988 16:39:03 +0000 (16:39 +0000)
committermar <mar>
Tue, 26 Jan 1988 16:39:03 +0000 (16:39 +0000)
make ? display the current menu.
if (no curses), display menu on entry

clients/moira/menu.c

index df318434cfd7281a33b78c02311188fe5591433d..f5976851747ed4b4981748036afc2ebdd0a63394 100644 (file)
@@ -135,6 +135,7 @@ Start_no_menu(m)
     Menu *m;
 {
     cur_ms = NULLMS;
+    COLS = 80;
     top_menu = m;
     /* Run the menu */
     (void) Do_menu(m, -1, (char **) NULL);
@@ -249,6 +250,20 @@ Do_menu(m, margc, margv)
                           " t. (toggle)       Toggle logging on and off.");
        (void) wmove(my_ms->ms_menu, line, 0);
        (void) waddstr(my_ms->ms_menu, " q. (quit)         Quit.");
+    } else {
+       Put_message(m->m_title);
+       for (line = 0; line < m->m_length; line++) {
+           sprintf(buf, "%2d. (%s)%*s %s.", line + 1,
+                   m->m_lines[line].ml_command,
+                   12 - strlen(m->m_lines[line].ml_command), "",
+                   m->m_lines[line].ml_doc);
+           Put_message(buf);
+       }
+       if (!is_topmenu)
+           Put_message(" r. (return)       Return to previous menu.");
+       Put_message(" t. (toggle)       Toggle logging on and off.");
+       Put_message(" q. (quit)         Quit.");
+       Put_message(" ?.                Print this information.");
     }
 
     for (;;) {
@@ -284,6 +299,20 @@ Do_menu(m, margc, margv)
                m->m_exit(m);
            return (*argv[0] == 'r' ? DM_NORMAL : DM_QUIT);
        }
+       else if (argv[0][0] == '?') {
+           for (line = 0; line < m->m_length; line++) {
+               sprintf(buf, "%2d. (%s)%*s %s.", line + 1,
+                       m->m_lines[line].ml_command,
+                       12 - strlen(m->m_lines[line].ml_command), "",
+                       m->m_lines[line].ml_doc);
+               Put_message(buf);
+           }
+           if (!is_topmenu)
+               Put_message(" r. (return)       Return to previous menu.");
+           Put_message(" t. (toggle)       Toggle logging on and off.");
+           Put_message(" q. (quit)         Quit.");
+           continue;
+       }
        else if (!strcmp(argv[0], "t") || !strcmp(argv[0], "toggle")) {
            toggle_logging(argc, argv);
            continue;
@@ -730,7 +759,7 @@ toggle_logging(argc, argv)
            (void) sprintf(buf, "/usr/tmp/%s-log.%d", whoami, pid);
 
        /* open the file */
-       log_file = fopen(&buf,"a");
+       log_file = fopen(buf,"a");
 
        if (log_file == (FILE *) NULL)
            Put_message("Open of log file failed.  Logging is not on.");
This page took 0.115606 seconds and 5 git commands to generate.