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