annotate lib/progname.h @ 4603:fae2e3155b7a

New module 'progname'.
author Bruno Haible <bruno@clisp.org>
date Wed, 20 Aug 2003 19:45:05 +0000
parents
children c9a4a6444f3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4603
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Program name management.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2001-2003 Free Software Foundation, Inc.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 any later version.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 GNU General Public License for more details.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #ifndef _PROGNAME_H
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #define _PROGNAME_H
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <stdbool.h>
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 /* This file supports selectively prefixing or nor prefixing error messages
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 with the program name.
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 Programs using this file should do the following in main():
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 set_program_name (argv[0]);
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 error_print_progname = maybe_print_progname;
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 /* String containing name the program is called with. */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 extern const char *program_name;
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 /* Set program_name, based on argv[0]. */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 extern void set_program_name (const char *argv0);
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 #if ENABLE_RELOCATABLE
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 /* Set program_name, based on argv[0], and original installation prefix and
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 directory, for relocatability. */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 extern void set_program_name_and_installdir (const char *argv0,
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 const char *orig_installprefix,
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 const char *orig_installdir);
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 #define set_program_name(ARG0) \
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 /* Return the full pathname of the current executable, based on the earlier
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 call to set_program_name_and_installdir. Return NULL if unknown. */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 extern char *get_full_program_name (void);
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 #endif
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 #endif /* _PROGNAME_H */