setprogname man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

GETPROGNAME(3)		 BSD Library Functions Manual		GETPROGNAME(3)

NAME
     getprogname, setprogname — get/set the name of the current program

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <stdlib.h>

     const char *
     getprogname(void);

     void
     setprogname(const char *name);

DESCRIPTION
     These utility functions get and set the current program's name as used by
     various error-reporting functions.

     getprogname() returns the name of the current program.  This function is
     typically useful when generating error messages or other diagnostic out‐
     put.  If the program name has not been set, getprogname() will return
     NULL.

     setprogname() sets the name of the current program to be the last path‐
     name component of the name argument.  It should be invoked at the start
     of the program, using the argv[0] passed into the program's main() func‐
     tion.  A pointer into the string pointed to by the name argument is kept
     as the program name.  Therefore, the string pointed to by name should not
     be modified during the rest of the program's operation.

     A program's name can only be set once, and in NetBSD that is actually
     done by program start-up code that is run before main() is called.
     Therefore, in NetBSD, calling setprogname() explicitly has no effect.
     However, portable programs that wish to use getprogname() should call
     setprogname() from main().	 On operating systems where getprogname() and
     setprogname() are implemented via a portability library, this call is
     needed to make the name available.

SEE ALSO
     err(3), setproctitle(3)

HISTORY
     The getprogname and setprogname function calls appeared in NetBSD 1.6.

RESTRICTIONS
     The string returned by getprogname() is supplied by the invoking process
     and should not be trusted by setuid or setgid programs.

BSD				 May 21, 2011				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net