masqmail-0.2

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 diff
     1.1 --- a/src/libident/support.c	Mon Oct 27 16:21:27 2008 +0100
     1.2 +++ b/src/libident/support.c	Mon Oct 27 16:23:10 2008 +0100
     1.3 @@ -18,69 +18,66 @@
     1.4  #include "ident.h"
     1.5  
     1.6  
     1.7 -char *id_strdup __P1(char *, str)
     1.8 +char*
     1.9 +id_strdup __P1(char *, str)
    1.10  {
    1.11 -    char *cp;
    1.12 +	char *cp;
    1.13  
    1.14 -    cp = (char *) malloc(strlen(str)+1);
    1.15 -    if (cp == NULL)
    1.16 -    {
    1.17 +	cp = (char *) malloc(strlen(str) + 1);
    1.18 +	if (cp == NULL) {
    1.19  #ifdef DEBUG
    1.20 -	perror("libident: malloc");
    1.21 +		perror("libident: malloc");
    1.22  #endif
    1.23 -        return NULL;
    1.24 -    }
    1.25 +		return NULL;
    1.26 +	}
    1.27  
    1.28 -    strcpy(cp, str);
    1.29 +	strcpy(cp, str);
    1.30  
    1.31 -    return cp;
    1.32 +	return cp;
    1.33  }
    1.34  
    1.35  
    1.36 -char *id_strtok __P3(char *, cp,
    1.37 -		      char *, cs,
    1.38 -		      char *, dc)
    1.39 +char*
    1.40 +id_strtok __P3(char *, cp, char *, cs, char *, dc)
    1.41  {
    1.42 -    static char *bp = 0;
    1.43 -    
    1.44 -    if (cp)
    1.45 -	bp = cp;
    1.46 -    
    1.47 -    /*
    1.48 -    ** No delimitor cs - return whole buffer and point at end
    1.49 -    */
    1.50 -    if (!cs)
    1.51 -    {
    1.52 -	while (*bp)
    1.53 -	    bp++;
    1.54 -	return cs;
    1.55 -    }
    1.56 -    
    1.57 -    /*
    1.58 -    ** Skip leading spaces
    1.59 -    */
    1.60 -    while (isspace(*bp))
    1.61 +	static char *bp = 0;
    1.62 +
    1.63 +	if (cp)
    1.64 +		bp = cp;
    1.65 +
    1.66 +	/*
    1.67 +	 ** No delimitor cs - return whole buffer and point at end
    1.68 +	 */
    1.69 +	if (!cs) {
    1.70 +		while (*bp)
    1.71 +			bp++;
    1.72 +		return cs;
    1.73 +	}
    1.74 +
    1.75 +	/*
    1.76 +	 ** Skip leading spaces
    1.77 +	 */
    1.78 +	while (isspace(*bp))
    1.79 +		bp++;
    1.80 +
    1.81 +	/*
    1.82 +	 ** No token found?
    1.83 +	 */
    1.84 +	if (!*bp)
    1.85 +		return 0;
    1.86 +
    1.87 +	cp = bp;
    1.88 +	while (*bp && !strchr(cs, *bp))
    1.89 +		bp++;
    1.90 +
    1.91 +	/*
    1.92 +	 ** Remove trailing spaces
    1.93 +	 */
    1.94 +	*dc = *bp;
    1.95 +	for (dc = bp - 1; dc > cp && isspace(*dc); dc--);
    1.96 +	*++dc = '\0';
    1.97 +
    1.98  	bp++;
    1.99 -    
   1.100 -    /*
   1.101 -    ** No token found?
   1.102 -    */
   1.103 -    if (!*bp)
   1.104 -	return 0;
   1.105 -    
   1.106 -    cp = bp;
   1.107 -    while (*bp && !strchr(cs, *bp))
   1.108 -	bp++;
   1.109 -    
   1.110 -    /*
   1.111 -    ** Remove trailing spaces
   1.112 -    */
   1.113 -    *dc = *bp;
   1.114 -    for (dc = bp-1; dc > cp && isspace(*dc); dc--)
   1.115 -	;
   1.116 -    *++dc = '\0';
   1.117 -    
   1.118 -    bp++;
   1.119 -    
   1.120 -    return cp;
   1.121 +
   1.122 +	return cp;
   1.123  }