mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
os: implement and smoketest os.Unsetenv
This commit is contained in:
@@ -142,6 +142,15 @@ func Setenv(key, val string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Unsetenv(key string) (err error) {
|
||||
keydata := cstring(key)
|
||||
errCode := libc_unsetenv(&keydata[0])
|
||||
if errCode != 0 {
|
||||
err = getErrno()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||
addr := libc_mmap(nil, uintptr(length), int32(prot), int32(flags), int32(fd), uintptr(offset))
|
||||
if addr == unsafe.Pointer(^uintptr(0)) {
|
||||
@@ -206,6 +215,10 @@ func libc_getenv(name *byte) *byte
|
||||
//export setenv
|
||||
func libc_setenv(name *byte, val *byte, replace int32) int32
|
||||
|
||||
// int unsetenv(const char *name);
|
||||
//export unsetenv
|
||||
func libc_unsetenv(name *byte) int32
|
||||
|
||||
// ssize_t read(int fd, void *buf, size_t count);
|
||||
//export read
|
||||
func libc_read(fd int32, buf *byte, count uint) int
|
||||
|
||||
@@ -72,6 +72,11 @@ func Setenv(key, val string) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
func Unsetenv(key string) (err error) {
|
||||
// stub for now
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
func Environ() []string {
|
||||
env := runtime_envs()
|
||||
envCopy := make([]string, len(env))
|
||||
|
||||
Reference in New Issue
Block a user