1
0
forked from mirrors/0ad
Files
0ad/source/lib/sysdep/os/win/wposix/wposix.cpp
T
janwas 3ff0ccc1fa we noticed that vcbuild somehow excludes winit function pointers from components that don't contain externals referenced by the main EXE (i.e. wposix, wnuma, wsock). the solution will include calling enet_initialize (to replace or coexist with wsock), removing wposix (see below) and ignoring wnuma (because apps that use it will need to call its functions).
wposix's sysconf is no longer used because OS X doesn't support some of
the POSIX names, so we had to add os_cpu routines that supplant the use
of sysconf. am now removing the no-longer needed sysconf emulation,
which also gets rid of wposix_Init.

This was SVN commit r7680.
2010-07-03 19:08:18 +00:00

47 lines
1.5 KiB
C++

/* Copyright (c) 2010 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* emulate a subset of POSIX on Win32.
*/
#include "precompiled.h"
#include "lib/sysdep/os/win/wposix/wposix.h"
#include "lib/sysdep/os/win/wposix/wposix_internal.h"
#include "lib/bits.h"
int setenv(const char* envname, const char* envval, int overwrite)
{
if(!envname || envname[0] == '\0' || strchr(envname, '='))
{
errno = EINVAL;
return -1;
}
if(overwrite || !getenv(envname))
SetEnvironmentVariableA(envname, envval);
return 0;
}