1*63eb84d1Schristos /* Program name management. 2*63eb84d1Schristos Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc. 3*63eb84d1Schristos Written by Bruno Haible <haible@clisp.cons.org>, 2001. 4*63eb84d1Schristos 5*63eb84d1Schristos This program is free software; you can redistribute it and/or modify 6*63eb84d1Schristos it under the terms of the GNU General Public License as published by 7*63eb84d1Schristos the Free Software Foundation; either version 2, or (at your option) 8*63eb84d1Schristos any later version. 9*63eb84d1Schristos 10*63eb84d1Schristos This program is distributed in the hope that it will be useful, 11*63eb84d1Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 12*63eb84d1Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*63eb84d1Schristos GNU General Public License for more details. 14*63eb84d1Schristos 15*63eb84d1Schristos You should have received a copy of the GNU General Public License 16*63eb84d1Schristos along with this program; if not, write to the Free Software Foundation, 17*63eb84d1Schristos Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18*63eb84d1Schristos 19*63eb84d1Schristos #ifndef _PROGNAME_H 20*63eb84d1Schristos #define _PROGNAME_H 21*63eb84d1Schristos 22*63eb84d1Schristos /* Programs using this file should do the following in main(): 23*63eb84d1Schristos set_program_name (argv[0]); 24*63eb84d1Schristos */ 25*63eb84d1Schristos 26*63eb84d1Schristos 27*63eb84d1Schristos #ifdef __cplusplus 28*63eb84d1Schristos extern "C" { 29*63eb84d1Schristos #endif 30*63eb84d1Schristos 31*63eb84d1Schristos 32*63eb84d1Schristos /* String containing name the program is called with. */ 33*63eb84d1Schristos extern DLL_VARIABLE const char *program_name; 34*63eb84d1Schristos 35*63eb84d1Schristos /* Set program_name, based on argv[0]. */ 36*63eb84d1Schristos extern void set_program_name (const char *argv0); 37*63eb84d1Schristos 38*63eb84d1Schristos #if ENABLE_RELOCATABLE 39*63eb84d1Schristos 40*63eb84d1Schristos /* Set program_name, based on argv[0], and original installation prefix and 41*63eb84d1Schristos directory, for relocatability. */ 42*63eb84d1Schristos extern void set_program_name_and_installdir (const char *argv0, 43*63eb84d1Schristos const char *orig_installprefix, 44*63eb84d1Schristos const char *orig_installdir); 45*63eb84d1Schristos #undef set_program_name 46*63eb84d1Schristos #define set_program_name(ARG0) \ 47*63eb84d1Schristos set_program_name_and_installdir (ARG0, INSTALLPREFIX, INSTALLDIR) 48*63eb84d1Schristos 49*63eb84d1Schristos /* Return the full pathname of the current executable, based on the earlier 50*63eb84d1Schristos call to set_program_name_and_installdir. Return NULL if unknown. */ 51*63eb84d1Schristos extern char *get_full_program_name (void); 52*63eb84d1Schristos 53*63eb84d1Schristos #endif 54*63eb84d1Schristos 55*63eb84d1Schristos 56*63eb84d1Schristos #ifdef __cplusplus 57*63eb84d1Schristos } 58*63eb84d1Schristos #endif 59*63eb84d1Schristos 60*63eb84d1Schristos 61*63eb84d1Schristos #endif /* _PROGNAME_H */ 62