mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Add MODE=optlinux build mode (#141)
This commit is contained in:
parent
226aaf3547
commit
67b5200a0b
111 changed files with 934 additions and 854 deletions
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/alg/alg.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/mem/internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
@ -25,6 +26,8 @@
|
|||
|
||||
#define MAX_VARS 512
|
||||
|
||||
#define ToUpper(c) ((c) >= 'a' && (c) <= 'z' ? (c) - 'a' + 'A' : (c))
|
||||
|
||||
static bool once;
|
||||
|
||||
static void PutEnvDestroy(void) {
|
||||
|
@ -56,8 +59,12 @@ int PutEnvImpl(char *s, bool overwrite) {
|
|||
PutEnvInit();
|
||||
once = true;
|
||||
}
|
||||
p = strchr(s, '=');
|
||||
if (!p) goto fail;
|
||||
for (p = s; *p && *p != '='; ++p) {
|
||||
if (IsWindows()) {
|
||||
*p = ToUpper(*p);
|
||||
}
|
||||
}
|
||||
if (*p != '=') goto fail;
|
||||
namelen = p + 1 - s;
|
||||
for (i = 0; environ[i]; ++i) {
|
||||
if (!strncmp(environ[i], s, namelen)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue