]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/radiusclient/lib/env.c
Whitespace tidying.
[ppp.git] / pppd / plugins / radius / radiusclient / lib / env.c
index f3d177be39bc13cd63161362b367310c473b4ec5..5132b1b7fdc19f3a58f91de8bd5de903de8ca798 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * $Id: env.c,v 1.1 2002/01/22 16:03:02 dfs Exp $
+ * $Id: env.c,v 1.2 2002/02/27 15:51:20 dfs Exp $
  *
  * Copyright (C) 1995,1996,1997 Lars Fenneberg
  *
- * See the file COPYRIGHT for the respective terms and conditions. 
- * If the file is missing contact me at lf@elemental.net 
+ * See the file COPYRIGHT for the respective terms and conditions.
+ * If the file is missing contact me at lf@elemental.net
  * and I'll send you a copy.
  *
  */
@@ -19,7 +19,7 @@
  * Purpose: allocate space for a new environment
  *
  */
+
 ENV *rc_new_env(int size)
 {
        ENV *p;
@@ -29,19 +29,19 @@ ENV *rc_new_env(int size)
 
        if ((p = malloc(sizeof(*p))) == NULL)
                return NULL;
-               
+
        if ((p->env = malloc(size * sizeof(char *))) == NULL)
        {
                rc_log(LOG_CRIT, "rc_new_env: out of memory");
                free(p);
                return NULL;
-       } 
+       }
 
        p->env[0] = NULL;
-       
+
        p->size = 0;
-       p->maxsize = size;      
-               
+       p->maxsize = size;
+
        return p;
 }
 
@@ -51,11 +51,11 @@ ENV *rc_new_env(int size)
  * Purpose: free the space used by an env structure
  *
  */
+
 void rc_free_env(ENV *env)
 {
        free(env->env);
-       free(env); 
+       free(env);
 }
 
 /*
@@ -64,7 +64,7 @@ void rc_free_env(ENV *env)
  * Purpose: add an environment entry
  *
  */
+
 int rc_add_env(ENV *env, char *name, char *value)
 {
        int i;
@@ -73,7 +73,7 @@ int rc_add_env(ENV *env, char *name, char *value)
        for (i = 0; env->env[i] != NULL; i++)
        {
                if (strncmp(env->env[i], name, MAX(strchr(env->env[i], '=') - env->env[i],strlen(name))) == 0)
-                       break;  
+                       break;
        }
 
        if (env->env[i])
@@ -89,20 +89,20 @@ int rc_add_env(ENV *env, char *name, char *value)
                        rc_log(LOG_CRIT, "rc_add_env: not enough space for environment (increase ENV_SIZE)");
                        return (-1);
                }
-       
+
                if ((env->env[env->size] = malloc(strlen(name)+strlen(value)+2)) == NULL) {
                        rc_log(LOG_CRIT, "rc_add_env: out of memory");
                        return (-1);
                }
-       
+
                sprintf(env->env[env->size],"%s=%s", name, value);
-       
+
                env->size++;
 
                env->env[env->size] = NULL;
        }
 
-       return 0;               
+       return 0;
 }
 
 /*
@@ -111,21 +111,21 @@ int rc_add_env(ENV *env, char *name, char *value)
  * Purpose: imports an array of null-terminated strings
  *
  */
+
 int rc_import_env(ENV *env, char **import)
 {
        char *es;
-       
+
        while (*import)
        {
                es = strchr(*import, '=');
-               
+
                if (!es)
                {
                        import++;
                        continue;
                }
-               
+
                /* ok, i grant thats not very clean... */
                *es = '\0';
 
@@ -134,11 +134,11 @@ int rc_import_env(ENV *env, char **import)
                        *es = '=';
                        return (-1);
                }
-       
+
                *es = '=';
-       
+
                import++;
        }
-       
+
        return 0;
 }