c-strtof, c-strtod, c-strtold: Make multithread-safe.
[gnulib.git] / doc / progname.texi
blobd76217d744a2d8164e7d8c2b835a656c82f71781
1 @node progname and getprogname
2 @section progname and getprogname
4 @c Copyright (C) 2007, 2009--2024 Free Software Foundation, Inc.
6 @c Permission is granted to copy, distribute and/or modify this document
7 @c under the terms of the GNU Free Documentation License, Version 1.3 or
8 @c any later version published by the Free Software Foundation; with no
9 @c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
10 @c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
12 Gnulib has two modules for retrieving the name of the currently executing
13 program: @code{progname} and @code{getprogname}.
15 @findex progname
16 @vindex program_name
17 The @code{progname} module defines a variable @code{program_name}.
18 It contains the name of the currently executing program, on all platforms.
19 But it cannot be used implicitly:  It requires that every @code{main}
20 function be modified to invoke @code{set_program_name (argv[0])} as one
21 of its first actions.
23 @findex getprogname
24 The @code{getprogname} module defines a function @code{getprogname()}.
25 It returns the name of the currently executing program, on most platforms.
26 The advantage of this module is that it can be used without prior
27 initializations.  But it has limitations:  In some rare situations, it
28 cannot determine the name; then it returns @code{"?"} instead.  And on
29 some platforms, it returns a truncated program name.
31 @findex error
32 The @code{error} function uses the @code{getprogname} module.