From f8fe689a81f906d1b91bb3220acde2a4ecb14c5b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 05:01:46 +0200 Subject: Adding upstream version 6.0.4-dfsg. Signed-off-by: Daniel Baumann --- src/VBox/GuestHost/OpenGL/util/environment.c | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/VBox/GuestHost/OpenGL/util/environment.c (limited to 'src/VBox/GuestHost/OpenGL/util/environment.c') 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 +#include + +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 ); +} -- cgit v1.2.3