|
Packit |
33f14e |
/* Program name management.
|
|
Packit |
33f14e |
Copyright (C) 2001-2004, 2006, 2009-2017 Free Software Foundation, Inc.
|
|
Packit |
33f14e |
Written by Bruno Haible <bruno@clisp.org>, 2001.
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
This program is free software: you can redistribute it and/or modify
|
|
Packit |
33f14e |
it under the terms of the GNU General Public License as published by
|
|
Packit |
33f14e |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit |
33f14e |
(at your option) any later version.
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
This program is distributed in the hope that it will be useful,
|
|
Packit |
33f14e |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
33f14e |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
33f14e |
GNU General Public License for more details.
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
You should have received a copy of the GNU General Public License
|
|
Packit |
33f14e |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#ifndef _PROGNAME_H
|
|
Packit |
33f14e |
#define _PROGNAME_H
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
/* Programs using this file should do the following in main():
|
|
Packit |
33f14e |
set_program_name (argv[0]);
|
|
Packit |
33f14e |
*/
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#ifdef __cplusplus
|
|
Packit |
33f14e |
extern "C" {
|
|
Packit |
33f14e |
#endif
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
/* String containing name the program is called with. */
|
|
Packit |
33f14e |
extern const char *program_name;
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
/* Set program_name, based on argv[0].
|
|
Packit |
33f14e |
argv0 must be a string allocated with indefinite extent, and must not be
|
|
Packit |
33f14e |
modified after this call. */
|
|
Packit |
33f14e |
extern void set_program_name (const char *argv0);
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#if ENABLE_RELOCATABLE
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
/* Set program_name, based on argv[0], and original installation prefix and
|
|
Packit |
33f14e |
directory, for relocatability. */
|
|
Packit |
33f14e |
extern void set_program_name_and_installdir (const char *argv0,
|
|
Packit |
33f14e |
const char *orig_installprefix,
|
|
Packit |
33f14e |
const char *orig_installdir);
|
|
Packit |
33f14e |
#undef set_program_name
|
|
Packit |
33f14e |
#define set_program_name(ARG0) \
|
|
Packit |
33f14e |
set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR)
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
/* Return the full pathname of the current executable, based on the earlier
|
|
Packit |
33f14e |
call to set_program_name_and_installdir. Return NULL if unknown. */
|
|
Packit |
33f14e |
extern char *get_full_program_name (void);
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#endif
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#ifdef __cplusplus
|
|
Packit |
33f14e |
}
|
|
Packit |
33f14e |
#endif
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
|
|
Packit |
33f14e |
#endif /* _PROGNAME_H */
|