main.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /***************************************************************************
  2. *
  3. * MODULE: g.version
  4. * AUTHOR(S): Michael Shapiro, CERL
  5. * Andreas Lange - <andreas.lange rhein-main.de>
  6. * Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
  7. * PURPOSE: Output GRASS version number, date and copyright message.
  8. *
  9. * COPYRIGHT: (C) 2000-2007 by the GRASS Development Team
  10. *
  11. * This program is free software under the GPL (>=v2)
  12. * Read the file COPYING that comes with GRASS for details.
  13. *****************************************************************************/
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <grass/gis.h>
  18. #include <grass/glocale.h>
  19. #ifndef GRASS_VERSION_UPDATE_PKG
  20. #define GRASS_VERSION_UPDATE_PKG "0.1"
  21. #endif
  22. int main(int argc, char *argv[])
  23. {
  24. struct GModule *module;
  25. struct Flag *copyright, *build;
  26. G_gisinit(argv[0]);
  27. module = G_define_module();
  28. module->keywords = _("general");
  29. module->description = _("Displays version and copyright information.");
  30. copyright = G_define_flag();
  31. copyright->key = 'c';
  32. copyright->description = _("Print the copyright message");
  33. build = G_define_flag();
  34. build->key = 'b';
  35. build->description = _("Print the GRASS build information");
  36. if (G_parser(argc, argv))
  37. exit(EXIT_FAILURE);
  38. fprintf(stdout, "GRASS %s (%s) %s\n",
  39. GRASS_VERSION_NUMBER, GRASS_VERSION_DATE,
  40. GRASS_VERSION_UPDATE_PKG);
  41. if (copyright->answer) {
  42. fprintf(stdout, "\n");
  43. fputs(COPYING, stdout);
  44. }
  45. if (build->answer) {
  46. fprintf(stdout, "\n");
  47. fputs(GRASS_CONFIGURE_PARAMS, stdout);
  48. fprintf(stdout, "\n");
  49. }
  50. return (EXIT_SUCCESS);
  51. }