GETPROGNAME(3) BSD Library Functions Manual GETPROGNAME(3)NAME
getprogname, setprogname -- get or set the program name
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
const char *
getprogname(void);
void
setprogname(const char *progname);
DESCRIPTION
The getprogname() and setprogname() functions manipulate the name of the current program. They are used by error-reporting routines to pro-
duce 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 portabil-
ity library. Calling setprogname() allows the aforementioned library to learn 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
Check Out this Related Man Page
GETPROGNAME(3) BSD Library Functions Manual GETPROGNAME(3)NAME
getprogname, setprogname -- get or set the program name
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
const char *
getprogname(void);
void
setprogname(const char *progname);
DESCRIPTION
The getprogname() and setprogname() functions manipulate the name of the current program. They are used by error-reporting routines to pro-
duce 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 portabil-
ity library. Calling setprogname() allows the aforementioned library to learn 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
Hey all,
I'm writting my first C program (Apart from the little ones I did to learn the program).
What I want for this program to do is ping a range of IP's and then place the reply if alive into a file the compare all in that file to the /etc/hosts file to find the host name.
I know I... (2 Replies)
hello, I finally installed a unix port (NetBSD) on my workpad z50 and now I'm trying to configure it and well right about now I know 2 commands and I can start one program Vi is the program and I can navagate with cd and ls those are the two commands wait I know 3 date I also know but I can't even... (3 Replies)
Hello everyone.
I'm a Chinese student.I want to learn something about OS, someone
suggests me start with FreeBSD or Linux. Please tell me which one is more fit
for new man. Thanks. (4 Replies)
Lets get some stuff out of the way before the question. I am currently running FreeBSD 7.0 on a VirtualBox virtual machine. I do not know much about Unix or FreeBSD, though I do run linux at home. My boss gave me some files that he says are a unix version of the program Dynflow. The Programs... (0 Replies)
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
hi,
I have pro*c program running on sunsolaris 5.9.Currently the same program has been migrated to solaris 5.10.But the program is not giving the desired output.Do i need to recomplie the source code again.
Regards,
Megh (4 Replies)
Hello All,
I am trying to call a function from the calling main program from a dlopened library function, below is the entire code, when I execute it it crashes with sigill. Can you guys help me out I guess I am missing out on the linker flag or something here. besides I am new to AIX and... (1 Reply)