Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167581262
D27204.id79501.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1021 B
Referenced Files
None
Subscribers
None
D27204.id79501.diff
View Options
Index: lib/libc/gen/getprogname.3
===================================================================
--- lib/libc/gen/getprogname.3
+++ lib/libc/gen/getprogname.3
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 1, 2001
+.Dd November 13, 2020
.Dt GETPROGNAME 3
.Os
.Sh NAME
@@ -84,6 +84,30 @@
.Fn setprogname
allows the aforementioned library to learn the program name without
modifications to the start-up code.
+.Sh EXAMPLES
+The following example presents a simple program, which presents the difference
+between
+.Fn getprogname
+and
+.Va "argv[0]" .
+.Bd -literal -offset indent
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+ printf("getprogname(): %s\en", getprogname());
+ printf("argv[0]: %s\en", argv[0]);
+ return (0);
+}
+.Ed
+.Pp
+When compiled into and executed (e.g., with
+.Ql ./a.out )
+the output of the program is going to look like this:
+.Bd -literal -offset indent
+getprogname(): a.out
+argv[0]: ./a.out
+.Ed
.Sh SEE ALSO
.Xr err 3 ,
.Xr setproctitle 3
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 23, 8:53 PM (7 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37160778
Default Alt Text
D27204.id79501.diff (1021 B)
Attached To
Mode
D27204: getprogname.3: Show difference between getprogname() and argv[0] in an example
Attached
Detach File
Event Timeline
Log In to Comment