]> code.citadel.org Git - citadel.git/commitdiff
* Final touches on the new message formatter.
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 15 Dec 2002 10:53:51 +0000 (10:53 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 15 Dec 2002 10:53:51 +0000 (10:53 +0000)
citadel/ChangeLog
citadel/citadel.c
citadel/commands.c
citadel/messages.c
citadel/routines.c
citadel/techdoc/developers.txt

index 328100303f4d7a6fabbfd0fd0d88525665e5d198..aa7c63ec4b38e2b9b0b1164377dfb11b35430120 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 601.90  2002/12/15 10:53:51  error
+ * Final touches on the new message formatter.
+
  Revision 601.89  2002/12/15 09:42:37  error
  * Converted more routines to new IPC code.
 
@@ -4306,4 +4309,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 62a79774b08b4cd601633d0424a3f8bed6b9b167..be0a3740b496efc324605f05886ec59ca1786d1e 100644 (file)
@@ -190,7 +190,7 @@ void formout(CtdlIPC *ipc, char *name)
                return;
        }
        if (text) {
-               fmout2(screenwidth, NULL, text, NULL,
+               fmout(screenwidth, NULL, text, NULL,
                      ((userflags & US_PAGINATOR) ? 1 : 0),
                      screenheight, 1, 1);
                free(text);
@@ -1164,7 +1164,7 @@ int main(int argc, char **argv)
        }
        scr_printf("<< wrong password >>\n");
        if (strlen(rc_password) > 0)
-               logoff(ipc, 0);
+               logoff(ipc, 2);
        goto GSTA;
 
 NEWUSR:        if (strlen(rc_password) == 0) {
index 5ef5445ec64059aee513c8ba8f5d898b0fbf612e..25849b12bfccc26f49943de75d86abefb97b50ec 100644 (file)
@@ -314,7 +314,7 @@ void print_express(void)
        
                scr_printf(":\n");
                lines_printed++;
-               fmout2(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
+               fmout(screenwidth, NULL, listing, NULL, 1, screenheight, -1, 0);
                free(listing);
 
                /* when running in curses mode, the scroll bar in most
@@ -1267,6 +1267,7 @@ void display_help(CtdlIPC *ipc, char *name)
 }
 
 
+#if 0
 /*
  * fmout()  -  Citadel text formatter and paginator
  */
@@ -1429,12 +1430,13 @@ FMTEND:
        }
        return (sigcaught);
 }
+#endif
 
 
 /*
  * fmout() - Citadel text formatter and paginator
  */
-int fmout2(
+int fmout(
        int width,      /* screen width to use */
        FILE *fpin,     /* file to read from, or NULL to format given text */
        char *text,     /* text to be formatted (when fpin is NULL */
@@ -1453,6 +1455,7 @@ int fmout2(
 
        num_urls = 0;   /* Start with a clean slate of embedded URL's */
 
+       /* Space for a single word, which can be at most screenwidth */
        word = (char *)calloc(1, width);
        if (!word) {
                err_printf("Can't alloc memory to print message: %s!\n",
@@ -1460,6 +1463,7 @@ int fmout2(
                logoff(NULL, 3);
        }
 
+       /* Read the entire message body into memory */
        if (fpin) {
                size_t got = 0;
 
@@ -1491,11 +1495,12 @@ int fmout2(
        if (starting_lp >= 0)
                lines_printed = starting_lp;
 
+       /* Run the message body */
        while (*e) {
                /* First, are we looking at a newline? */
                if (*e == '\n') {
                        e++;
-                       if (*e == ' ') {
+                       if (*e == ' ') {        /* Paragraph */
                                if (fpout) {
                                        fprintf(fpout, "\n");
                                } else {
@@ -1504,7 +1509,7 @@ int fmout2(
                                        lines_printed = checkpagin(lines_printed, pagin, height);
                                }
                                column = 0;
-                       } else if (old != ' ') {
+                       } else if (old != ' ') {/* Don't print two spaces */
                                if (fpout) {
                                        fprintf(fpout, " ");
                                } else {
@@ -1512,6 +1517,7 @@ int fmout2(
                                }
                                column++;
                        }
+                       old = '\n';
                        continue;
                }
                /* Or are we looking at a space? */
@@ -1528,7 +1534,7 @@ int fmout2(
                                }
                                column = 0;
                        } else if (!(column == 0 && old == ' ')) {
-                               /* Eat the first space on a line */
+                               /* Eat only the first space on a line */
                                if (fpout) {
                                        fprintf(fpout, " ");
                                } else {
@@ -1589,6 +1595,7 @@ int fmout2(
 
                /* Decide where to print the word */
                if (column + i >= width) {
+                       /* Wrap to the next line */
                        if (fpout) {
                                fprintf(fpout, "\n");
                        } else {
@@ -1606,13 +1613,14 @@ int fmout2(
                        scr_printf("%s", word);
                }
                column += i;
-               e += i;         /* Start with the whitepsace! */
+               e += i;         /* Start over with the whitepsace! */
        }
 
        free(word);
        if (fpin)               /* We allocated this, remember? */
                free(buffer);
 
+       /* Is this necessary?  It makes the output kind of spacey. */
        if (fpout) {
                fprintf(fpout, "\n");
        } else {
index ed330dc992be2add49a79def31781838701a602b..b733f5feba18dd82c7d83a5880cea077e47469b1 100644 (file)
@@ -586,7 +586,7 @@ int read_message(CtdlIPC *ipc,
         * Here we go
         */
        if (format_type == 0) {
-               fr = fmout2(screenwidth, NULL, message->text, dest,
+               fr = fmout(screenwidth, NULL, message->text, dest,
                           ((pagin == 1) ? 1 : 0), screenheight, (-1), 1);
        } else {
                /* FIXME: renderer for text/plain */
@@ -766,7 +766,7 @@ int client_make_message(CtdlIPC *ipc,
        if (mode == 0) {
                fp = fopen(filename, "r");
                if (fp != NULL) {
-                       fmout2(screenwidth, fp, NULL, NULL, 0, screenheight, 0, 0);
+                       fmout(screenwidth, fp, NULL, NULL, 0, screenheight, 0, 0);
                        beg = ftell(fp);
                        fclose(fp);
                } else {
@@ -876,7 +876,7 @@ MECR:       if (mode == 2) {
                }
                fp = fopen(filename, "r");
                if (fp != NULL) {
-                       fmout2(screenwidth, fp, NULL, NULL,
+                       fmout(screenwidth, fp, NULL, NULL,
                              ((userflags & US_PAGINATOR) ? 1 : 0),
                              screenheight, 0, 0);
                        beg = ftell(fp);
index 1c6e07e6a8d64a0054a919bbe4055f1ae7c74a7f..d0538c240e369e5adec46daeba81408635eba0bd 100644 (file)
@@ -331,17 +331,6 @@ int pattern(char *search, char *patn) {
 }
 
 
-/* display internal error as defined in errmsgs */
-/*
-void interr(int errnum) {
-       scr_printf("*** INTERNAL ERROR %d\n"
-               "(Press any key to continue)\n", errnum);
-       inkey();
-       logoff(errnum);
-}
-*/
-
-
 void strproc(char *string)
 {
        int a;
index 3c5d681ac71b9983aa3b6dde11cc66c3bcc6d67f..a2ae30e7eb2127c49c34ea75006bc4dc84a68c1f 100644 (file)
@@ -40,10 +40,10 @@ Developer codes (and where known, client codes)
  
  7      Walden Leverich <waldenl@techsoftinc.com>
 
- 8      Michael Hampton <error@canandstring.com>
+ 8      Michael Hampton <error@spiritone.com>
 
         Client  Name            Status          Description
-       0       (unnamed)       in design       Client-side API library
+       0       libcitadel      in development  Client-side API library
        1       D.O.C.          in development  Dave's Own Citadel look-alike
  
  69     Anticlimactic Teleservices