|
@@ -7,7 +7,7 @@
|
|
* Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
|
|
* Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
|
|
* PURPOSE: Output GRASS version number, date and copyright message.
|
|
* PURPOSE: Output GRASS version number, date and copyright message.
|
|
*
|
|
*
|
|
-* COPYRIGHT: (C) 2000-2009 by the GRASS Development Team
|
|
|
|
|
|
+* COPYRIGHT: (C) 2000-2009, 2011 by the GRASS Development Team
|
|
*
|
|
*
|
|
* This program is free software under the GPL (>=v2)
|
|
* This program is free software under the GPL (>=v2)
|
|
* Read the file COPYING that comes with GRASS for details.
|
|
* Read the file COPYING that comes with GRASS for details.
|
|
@@ -35,33 +35,45 @@ static const char GRASS_CONFIGURE_PARAMS[] =
|
|
int main(int argc, char *argv[])
|
|
int main(int argc, char *argv[])
|
|
{
|
|
{
|
|
struct GModule *module;
|
|
struct GModule *module;
|
|
- struct Flag *copyright, *build, *gish_rev;
|
|
|
|
|
|
+ struct Flag *copyright, *build, *gish_rev, *shell;
|
|
|
|
|
|
G_gisinit(argv[0]);
|
|
G_gisinit(argv[0]);
|
|
|
|
|
|
module = G_define_module();
|
|
module = G_define_module();
|
|
G_add_keyword(_("general"));
|
|
G_add_keyword(_("general"));
|
|
|
|
+ G_add_keyword(_("version"));
|
|
module->description = _("Displays version and copyright information.");
|
|
module->description = _("Displays version and copyright information.");
|
|
|
|
|
|
copyright = G_define_flag();
|
|
copyright = G_define_flag();
|
|
copyright->key = 'c';
|
|
copyright->key = 'c';
|
|
- copyright->description = _("Print the copyright message");
|
|
|
|
|
|
+ copyright->description = _("Print also the copyright message");
|
|
|
|
|
|
build = G_define_flag();
|
|
build = G_define_flag();
|
|
build->key = 'b';
|
|
build->key = 'b';
|
|
- build->description = _("Print the GRASS build information");
|
|
|
|
|
|
+ build->description = _("Print also the GRASS build information");
|
|
|
|
|
|
gish_rev = G_define_flag();
|
|
gish_rev = G_define_flag();
|
|
gish_rev->key = 'r';
|
|
gish_rev->key = 'r';
|
|
gish_rev->description =
|
|
gish_rev->description =
|
|
- _("Print the GIS library revision number and time");
|
|
|
|
|
|
+ _("Print also the GIS library revision number and time");
|
|
|
|
|
|
|
|
+ shell = G_define_flag();
|
|
|
|
+ shell->key = 'g';
|
|
|
|
+ shell->description = _("Print info in shell script style");
|
|
|
|
+
|
|
if (G_parser(argc, argv))
|
|
if (G_parser(argc, argv))
|
|
exit(EXIT_FAILURE);
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
|
- fprintf(stdout, "GRASS %s%s (%s)\n",
|
|
|
|
- GRASS_VERSION_NUMBER, GRASS_VERSION_SVN,
|
|
|
|
- GRASS_VERSION_DATE);
|
|
|
|
|
|
+ if (shell->answer) {
|
|
|
|
+ fprintf(stdout, "version=%s\n", GRASS_VERSION_NUMBER);
|
|
|
|
+ fprintf(stdout, "revision=%s\n", GRASS_VERSION_SVN);
|
|
|
|
+ fprintf(stdout, "date=%s\n", GRASS_VERSION_DATE);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ fprintf(stdout, "GRASS %s%s (%s)\n",
|
|
|
|
+ GRASS_VERSION_NUMBER, GRASS_VERSION_SVN,
|
|
|
|
+ GRASS_VERSION_DATE);
|
|
|
|
+ }
|
|
|
|
|
|
if (copyright->answer) {
|
|
if (copyright->answer) {
|
|
fprintf(stdout, "\n");
|
|
fprintf(stdout, "\n");
|
|
@@ -78,7 +90,13 @@ int main(int argc, char *argv[])
|
|
/* fprintf(stdout, "%s\n%s\n", GIS_H_VERSION, GIS_H_DATE); */
|
|
/* fprintf(stdout, "%s\n%s\n", GIS_H_VERSION, GIS_H_DATE); */
|
|
char **rev_ver = G_tokenize(GIS_H_VERSION, "$");
|
|
char **rev_ver = G_tokenize(GIS_H_VERSION, "$");
|
|
char **rev_time = G_tokenize(GIS_H_DATE, "$");
|
|
char **rev_time = G_tokenize(GIS_H_DATE, "$");
|
|
- fprintf(stdout, "%s\n%s\n", rev_ver[1], rev_time[1]);
|
|
|
|
|
|
+ if (shell->answer) {
|
|
|
|
+ fprintf(stdout, "gis_revision=%s\n", rev_ver[1]);
|
|
|
|
+ fprintf(stdout, "gis_date=%s\n", rev_time[1]);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ fprintf(stdout, "%s\n%s\n", rev_ver[1], rev_time[1]);
|
|
|
|
+ }
|
|
G_free_tokens(rev_ver);
|
|
G_free_tokens(rev_ver);
|
|
G_free_tokens(rev_time);
|
|
G_free_tokens(rev_time);
|
|
}
|
|
}
|