1explain_program_name(3) Library Functions Manual explain_program_name(3)
2
3
4
6 explain_program_name - manipulate the program name
7
9 #include <libexplain/libexplain.h>
10 const char *explain_program_name_get(void);
11 void explain_program_name_set(const char *name);
12 void explain_program_name_assemble(int yesno);
13
15 These functions may be used to manipulate libexplain's idea of the com‐
16 mand name of the current process, and whether or not that name is
17 included in error messages.
18
19 explain_program_name_get
20 const char *explain_program_name_get(void);
21
22 The explain_program_name_get function may be used to obtain the command
23 name of the calling process. Depending on how capable /proc is on your
24 system, or, failing that, how capable lsof(1) is on your system, this
25 may or may not produce a sensible result. It works well on Linux.
26
27 Returns:
28 pointer to string containing the command name (no slashes) of
29 the calling process.
30
31 explain_program_name_set
32 void explain_program_name_set(const char *name);
33
34 The explain_program_name_set function may be used to set the libexplain
35 libraries' idea of the command name of the calling process, setting the
36 string to be returned by the explain_program_name_get(3) function.
37 This overrides the automatic behavior, which can be quite desirable in
38 commands that can be invoked with more than one name, e.g. if they are
39 a hard link synonym.
40
41 This also sets the option to include the program name in all of the
42 error messages issued by the explain_*_or_die(3) functions.
43
44 name The name of the calling process. Only the basename will be
45 used if a path containing slashes is given.
46
47 explain_program_name_assemble
48 void explain_program_name_assemble(int yesno);
49
50 The explain_program_name_assemble function is used to control whether
51 or not the name of the calling process is to be included in error mes‐
52 sages issued by the explain_*_or_die(3) functions. If not explicitly
53 set, is controlled by the EXPLAIN_OPTIONS environment variable, or
54 defaults to true if not set there either.
55
56 yesno non‐zero (true) to have program name included, zero (false) to
57 have program name excluded.
58
60 libexplain version 0.40
61 Copyright (C) 2008 Peter Miller
62
64 Written by Peter Miller <pmiller@opensource.org.au>
65
66
67
68 explain_program_name(3)