9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / getprogname.3c
blobdf83b3d2ae1613deb81f616a74e5b6c8006f53be
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 "Nov 26, 2017"
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
32 The
33 .Fn getprogname
34 function is used to obtain the program name.
35 The program name is set at program start-up, before
36 .Fn main
37 is called.
38 Note, other operating systems, do not guarantee that a program name has been set
39 at start up time and therefore may return a null pointer if
40 .Fn setprogname
41 has not been called.
42 .Lp
43 The
44 .Fn setprogname
45 function is used to change the program name to another value.
46 The argument
47 .Fa progname
48 must contain a null terminated character string, whose last component
49 which will become the new program name.
50 .Sh RETURN VALUES
51 The
52 .Fn getprogname
53 function always returns the current program name.
54 The program name is always set, it will not return a null pointer.
55 .Sh INTERFACE STABILITY
56 .Sy Committed
57 .Sh MT-LEVEL
58 .Fn getprogname
60 .Sy MT-Safe .
61 .Lp
62 .Fn setprogname
64 .Sy Unsafe .
65 .Sh SEE ALSO
66 .Xr err 3c ,
67 .Xr attributes 5
68 .Sh NOTES
69 The use of
70 .Fn setprogname
71 does not modify the program name as reported by utilities like
72 .Xr ps 1
74 .Xr pargs 1 ;
75 however, it does ensure a consistent program name for the
76 .Xr err 3C
77 family of functions.