diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
commit | f8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch) | |
tree | 26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/GuestHost/OpenGL/util/environment.c | |
parent | Initial commit. (diff) | |
download | virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.tar.xz virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.zip |
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/GuestHost/OpenGL/util/environment.c')
-rw-r--r-- | src/VBox/GuestHost/OpenGL/util/environment.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/VBox/GuestHost/OpenGL/util/environment.c b/src/VBox/GuestHost/OpenGL/util/environment.c new file mode 100644 index 00000000..82fd619e --- /dev/null +++ b/src/VBox/GuestHost/OpenGL/util/environment.c @@ -0,0 +1,34 @@ +/* Copyright (c) 2001, Stanford University + * All rights reserved + * + * See the file LICENSE.txt for information on redistributing this software. + */ + +#include "cr_environment.h" +#include "cr_string.h" +#include "cr_mem.h" +#include <stdlib.h> +#include <stdio.h> + +void crSetenv( const char *var, const char *value ) +{ +#if defined(LINUX) || defined(FREEBSD) || defined(DARWIN) + setenv( var, value, 1 /* replace */ ); +#else + unsigned long len; + char *buf; + + len = crStrlen(var) + 1 + crStrlen(value) + 1; + buf = (char *) crAlloc( len ); + sprintf( buf, "%s=%s", var, value ); + putenv( buf ); + + /* don't free the buf, the string is *part* of the environment, + * and can't be reclaimed */ +#endif +} + +const char *crGetenv( const char *var ) +{ + return getenv( var ); +} |