Home Man
Today's Posts

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:
Select Section of Man Page:
Select Man Page Repository:

NetBSD 6.1.5 - man page for getprogname (netbsd section 3)

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

     getprogname, setprogname -- get/set the name of the current program

     Standard C Library (libc, -lc)

     #include <stdlib.h>

     const char *

     setprogname(const char *name);

     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 output.  If the program name has not been
     set, getprogname() will return NULL.

     setprogname() sets the name of the current program to be the last pathname 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() function.  A pointer into the string pointed to by the name argu-
     ment 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.

     err(3), setproctitle(3)

     The getprogname and setprogname function calls appeared in NetBSD 1.6.

     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

All times are GMT -4. The time now is 11:08 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
Show Password