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