GETPROGNAME(3C) | Standard C Library Functions | GETPROGNAME(3C) |
getprogname
,
setprogname
— get or set the
program name
#include
<stdlib.h>
const char *
getprogname
(void);
void
setprogname
(const char
*progname);
The
getprogname
()
function is used to obtain the program name. The program name is set at
program start-up, before
main
()
is called. Note, other operating systems, do not guarantee that a program
name has been set at start up time and therefore may return a null pointer
if setprogname
() has not been called.
The
setprogname
()
function is used to change the program name to another value. The argument
progname must contain a null terminated character
string, whose last component which will become the new program name.
The getprogname
() function always returns
the current program name. The program name is always set, it will not return
a null pointer.
getprogname
() is
MT-Safe.
setprogname
()
is
Unsafe.
The use of setprogname
() does not modify
the program name as reported by utilities like
ps(1) or
pargs(1); however, it does ensure a
consistent program name for the err(3C)
family of functions.
November 26, 2017 | OmniOS |