[GRASS-SVN] r40487 - in grass/trunk: include lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 16 18:57:38 EST 2010
Author: glynn
Date: 2010-01-16 18:57:37 -0500 (Sat, 16 Jan 2010)
New Revision: 40487
Modified:
grass/trunk/include/spawn.h
grass/trunk/lib/gis/spawn.c
Log:
Eliminate SF_ARGLIST: not portable
Modified: grass/trunk/include/spawn.h
===================================================================
--- grass/trunk/include/spawn.h 2010-01-16 23:47:10 UTC (rev 40486)
+++ grass/trunk/include/spawn.h 2010-01-16 23:57:37 UTC (rev 40487)
@@ -23,7 +23,6 @@
#define SF_BACKGROUND ((const char *) 7)
#define SF_DIRECTORY ((const char *) 8)
#define SF_ARGVEC ((const char *) 9)
-#define SF_ARGLIST ((const char *) 10)
enum signal_action
{
Modified: grass/trunk/lib/gis/spawn.c
===================================================================
--- grass/trunk/lib/gis/spawn.c 2010-01-16 23:47:10 UTC (rev 40486)
+++ grass/trunk/lib/gis/spawn.c 2010-01-16 23:57:37 UTC (rev 40487)
@@ -768,9 +768,6 @@
else if (arg == SF_ARGVEC) {
parse_argvec(sp, NEXT_ARG(va, const char **));
}
- else if (arg == SF_ARGLIST) {
- parse_arglist(sp, NEXT_ARG(va, va_list));
- }
else
sp->args[sp->num_args++] = arg;
}
@@ -838,9 +835,6 @@
else if (arg == SF_ARGVEC) {
parse_argvec(sp, va_arg(va, const char **));
}
- else if (arg == SF_ARGLIST) {
- parse_arglist(sp, va_arg(va, va_list));
- }
else
sp->args[sp->num_args++] = arg;
}
@@ -901,11 +895,22 @@
int G_spawn(const char *command, ...)
{
+ const char *args[MAX_ARGS];
+ int num_args = 0, i;
va_list va;
int status = -1;
va_start(va, command);
+ for (i = 0; ; i++) {
+ const char *arg = va_arg(va, const char *);
+ args[num_args++] = arg;
+ if (!arg)
+ break;
+ }
+
+ va_end(va);
+
status = G_spawn_ex(
command,
#ifndef __MINGW32__
@@ -913,11 +918,9 @@
SF_SIGNAL, SST_PRE, SSA_IGNORE, SIGQUIT,
SF_SIGNAL, SST_PRE, SSA_BLOCK, SIGCHLD,
#endif
- SF_ARGLIST, va,
+ SF_ARGVEC, args,
NULL);
- va_end(va);
-
return status;
}
More information about the grass-commit
mailing list