[GRASS-SVN] r47866 - grass/trunk/vector/v.external.out
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Aug 24 03:44:48 EDT 2011
Author: martinl
Date: 2011-08-24 00:44:48 -0700 (Wed, 24 Aug 2011)
New Revision: 47866
Modified:
grass/trunk/vector/v.external.out/args.c
grass/trunk/vector/v.external.out/local_proto.h
grass/trunk/vector/v.external.out/main.c
grass/trunk/vector/v.external.out/status.c
Log:
v.external.out: print status in shell script style
Modified: grass/trunk/vector/v.external.out/args.c
===================================================================
--- grass/trunk/vector/v.external.out/args.c 2011-08-23 22:12:27 UTC (rev 47865)
+++ grass/trunk/vector/v.external.out/args.c 2011-08-24 07:44:48 UTC (rev 47866)
@@ -46,6 +46,12 @@
flags->p->guisection = _("Print");
flags->p->suppress_required = YES;
+ flags->g = G_define_flag();
+ flags->g->key = 'g';
+ flags->g->description = _("Print current status in shell script style");
+ flags->g->guisection = _("Print");
+ flags->g->suppress_required = YES;
+
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
}
Modified: grass/trunk/vector/v.external.out/local_proto.h
===================================================================
--- grass/trunk/vector/v.external.out/local_proto.h 2011-08-23 22:12:27 UTC (rev 47865)
+++ grass/trunk/vector/v.external.out/local_proto.h 2011-08-24 07:44:48 UTC (rev 47866)
@@ -6,7 +6,7 @@
};
struct _flags {
- struct Flag *f, *p, *r;
+ struct Flag *f, *p, *r, *g;
};
/* args.c */
@@ -25,6 +25,6 @@
void list_formats(void);
/* status.c */
-void print_status(void);
+void print_status(int);
#endif
Modified: grass/trunk/vector/v.external.out/main.c
===================================================================
--- grass/trunk/vector/v.external.out/main.c 2011-08-23 22:12:27 UTC (rev 47865)
+++ grass/trunk/vector/v.external.out/main.c 2011-08-24 07:44:48 UTC (rev 47866)
@@ -59,8 +59,8 @@
make_link(options.dsn->answer,
options.format->answer, options.opts->answers);
- if (flags.p->answer) {
- print_status();
+ if (flags.p->answer || flags.g->answer) {
+ print_status(flags.g->answer ? 1 : 0);
}
exit(EXIT_SUCCESS);
Modified: grass/trunk/vector/v.external.out/status.c
===================================================================
--- grass/trunk/vector/v.external.out/status.c 2011-08-23 22:12:27 UTC (rev 47865)
+++ grass/trunk/vector/v.external.out/status.c 2011-08-24 07:44:48 UTC (rev 47866)
@@ -3,14 +3,17 @@
#include <grass/gis.h>
#include <grass/glocale.h>
-void print_status(void)
+void print_status(int shell)
{
FILE *fp;
struct Key_Value *key_val;
const char *p;
if (!G_find_file2("", "OGR", G_mapset())) {
- fprintf(stdout, _("Not using OGR\n"));
+ if (shell)
+ fprintf(stdout, "format=%s\n", "native");
+ else
+ fprintf(stdout, _("format: native\n"));
return;
}
@@ -21,15 +24,26 @@
fclose(fp);
p = G_find_key_value("dsn", key_val);
- fprintf(stdout, _("dsn: %s\n"),
- p ? p : _("not set (default 'ogr')"));
+ if (shell)
+ fprintf(stdout, "dsn=%s\n",
+ p ? p : "ogr");
+ else
+ fprintf(stdout, _("dsn: %s\n"),
+ p ? p : _("not set (default 'ogr')"));
p = G_find_key_value("format", key_val);
- fprintf(stdout, _("format: %s\n"),
- p ? p : _("not set (default ESRI_Shapefile)"));
-
+ if (shell)
+ fprintf(stdout, "format=%s\n",
+ p ? p : "ESRI_Shapefile");
+ else
+ fprintf(stdout, _("format: %s\n"),
+ p ? p : _("not set (default ESRI_Shapefile)"));
+
p = G_find_key_value("options", key_val);
- fprintf(stdout, _("options: %s\n"), p ? p : _("<none>"));
-
+ if (shell)
+ fprintf(stdout, "options=%s\n", p ? p : "");
+ else
+ fprintf(stdout, _("options: %s\n"), p ? p : _("<none>"));
+
G_free_key_value(key_val);
}
More information about the grass-commit
mailing list