annotate lib/progname.h @ 6829:19c37b3f23b1

Add read-file module.
author Simon Josefsson <simon@josefsson.org>
date Fri, 16 Jun 2006 19:40:12 +0000
parents a48fb0e98c8c
children 4aea3bda39c7
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.
5105
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
2 Copyright (C) 2001-2004 Free Software Foundation, Inc.
4603
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,
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 5140
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4603
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
4605
c9a4a6444f3a Tweak comments.
Bruno Haible <bruno@clisp.org>
parents: 4603
diff changeset
22 /* Programs using this file should do the following in main():
4603
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 set_program_name (argv[0]);
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 */
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25
5105
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
26
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
27 #ifdef __cplusplus
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
28 extern "C" {
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
29 #endif
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
30
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
31
4603
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
5105
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
54
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
55 #ifdef __cplusplus
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
56 }
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
57 #endif
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
58
d088e155d8f6 Add extern "C" for C++.
Bruno Haible <bruno@clisp.org>
parents: 4605
diff changeset
59
4603
fae2e3155b7a New module 'progname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
60 #endif /* _PROGNAME_H */