xref: /titanic_50/usr/src/man/man3c/getprogname.3c (revision dc32d872cbeb56532bcea030255db9cd79bac7da)
1.\"
2.\" This file and its contents are supplied under the terms of the
3.\" Common Development and Distribution License ("CDDL"), version 1.0.
4.\" You may only use this file in accordance with the terms of version
5.\" 1.0 of the CDDL.
6.\"
7.\" A full copy of the text of the CDDL should have accompanied this
8.\" source.  A copy of the CDDL is also available via the Internet at
9.\" http://www.illumos.org/license/CDDL.
10.\"
11.\"
12.\" Copyright (c) 2014, Joyent, Inc.
13.\"
14.Dd "Dec 22, 2014"
15.Dt GETPROGNAME 3C
16.Os
17.Sh NAME
18.Nm getprogname ,
19.Nm setprogname
20.Nd get or set the program name
21.Sh SYNOPSIS
22.In stdlib.h
23.Ft const char *
24.Fo getprogname
25.Fa void
26.Fc
27.Ft void
28.Fo setprogname
29.Fa "const char *progname"
30.Fc
31.Sh DESCRIPTION
32The
33.Fn getprogname
34function is used to obtain the program name. The program name is set at
35program start-up, before
36.Fn main
37is called. Note, other operating systems, do not guarantee that a
38program name has been set at start up time and therefore may return a
39null pointer if
40.Fn setprogname
41has not been called.
42.Lp
43The
44.Fn setprogname
45function is used to change the program name to another value. The
46argument
47.Fa progname
48must contain a null terminatd character string, whose last component
49which will become the new program name.
50.Sh RETURN VALUES
51The
52.Fn getprogname
53function always returns the current program name. The program name is
54always set, it will not return a null pointer.
55.Sh INTERFACE STABILITY
56.Sy Committed
57.Sh MT-LEVEL
58.Fn getprogname
59is
60.Sy MT-Safe .
61.Lp
62.Fn setprogname
63is
64.Sy Unsafe .
65.Sh SEE ALSO
66.Xr err 3c ,
67.Xr attributes 5
68.Sh NOTES
69The use of
70.Fn setprogname
71does not modify the program name as reported by utilities like
72.Xr ps 1
73or
74.Xr pargs 1 ;
75however, it does ensure a consistent program name for the
76.Xr err 3C
77family of functions.
78