]> code.citadel.org Git - citadel.git/commitdiff
* msgbase.c: eliminated most gotos; a single goto in alias() remains because
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Oct 2000 14:14:19 +0000 (14:14 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 28 Oct 2000 14:14:19 +0000 (14:14 +0000)
  it actually makes sense to do it that way...

citadel/ChangeLog
citadel/msgbase.c

index b717d5ec1f69064597bc7c8fca521851c1c68136..4421a38e4bce22d9006fd744cf5f6deb6b1c6e97 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 573.18  2000/10/28 14:14:19  error
+ * msgbase.c: eliminated most gotos; a single goto in alias() remains because
+   it actually makes sense to do it that way...
+
  Revision 573.17  2000/10/25 21:37:09  ajc
  * Implemented the AUTHENTICATE LOGIN command in IMAP
 
@@ -2109,4 +2113,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 2ef26071149cd0a162bebd24d2f2440b9f9c591e..307fc3251bf26c4956a55b1842197d5029743f34 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * $Id$
  *
  * Implements the message store.
@@ -85,13 +85,12 @@ void remove_any_whitespace_to_the_left_or_right_of_at_symbol(char *name)
 {
        int i;
 
-stov:  for (i = 0; i < strlen(name); ++i) {
+       for (i = 0; i < strlen(name); ++i) {
                if (name[i] == '@') {
-                       if (i > 0)
-                               if (isspace(name[i - 1])) {
-                                       strcpy(&name[i - 1], &name[i]);
-                                       goto stov; /* start over */
-                               }
+                       while (isspace(name[i - 1]) && i > 0) {
+                               strcpy(&name[i - 1], &name[i]);
+                               --i;
+                       }
                        while (isspace(name[i + 1])) {
                                strcpy(&name[i + 1], &name[i + 2]);
                        }
@@ -171,7 +170,7 @@ int alias(char *name)
                        strcpy(bbb, &bbb[1]);
                fp = fopen("network/mail.sysinfo", "r");
                if (fp == NULL)
-                       return (MES_ERROR);
+                       return (MES_ERROR);    
 GETSN:         do {
                        a = getstring(fp, aaa);
                } while ((a >= 0) && (strcasecmp(aaa, bbb)));
@@ -507,67 +506,65 @@ void memfmout(
        strcpy(buffer, "");
        c = 1;                  /* c is the current pos */
 
-FMTA:  if (subst) {
-               while (ch = *mptr, ((ch != 0) && (strlen(buffer) < 126))) {
-                       ch = *mptr++;
-                       buffer[strlen(buffer) + 1] = 0;
-                       buffer[strlen(buffer)] = ch;
-               }
+       do {
+               if (subst) {
+                       while (ch = *mptr, ((ch != 0) && (strlen(buffer) < 126))) {
+                               ch = *mptr++;
+                               buffer[strlen(buffer) + 1] = 0;
+                               buffer[strlen(buffer)] = ch;
+                       }
 
-               if (buffer[0] == '^')
-                       do_help_subst(buffer);
+                       if (buffer[0] == '^')
+                               do_help_subst(buffer);
 
-               buffer[strlen(buffer) + 1] = 0;
-               a = buffer[0];
-               strcpy(buffer, &buffer[1]);
-       } else {
-               ch = *mptr++;
-       }
-
-       old = real;
-       real = ch;
-       if (ch <= 0)
-               goto FMTEND;
+                       buffer[strlen(buffer) + 1] = 0;
+                       a = buffer[0];
+                       strcpy(buffer, &buffer[1]);
+               } else {
+                       ch = *mptr++;
+               }
 
-       if (((ch == 13) || (ch == 10)) && (old != 13) && (old != 10))
-               ch = 32;
-       if (((old == 13) || (old == 10)) && (isspace(real))) {
-               cprintf("%s", nl);
-               c = 1;
-       }
-       if (ch > 126)
-               goto FMTA;
+               old = real;
+               real = ch;
 
-       if (ch > 32) {
-               if (((strlen(aaa) + c) > (width - 5)) && (strlen(aaa) > (width - 5))) {
-                       cprintf("%s%s", nl, aaa);
-                       c = strlen(aaa);
-                       aaa[0] = 0;
-               }
-               b = strlen(aaa);
-               aaa[b] = ch;
-               aaa[b + 1] = 0;
-       }
-       if (ch == 32) {
-               if ((strlen(aaa) + c) > (width - 5)) {
+               if (((ch == 13) || (ch == 10)) && (old != 13) && (old != 10))
+                       ch = 32;
+               if (((old == 13) || (old == 10)) && (isspace(real))) {
                        cprintf("%s", nl);
                        c = 1;
                }
-               cprintf("%s ", aaa);
-               ++c;
-               c = c + strlen(aaa);
-               strcpy(aaa, "");
-               goto FMTA;
-       }
-       if ((ch == 13) || (ch == 10)) {
-               cprintf("%s%s", aaa, nl);
-               c = 1;
-               strcpy(aaa, "");
-               goto FMTA;
-       }
-       goto FMTA;
+               if (ch > 126)
+                       continue;
+
+               if (ch > 32) {
+                       if (((strlen(aaa) + c) > (width - 5)) && (strlen(aaa) > (width - 5))) {
+                               cprintf("%s%s", nl, aaa);
+                               c = strlen(aaa);
+                               aaa[0] = 0;
+                       }
+                       b = strlen(aaa);
+                       aaa[b] = ch;
+                       aaa[b + 1] = 0;
+               }
+               if (ch == 32) {
+                       if ((strlen(aaa) + c) > (width - 5)) {
+                               cprintf("%s", nl);
+                               c = 1;
+                       }
+                       cprintf("%s ", aaa);
+                       ++c;
+                       c = c + strlen(aaa);
+                       strcpy(aaa, "");
+               }
+               if ((ch == 13) || (ch == 10)) {
+                       cprintf("%s%s", aaa, nl);
+                       c = 1;
+                       strcpy(aaa, "");
+               }
+
+       } while (ch > 0);
 
-FMTEND:        cprintf("%s%s", aaa, nl);
+       cprintf("%s%s", aaa, nl);
 }
 
 
@@ -2029,27 +2026,26 @@ void cmd_ent0(char *entargs)
                }
                if (!strcasecmp(buf, "sysop")) {
                        mtsflag = 1;
-                       goto SKFALL;
-               }
-               if (e != MES_LOCAL)
-                       goto SKFALL;    /* don't search local file  */
-               if (!strcasecmp(buf, CC->usersupp.fullname)) {
-                       cprintf("%d Can't send mail to yourself!\n",
-                               ERROR + NO_SUCH_USER);
-                       return;
                }
-               /* Check to make sure the user exists; also get the correct
-                * upper/lower casing of the name. 
-                */
-               a = getuser(&tempUS, buf);
-               if (a != 0) {
-                       cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
-                       return;
+               else if (e == MES_LOCAL) {      /* don't search local file */
+                       if (!strcasecmp(buf, CC->usersupp.fullname)) {
+                               cprintf("%d Can't send mail to yourself!\n",
+                                       ERROR + NO_SUCH_USER);
+                               return;
+                       }
+                       /* Check to make sure the user exists; also get the correct
+                        * upper/lower casing of the name.
+                        */
+                       a = getuser(&tempUS, buf);
+                       if (a != 0) {
+                               cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
+                               return;
+                       }
+                       strcpy(buf, tempUS.fullname);
                }
-               strcpy(buf, tempUS.fullname);
        }
 
-SKFALL:        b = MES_NORMAL;
+       b = MES_NORMAL;
        if (CC->quickroom.QRflags & QR_ANONONLY)
                b = MES_ANON;
        if (CC->quickroom.QRflags & QR_ANONOPT) {