/[gnats]/gnats/gnats/mail.c
ViewVC logotype

Diff of /gnats/gnats/mail.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by pdm, Wed Oct 17 17:04:53 2001 UTC revision 1.17 by pdm, Sun Sep 1 12:14:47 2002 UTC
# Line 1  Line 1 
1  /* Mail processing routines for GNATS.  /* Mail processing routines for GNATS.
2     Copyright (C) 2000 Free Software Foundation, Inc.     Copyright (C) 2000, 2002 Free Software Foundation, Inc.
3     Contributed by Bob Manson (manson@juniper.net).     Contributed by Bob Manson (manson@juniper.net).
4    
5  This file is part of GNU GNATS.  This file is part of GNU GNATS.
# Line 179  static char * Line 179  static char *
179  getOneAddress (const char **addrPtr)  getOneAddress (const char **addrPtr)
180  {  {
181    const char *addr = *addrPtr;    const char *addr = *addrPtr;
182    const char *addrStart = addr;    const char *addrStart, *addrEnd;
183    char *res;    char *res;
184    
185      if (addrPtr == NULL || *addrPtr == NULL)
186        {
187          return NULL;
188        }
189    
190      /* skip over leading white space */
191      while (*addr && isspace(*addr))
192        {
193          addr++;
194        }
195      addrStart = addr;
196    
197    while (*addr != ',' && *addr != '\0')    while (*addr != ',' && *addr != '\0')
198      {      {
199        char nextc = '\0';        char nextc = '\0';
# Line 211  getOneAddress (const char **addrPtr) Line 223  getOneAddress (const char **addrPtr)
223          }          }
224        addr++;        addr++;
225      }      }
226    res = xstrndup (addrStart, addr - addrStart);    addrEnd = addr;
227    
228    if (*addr != '\0')    /* ignore any ending white space */
229      while (addr >= addrStart && isspace(*(addr-sizeof(*addr))))
230      {      {
231        addr++;        addr--;
     }  
   else  
     {  
       addr = NULL;  
232      }      }
233    *addrPtr = addr;  
234      res = xstrndup (addrStart, addr - addrStart);
235    
236      *addrPtr = (*addrEnd == '\0') ? NULL : addrEnd+1;
237    return res;    return res;
238  }  }
239    
# Line 234  get_responsible_addr (const DatabaseInfo Line 246  get_responsible_addr (const DatabaseInfo
246    
247    while (c != NULL)    while (c != NULL)
248      {      {
249          char *respaddr;
250        char *addr = getOneAddress (&c);        char *addr = getOneAddress (&c);
251        char *respaddr = get_one_responsible_addr (database, full, strict, addr);        if (addr == NULL || *addr == NULL)
252            {
253              break;
254            }
255          respaddr = get_one_responsible_addr (database, full, strict, addr);
256    
257        if (respaddr != NULL)        if (respaddr != NULL)
258          {          {
259            if (res != NULL)            if (res != NULL)
260              {              {
261                append_string (&res, ", ");                append_string (&res, ",");
262              }              }
263            append_string (&res, respaddr);            append_string (&res, respaddr);
264            free (respaddr);            free (respaddr);

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26