/[winpt]/trunk/Src/wptUtil.cpp
ViewVC logotype

Diff of /trunk/Src/wptUtil.cpp

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

revision 189 by twoaday, Wed Nov 2 14:35:48 2005 UTC revision 190 by twoaday, Mon Mar 27 10:05:14 2006 UTC
# Line 17  Line 17 
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19   */   */
20    
21  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
22  #include <config.h>  #include <config.h>
23  #endif  #endif
24    
25  #include <string.h>  #include <string.h>
 #include <string.h>  
26  #include <stdio.h>  #include <stdio.h>
27  #include <ctype.h>  #include <ctype.h>
28    
29  /* code taken from glibc-2.2.1/sysdeps/generic/strsep.c */  /* code taken from glibc-2.2.1/sysdeps/generic/strsep.c */
30  extern "C" char*  char*
31  strsep (char **stringp, const char *delim)  strsep (char **stringp, const char *delim)
32  {  {
33      char *begin, *end;      char *begin, *end;
# Line 68  strsep (char **stringp, const char *deli Line 68  strsep (char **stringp, const char *deli
68    
69    
70  /* Like strstr but this version is case in-sentensive. */  /* Like strstr but this version is case in-sentensive. */
71  extern "C" const char *  const char *
72  stristr (const char *buf, const char *sub)  stristr (const char *buf, const char *sub)
73  {  {
74      const char *t, *s ;      const char *t, *s ;
# Line 88  stristr (const char *buf, const char *su Line 88  stristr (const char *buf, const char *su
88      return NULL ;      return NULL ;
89  }  }
90    
91    
92    /* Check if the email address @email only contain valid characters.
93       Return 0 on success. */
94    int
95    check_email_address (const char *email)
96    {
97        const char *allowed = "@._-%+";
98        size_t i;
99    
100        if (!strchr (email, '@'))
101            return -1;
102        for (i=0; i < strlen (email); i++) {
103            if (isdigit (email[i]) || isalpha (email[i])
104                || strchr (allowed, email[i]))
105                continue;
106            else
107                return -1;
108        }
109        return 0;
110    }

Legend:
Removed from v.189  
changed lines
  Added in v.190

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26