VirtualBox

source: vbox/trunk/src/VBox/GuestHost/OpenGL/util/environment.c@ 42499

Last change on this file since 42499 was 15532, checked in by vboxsync, 16 years ago

crOpenGL: export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 760 bytes
Line 
1/* Copyright (c) 2001, Stanford University
2 * All rights reserved
3 *
4 * See the file LICENSE.txt for information on redistributing this software.
5 */
6
7#include "cr_environment.h"
8#include "cr_string.h"
9#include "cr_mem.h"
10#include <stdlib.h>
11#include <stdio.h>
12
13void crSetenv( const char *var, const char *value )
14{
15#if defined(LINUX) || defined(FREEBSD) || defined(DARWIN)
16 setenv( var, value, 1 /* replace */ );
17#else
18 unsigned long len;
19 char *buf;
20
21 len = crStrlen(var) + 1 + crStrlen(value) + 1;
22 buf = (char *) crAlloc( len );
23 sprintf( buf, "%s=%s", var, value );
24 putenv( buf );
25
26 /* don't free the buf, the string is *part* of the environment,
27 * and can't be reclaimed */
28#endif
29}
30
31const char *crGetenv( const char *var )
32{
33 return getenv( var );
34}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette