/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1987 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
/* LINTLIBRARY */
/* putenv - change environment variables
*
* input - char *change = a pointer to a string of the form
* "name=value"
*
* output - 0, if successful
* 1, otherwise
*/
#include <stdio.h>
#include <stdlib.h>
extern char **environ; /* pointer to enviroment */
more than once */
static int find(char *);
static int match(char *, char *);
int
{
/* if a new variable */
/* which is negative of table size, so invert and
count new element */
if (reall) {
/* we have expanded environ before */
which*sizeof(char *));
/* now that we have space, change environ */
} else {
/* environ points to the original space */
reall++;
(int)(which*sizeof(char *)));
}
} else {
/* we are replacing an old variable */
}
return (0);
}
/* find - find where s2 is in environ
*
* input - str = string of form name=value
*
* output - index of name in environ that matches "name"
* -size of table, if none exists
*/
static int
{
return (ct);
ct++;
}
return (-(++ct));
}
/*
* s1 is either name, or name=value
* s2 is name=value
* if names match, return value of 1,
* else return 0
*/
static int
{
if (*s1 == '=')
return (1);
s1++;
}
return (0);
}