man pages section 3: Basic Library Functions

Exit Print View

Updated: July 2014
 
 

setprogname(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 returns the name of the program. If the name has not yet been set, it returns NULL.

The setprogname() function sets the name of the program to be the last component of the progname argument. Since a pointer to the given string is kept as the program name, it should not be modified for the duration of the program.

These functions are used by error-reporting routines to produce consistent output.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See Also

err(3C), attributes(5)