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
nameargument 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,
-1shall be returned,errnoset 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β thenameargument points to an empty string, or points to a string containing an'='character. yeah. empty name or equals sign = instantEINVAL. 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>
π COPYRIGHT π
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 ππ¦πΈ
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms