GETPROGNAME(3C) Standard C Library Functions GETPROGNAME(3C)

NAME


getprogname, setprogname - get or set the program name

SYNOPSIS


#include <stdlib.h>

const char *
getprogname(void);

void
setprogname(const char *progname);

DESCRIPTION


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.

RETURN VALUES


The getprogname() function always returns the current program name.
The program name is always set, it will not return a null pointer.

INTERFACE STABILITY


Committed

MT-LEVEL
getprogname() is MT-Safe.

setprogname() is Unsafe.

SEE ALSO


err(3c), attributes(7)

NOTES


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.

illumos November 26, 2017 illumos

tribblix@gmail.com :: GitHub :: Privacy