env_unix.mx raw

   1  //go:build linux || darwin || wasip1
   2  
   3  package runtime
   4  
   5  // int setenv(const char *name, const char *val, int replace);
   6  //
   7  //export setenv
   8  func libc_setenv(name *byte, val *byte, replace int32) int32
   9  
  10  // int unsetenv(const char *name);
  11  //
  12  //export unsetenv
  13  func libc_unsetenv(name *byte) int32
  14  
  15  func setenv(key, val *byte) {
  16  	// ignore any errors
  17  	libc_setenv(key, val, 1)
  18  }
  19  
  20  func unsetenv(key *byte) {
  21  	// ignore any errors
  22  	libc_unsetenv(key)
  23  }
  24