[BACK]Return to aux.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mail

Diff for /src/usr.bin/mail/Attic/aux.c between version 1.4 and 1.5

version 1.4, 1997/05/30 08:51:32 version 1.5, 1997/07/13 21:21:08
Line 1 
Line 1 
 /*      $OpenBSD$       */  /*      $OpenBSD$       */
 /*      $NetBSD: aux.c,v 1.4 1996/06/08 19:48:10 christos Exp $ */  /*      $NetBSD: aux.c,v 1.5 1997/05/13 06:15:52 mikel Exp $    */
   
 /*  /*
  * Copyright (c) 1980, 1993   * Copyright (c) 1980, 1993
Line 64 
Line 64 
   
         if ((new = salloc(size)) != NOSTR)          if ((new = salloc(size)) != NOSTR)
                 bcopy(str, new, size);                  bcopy(str, new, size);
         return new;          return(new);
 }  }
   
 /*  /*
Line 85 
Line 85 
                 }                  }
                 bcopy(str, new + oldsize, newsize);                  bcopy(str, new + oldsize, newsize);
         }          }
         return new;          return(new);
 }  }
   
 /*  /*
Line 115 
Line 115 
         (void)fprintf(stderr, "panic: ");          (void)fprintf(stderr, "panic: ");
         vfprintf(stderr, fmt, ap);          vfprintf(stderr, fmt, ap);
         va_end(ap);          va_end(ap);
         (void)fprintf(stderr, "\n");          (void)putc('\n', stderr);
         fflush(stderr);          fflush(stderr);
         abort();          abort();
 }  }
Line 161 
Line 161 
   
         for (ap = argv; *ap++ != NOSTR;)          for (ap = argv; *ap++ != NOSTR;)
                 ;                  ;
         return ap - argv - 1;          return(ap - argv - 1);
 }  }
   
 /*  /*
Line 181 
Line 181 
   
         ibuf = setinput(mp);          ibuf = setinput(mp);
         if ((lc = mp->m_lines - 1) < 0)          if ((lc = mp->m_lines - 1) < 0)
                 return NOSTR;                  return(NOSTR);
         if (readline(ibuf, linebuf, LINESIZE) < 0)          if (readline(ibuf, linebuf, LINESIZE) < 0)
                 return NOSTR;                  return(NOSTR);
         while (lc > 0) {          while (lc > 0) {
                 if ((lc = gethfield(ibuf, linebuf, lc, &colon)) < 0)                  if ((lc = gethfield(ibuf, linebuf, lc, &colon)) < 0)
                         return oldhfield;                          return(oldhfield);
                 if ((hfield = ishfield(linebuf, colon, field)) != NULL)                  if ((hfield = ishfield(linebuf, colon, field)) != NULL)
                         oldhfield = save2str(hfield, oldhfield);                          oldhfield = save2str(hfield, oldhfield);
         }          }
         return oldhfield;          return(oldhfield);
 }  }
   
 /*  /*
Line 212 
Line 212 
   
         for (;;) {          for (;;) {
                 if (--rem < 0)                  if (--rem < 0)
                         return -1;                          return(-1);
                 if ((c = readline(f, linebuf, LINESIZE)) <= 0)                  if ((c = readline(f, linebuf, LINESIZE)) <= 0)
                         return -1;                          return(-1);
                 for (cp = linebuf; isprint(*cp) && *cp != ' ' && *cp != ':';                  for (cp = linebuf; isprint(*cp) && *cp != ' ' && *cp != ':';
                      cp++)                       cp++)
                         ;                          ;
Line 248 
Line 248 
                         cp += c;                          cp += c;
                 }                  }
                 *cp = 0;                  *cp = 0;
                 return rem;                  return(rem);
         }          }
         /* NOTREACHED */          /* NOTREACHED */
 }  }
Line 268 
Line 268 
         *cp = 0;          *cp = 0;
         if (strcasecmp(linebuf, field) != 0) {          if (strcasecmp(linebuf, field) != 0) {
                 *cp = ':';                  *cp = ':';
                 return 0;                  return(0);
         }          }
         *cp = ':';          *cp = ':';
         for (cp++; *cp == ' ' || *cp == '\t'; cp++)          for (cp++; *cp == ' ' || *cp == '\t'; cp++)
                 ;                  ;
         return cp;          return(cp);
 }  }
   
 /*  /*
Line 321 
Line 321 
         if ((cp = expand(*arglist)) == NOSTR)          if ((cp = expand(*arglist)) == NOSTR)
                 return(1);                  return(1);
         if ((fi = Fopen(cp, "r")) == NULL) {          if ((fi = Fopen(cp, "r")) == NULL) {
                 perror(cp);                  warn(cp);
                 return(1);                  return(1);
         }          }
         if (ssp >= NOFILE - 1) {          if (ssp >= NOFILE - 1) {
                 printf("Too much \"sourcing\" going on.\n");                  puts("Too much \"sourcing\" going on.");
                 Fclose(fi);                  (void)Fclose(fi);
                 return(1);                  return(1);
         }          }
         sstack[ssp].s_file = input;          sstack[ssp].s_file = input;
Line 348 
Line 348 
 unstack()  unstack()
 {  {
         if (ssp <= 0) {          if (ssp <= 0) {
                 printf("\"Source\" stack over-pop.\n");                  puts("\"Source\" stack over-pop.");
                 sourcing = 0;                  sourcing = 0;
                 return(1);                  return(1);
         }          }
         Fclose(input);          (void)Fclose(input);
         if (cond != CANY)          if (cond != CANY)
                 printf("Unmatched \"if\"\n");                  puts("Unmatched \"if\"");
         ssp--;          ssp--;
         cond = sstack[ssp].s_cond;          cond = sstack[ssp].s_cond;
         loading = sstack[ssp].s_loading;          loading = sstack[ssp].s_loading;
Line 447 
Line 447 
                         break;                          break;
                 }                  }
         }          }
         return cp;          return(cp);
 }  }
   
 /*  /*
Line 574 
Line 574 
         int first = 1;          int first = 1;
   
         if ((cp = hfield("from", mp)) != NOSTR)          if ((cp = hfield("from", mp)) != NOSTR)
                 return cp;                  return(cp);
         if (reptype == 0 && (cp = hfield("sender", mp)) != NOSTR)          if (reptype == 0 && (cp = hfield("sender", mp)) != NOSTR)
                 return cp;                  return(cp);
         ibuf = setinput(mp);          ibuf = setinput(mp);
         namebuf[0] = '\0';          namebuf[0] = '\0';
         if (readline(ibuf, linebuf, LINESIZE) < 0)          if (readline(ibuf, linebuf, LINESIZE) < 0)
Line 606 
Line 606 
                                 break;                                  break;
                         cp++;                          cp++;
                         if (first) {                          if (first) {
                                 strcpy(namebuf, cp);                                  cp2 = namebuf;
                                 first = 0;                                  first = 0;
                         } else                          } else
                                 strcpy(strrchr(namebuf, '!')+1, cp);                                  cp2 = strrchr(namebuf, '!') + 1;
                           strncpy(cp2, cp, sizeof(namebuf) - (cp2 - namebuf) - 2);
                           namebuf[sizeof(namebuf) - 2] = '\0';
                         strcat(namebuf, "!");                          strcat(namebuf, "!");
                         goto newname;                          goto newname;
                 }                  }
Line 645 
Line 647 
   
         while (*s1)          while (*s1)
                 if (strchr(s2, *s1++))                  if (strchr(s2, *s1++))
                         return 1;                          return(1);
         return 0;          return(0);
 }  }
   
 /*  /*
Line 658 
Line 660 
 {  {
   
         if (islower(c))          if (islower(c))
                 return toupper(c);                  return(toupper(c));
         return c;          return(c);
 }  }
   
 /*  /*
Line 672 
Line 674 
   
         while ((*s2++ = *s1++) != '\0')          while ((*s2++ = *s1++) != '\0')
                 ;                  ;
         return s2 - 1;          return(s2 - 1);
 }  }
   
 /*  /*
Line 683 
Line 685 
         char *field;          char *field;
         struct ignoretab ignore[2];          struct ignoretab ignore[2];
 {  {
         char realfld[BUFSIZ];          char realfld[LINESIZE];
   
         if (ignore == ignoreall)          if (ignore == ignoreall)
                 return 1;                  return(1);
         /*          /*
          * Lower-case the string, so that "Status" and "status"           * Lower-case the string, so that "Status" and "status"
          * will hash to the same place.           * will hash to the same place.
          */           */
         istrcpy(realfld, field);          istrcpy(realfld, field);
         if (ignore[1].i_count > 0)          if (ignore[1].i_count > 0)
                 return (!member(realfld, ignore + 1));                  return(!member(realfld, ignore + 1));
         else          else
                 return (member(realfld, ignore));                  return(member(realfld, ignore));
 }  }
   
 int  int
Line 708 
Line 710 
         for (igp = table->i_head[hash(realfield)]; igp != 0; igp = igp->i_link)          for (igp = table->i_head[hash(realfield)]; igp != 0; igp = igp->i_link)
                 if (*igp->i_field == *realfield &&                  if (*igp->i_field == *realfield &&
                     equal(igp->i_field, realfield))                      equal(igp->i_field, realfield))
                         return (1);                          return(1);
         return (0);          return(0);
 }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5