MirBSD manpage: getprogname(3), setprogname(3)

GETPROGNAME(3)             BSD Programmer's Manual              GETPROGNAME(3)

NAME

     getprogname, setprogname - get/set the name of the current program

SYNOPSIS

     #include <stdlib.h>

     const char *
     getprogname(void);

     void
     setprogname(const char *name);

DESCRIPTION

     These utility functions get and set the current program's name as used by
     various error-reporting functions.

     getprogname() returns the name of the current program. This function is
     typically useful when generating error messages or other diagnostic out-
     put.

     The setprogname() function sets the name of the program to be the last
     path component of the name argument. Internally, only the pointer to the
     given string is kept as the program name, so it should not be modified
     and the storage for the string must remain valid for the rest of the
     program's lifetime.

SEE ALSO

     err(3), setproctitle(3)

HISTORY

     The getprogname() and setprogname() functions first appeared in
     OpenBSD 5.4 as function-based wrappers around the 4.4BSD __progname in-
     terface.

CAVEATS

     The string returned by getprogname() is supplied by the invoking process
     and should not be trusted by setuid or setgid programs.

MirBSD #10-current            September 21, 2021                             1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung