*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> getprogname (3)              
Title
Content
Arch
Section
 

GETPROGNAME(3)

Contents


NAME    [Toc]    [Back]

     getprogname, setprogname -- get or set the program name

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <stdlib.h>

     const char *
     getprogname(void);

     void
     setprogname(const char *progname);

DESCRIPTION    [Toc]    [Back]

     The getprogname() and setprogname() functions manipulate the name of the
     current program.  They are used by error-reporting routines to produce
     consistent output.

     The getprogname() function returns the name of the program.  If the name
     has not been set yet, it will return 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 rest of
     the program's lifetime.

     In FreeBSD, the name of the program is set by the start-up code that is
     run before main(); thus, running setprogname() is not necessary.  Programs
 that desire maximum portability should still call it; on another
     operating system, these functions may be implemented in a portability
     library.  Calling setprogname() allows the aforementioned library to
     learn the program name without modifications to the start-up code.

SEE ALSO    [Toc]    [Back]

      
      
     err(3), setproctitle(3)

HISTORY    [Toc]    [Back]

     These functions first appeared in NetBSD 1.6, and made their way into
     FreeBSD 4.4.


FreeBSD 5.2.1			  May 1, 2001			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
setmemwindow HP-UX changes the window id of a running program or starts a program in a particular memory window
units FreeBSD conversion program
setsid Linux run a program in a new session
lint Tru64 a C program checker
lint NetBSD a C program verifier
xrx Tru64 helper program
getprogname NetBSD get/set the name of the current program
setprogname NetBSD get/set the name of the current program
optacon Tru64 An X program for the Optacon II
pppctl OpenBSD PPP control program
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service