progname.h 1.8 KB

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