00001 /* 00002 00003 Copyright (C) 1999-2001, Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any 00012 license provided herein, whether implied or otherwise, is limited to 00013 this program in accordance with the express provisions of the 00014 GNU Lesser General Public License. 00015 00016 Patent licenses, if any, provided herein do not apply to combinations 00017 of this program with other product or programs, or any other product 00018 whatsoever. This program is distributed without any warranty that the 00019 program is delivered free of the rightful claim of any third person by 00020 way of infringement or the like. 00021 00022 See the GNU Lesser General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 */ 00029 00030 #include <sys/types.h> 00031 #if defined(BUILD_OS_DARWIN) 00032 #include <stdlib.h> 00033 #else /* defined(BUILD_OS_DARWIN) */ 00034 #include <malloc.h> 00035 #endif /* defined(BUILD_OS_DARWIN) */ 00036 #include <stdlib.h> 00037 #include <string.h> 00038 00039 extern int 00040 putenv_ (char *fchar, int len) 00041 { 00042 char *envstr; 00043 /* truncating unused blanks at end of character buffer */ 00044 for (--len;fchar[len]==' ';len--) 00045 ; 00046 if (!(envstr = (char *) malloc((size_t)(++len)+1))) 00047 return(-1); 00048 strncpy( envstr, fchar, len ); 00049 envstr[len] = '\0'; 00050 return( putenv(envstr) ); 00051 }
1.5.6