UNSETENV(3POSIX)

πŸ’– UNSETENV β€” POSIX Programmer's Manual, bestie edition πŸ’–

okay so. this page lives in the POSIX Programmer's Manual, section 3POSIX, and it's all about unsetenv(3POSIX). yes the whole manpage is literally named after the function, iconic behaviour honestly.


🌸 PROLOG 🌸

real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β€” so like, consult the corresponding Linux manual page for the deets on Linux behaviour. OR the interface may not be implemented on Linux at all. so don't come for me if it's giving ✨nothing✨ on your box. πŸ’€


πŸ‘‘ NAME πŸ‘‘

unsetenv β€” remove an environment variable. that's it. that's the whole job. she's a deleter, a lil environment variable eraser. 🧹✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <stdlib.h>

int unsetenv(const char *name);

πŸ’… DESCRIPTION πŸ’…

okay so unsetenv() shall remove an environment variable from the environment of the calling process. slay.

  • the name argument points to a string, which is the name of the variable to be removed.
  • the named argument shall not contain an '=' character. like, that's the rule. no equals signs allowed, periodt.
  • if the named variable does not exist in the current environment, the environment shall be unchanged and the function is considered to have completed successfully. so no drama, no error, just vibes. 🫢

unsetenv() shall update the list of pointers to which environ points.

⚠️ unsetenv() need not be thread-safe. so if you're out here threading, be careful, bestie. she's not built for that chaos. 😭

πŸ”₯ RETURN VALUE πŸ”₯

  • upon successful completion, zero shall be returned. πŸŽ€
  • otherwise, -1 shall be returned, errno set to indicate the error, and the environment shall be unchanged. no half-deletes, no mess, she either does it or she doesn't.

πŸ’€ ERRORS πŸ’€

unsetenv() shall fail if:

  • EINVAL β€” the name argument points to an empty string, or points to a string containing an '=' character. yeah. empty name or equals sign = instant EINVAL. she said no. πŸ™ˆ

the following sections are informative. (translation: the juicy mandatory bits are done, everything below is ✨lore✨)


🌈 EXAMPLES 🌈

None. literally nothing. the examples section said "no thoughts, head empty". 😭


πŸ’œ APPLICATION USAGE πŸ’œ

None. also nothing. we're thriving on minimalism here. ✨


🧚 RATIONALE 🧚

refer to the RATIONALE section in setenv(). that's where the reasoning lives, iykyk. go read that one, bestie. πŸ“–


⭐ FUTURE DIRECTIONS ⭐

None. the future is unspecified and honestly? she's at peace with that. πŸ•ŠοΈ


🌸 SEE ALSO 🌸

  • getenv()
  • setenv()

also, from the Base Definitions volume of POSIX.1‐2017:

  • <stdlib.h>
  • <sys_types.h>

portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.

in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. (she's the final boss, no cap. πŸ‘‘)

the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


sign-off time ✨ this lil masterpiece was brought to you by IEEE/The Open Group, dated 2017, filed under UNSETENV(3POSIX). bye bestie, go unset some variables responsibly πŸ’–πŸ¦‹πŸŒΈ