mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-11-23 22:22:07 +03:00
Apparently overwrite should report success
This commit is contained in:
parent
24715a8fd0
commit
2e8f618f00
@ -76,7 +76,7 @@ void win32_sleep(int ms) {
|
||||
|
||||
int win32_modenv(const char* name, const char* value, int overwrite) {
|
||||
char buffer[2000];
|
||||
if (!overwrite && getenv(name)) return -1;
|
||||
if (!overwrite && getenv(name)) return 0;
|
||||
if (strlen(name) + strlen(value) > 1998) return -1;
|
||||
sprintf(buffer, "%s=%s", name, value);
|
||||
return putenv(buffer);
|
||||
|
@ -11,8 +11,14 @@ main = do
|
||||
putStrLn str
|
||||
ok <- setEnv "HELLO" "HO" False
|
||||
printLn ok
|
||||
Just str <- getEnv "HELLO"
|
||||
| Nothing => pure ()
|
||||
putStrLn str
|
||||
ok <- setEnv "HELLO" "EH" True
|
||||
printLn ok
|
||||
Just str <- getEnv "HELLO"
|
||||
| Nothing => pure ()
|
||||
putStrLn str
|
||||
ok <- unsetEnv "HELLO"
|
||||
printLn ok
|
||||
Just str <- getEnv "HELLO"
|
||||
|
@ -1,7 +1,9 @@
|
||||
True
|
||||
HI
|
||||
False
|
||||
True
|
||||
HI
|
||||
True
|
||||
EH
|
||||
True
|
||||
Nothing there
|
||||
1/1: Building Envy (Envy.idr)
|
||||
|
Loading…
Reference in New Issue
Block a user