Mercurial > masqmail
diff src/libident/support.c @ 10:26e34ae9a3e3
changed indention and line wrapping to a more consistent style
author | meillo@marmaro.de |
---|---|
date | Mon, 27 Oct 2008 16:23:10 +0100 |
parents | 08114f7dcc23 |
children |
line wrap: on
line diff
--- a/src/libident/support.c Mon Oct 27 16:21:27 2008 +0100 +++ b/src/libident/support.c Mon Oct 27 16:23:10 2008 +0100 @@ -18,69 +18,66 @@ #include "ident.h" -char *id_strdup __P1(char *, str) +char* +id_strdup __P1(char *, str) { - char *cp; + char *cp; - cp = (char *) malloc(strlen(str)+1); - if (cp == NULL) - { + cp = (char *) malloc(strlen(str) + 1); + if (cp == NULL) { #ifdef DEBUG - perror("libident: malloc"); + perror("libident: malloc"); #endif - return NULL; - } + return NULL; + } - strcpy(cp, str); + strcpy(cp, str); - return cp; + return cp; } -char *id_strtok __P3(char *, cp, - char *, cs, - char *, dc) +char* +id_strtok __P3(char *, cp, char *, cs, char *, dc) { - static char *bp = 0; - - if (cp) - bp = cp; - - /* - ** No delimitor cs - return whole buffer and point at end - */ - if (!cs) - { - while (*bp) - bp++; - return cs; - } - - /* - ** Skip leading spaces - */ - while (isspace(*bp)) + static char *bp = 0; + + if (cp) + bp = cp; + + /* + ** No delimitor cs - return whole buffer and point at end + */ + if (!cs) { + while (*bp) + bp++; + return cs; + } + + /* + ** Skip leading spaces + */ + while (isspace(*bp)) + bp++; + + /* + ** No token found? + */ + if (!*bp) + return 0; + + cp = bp; + while (*bp && !strchr(cs, *bp)) + bp++; + + /* + ** Remove trailing spaces + */ + *dc = *bp; + for (dc = bp - 1; dc > cp && isspace(*dc); dc--); + *++dc = '\0'; + bp++; - - /* - ** No token found? - */ - if (!*bp) - return 0; - - cp = bp; - while (*bp && !strchr(cs, *bp)) - bp++; - - /* - ** Remove trailing spaces - */ - *dc = *bp; - for (dc = bp-1; dc > cp && isspace(*dc); dc--) - ; - *++dc = '\0'; - - bp++; - - return cp; + + return cp; }