NAME
ggeettpprrooggnnaammee, sseettpprrooggnnaammee - get or set the program name
LLIIBBRRAARRYYStandard C Library (libc, -lc)
SYNOPSIS
##iinncclluuddee <
const char * ggeettpprrooggnnaammee(void); void sseettpprrooggnnaammee(const char *progname);> DESCRIPTION
The ggeettpprrooggnnaammee() and sseettpprrooggnnaammee() functions manipulate the name of thecurrent program. They are used by error-reporting routines to produce
consistent output. The ggeettpprrooggnnaammee() function returns the name of the program. If the name has not been set yet, it will return NULL. The sseettpprrooggnnaammee() 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 rest of the program's lifetime.In FreeBSD, the name of the program is set by the start-up code that is
run before mmaaiinn(); thus, running sseettpprrooggnnaammee() is not necessary. Pro-
grams that desire maximum portability should still call it; on another operating system, these functions may be implemented in a portability library. Calling sseettpprrooggnnaammee() allows the aforementioned library tolearn the program name without modifications to the start-up code.
SEE ALSO
err(3) HISTORY These functions first appeared in NetBSD 1.6, and made their way into FreeBSD 4.4. BSD May 1, 2001 BSD