]> andersk Git - moira.git/blobdiff - clients/mailmaint/mailmaint.c
don't print prompt message over data line
[moira.git] / clients / mailmaint / mailmaint.c
index 482ee5abccfce728ee22dde8f6299b56b5c1237f..2a64c8a2a86803f9172e6538da4c9dc1d4907585 100644 (file)
@@ -3,6 +3,10 @@
  *     $Header$
  */
 
+/*  (c) Copyright 1988 by the Massachusetts Institute of Technology. */
+/*  For copying and distribution information, please see the file */
+/*  <mit-copyright.h>. */
+
 #ifndef lint
 static char rcsid_mailmaint_c[] = "$Header$";
 #endif lint
@@ -22,7 +26,9 @@ static char rcsid_mailmaint_c[] = "$Header$";
 #include <varargs.h>
 #include <com_err.h>
 #include <ctype.h>
-#include "mit-copyright.h"
+#include <sms.h>
+#include <sms_app.h>
+#include <mit-copyright.h>
 
 #define STARTCOL 0
 #define STARTROW 3
@@ -124,7 +130,7 @@ main(argc, argv)
 
     printf("Connecting to database for %s...please hold on.\n", uname);
 
-    status = sms_connect();
+    status = sms_connect(SMS_SERVER);
     if (status) {
        (void) sprintf(buf, "\nConnection to SMS server failed");
        goto punt;
@@ -270,7 +276,7 @@ show_list_info()
 
     show_text(DISPROW, STARTCOL, "Show information about a list.\n\r");
     buf = calloc((unsigned)1024, 1);
-    if (Prompt("Enter List Name: ", buf, LISTSIZE) == 1) {
+    if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1) {
        Put_message("\n\r");
        if (fetch_list_info(buf, current_li) == 0) {
            (void) sprintf(buf, "Description: %s\n\r", current_li->desc);
@@ -344,7 +350,7 @@ start_display_buff(buff)
        currow++;
        mvcur(0, 0, currow, STARTCOL);
        refresh();
-       if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1) == 0) {
+       if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1, 0) == 0) {
            Put_message("Flushing query...");
            moreflg = 1;
            return (0);
@@ -368,7 +374,7 @@ add_member()
 
     show_text(DISPROW, STARTCOL, "Add yourself to a list\n\r");
     buf = calloc(LISTMAX, 1);
-    if (Prompt("Enter List Name: ", buf, LISTSIZE) == 1) {
+    if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1) {
        Put_message("\r\n");
        argv[0] = strsave(buf);
        argv[1] = strsave("user");
@@ -398,7 +404,7 @@ delete_member()
 
     show_text(DISPROW, STARTCOL, "Remove yourself from a list\n\r");
     buf = calloc(LISTMAX, 1);
-    if (Prompt("Enter List Name: ", buf, LISTSIZE) == 1) {
+    if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1) {
        Put_message("\r\n");
        argv[0] = strsave(buf);
        argv[1] = strsave("user");
@@ -438,6 +444,7 @@ list_by_member()
        Put_message("\r\n");
        com_err(whoami, status, " in get_lists_of_member");
     }
+    currow++;
     show_text(currow, STARTCOL, "Press any Key to continue...");
     (void) getchar();
     clrwin(DISPROW);
@@ -532,7 +539,7 @@ list_members()
     mvcur(0, 0, DISPROW, STARTCOL);
     refresh();
     buf = calloc(LISTMAX, 1);
-    if (Prompt("Enter List Name: ", buf, LISTSIZE) == 1) {
+    if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1) {
        (void) sprintf(buffer, "The members of list '%s' are:", buf);
        show_text(DISPROW + 1, STARTCOL, buffer);
        argv[0] = buf;
@@ -588,7 +595,7 @@ start_display(buff)
        currow++;
        mvcur(0, 0, currow, STARTCOL);
        refresh();
-       if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1) == 0) {
+       if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1, 0) == 0) {
            Put_message("Flushing query...");
            moreflg = 1;
            return (0);
@@ -856,10 +863,11 @@ get_list_info(argc, argv)
 /****************************************************/
 /* Prompt the user for input */
 int 
-Prompt(prompt, buf, buflen)
+Prompt(prompt, buf, buflen, crok)
     char *prompt;
     char *buf;
     int buflen;
+    int crok;
 {
     int c;
     char *p;
@@ -881,7 +889,8 @@ Prompt(prompt, buf, buflen)
            return (0);
        case '\n':
        case '\r':
-           Put_message("\r");
+           if (crok)
+               Put_message("\r");
            *p = '\0';
            if (strlen(buf) < 1)/* only \n or \r in buff */
                return (-1);
@@ -892,15 +901,15 @@ Prompt(prompt, buf, buflen)
            if (p > buf) {
                p--;
                x--;
-               Put_message("\b");
-               Put_message(" ");
-               Put_message("\b");
+               printf("\b \b");
            }
            break;
        case CTL('U'):
        case CTL('G'):
        case CTL('['):
            x = oldx;
+           while (p-- > buf)
+               printf("\b \b");
            p = buf;
            break;
        default:
@@ -954,15 +963,3 @@ menu_err_hook(who, code, fmt, args)
     (void) putc('\0', &_strbuf);
     Put_message(buf);
 }
-
-
-/*
- * Local Variables:
- * mode: c
- * c-indent-level: 4
- * c-continued-statement-offset: 4
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * End: 
- */
This page took 0.037306 seconds and 4 git commands to generate.