summaryrefslogtreecommitdiff
path: root/tools/build/v2/engine/execunix.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build/v2/engine/execunix.c')
-rw-r--r--tools/build/v2/engine/execunix.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/tools/build/v2/engine/execunix.c b/tools/build/v2/engine/execunix.c
index ef9dba0037..147d051cd5 100644
--- a/tools/build/v2/engine/execunix.c
+++ b/tools/build/v2/engine/execunix.c
@@ -88,7 +88,7 @@ static struct
char *target; /* buffer to hold action and target invoked */
char *command; /* buffer to hold command being invoked */
char *buffer[2]; /* buffer to hold stdout and stderr, if any */
- void (*func)( void *closure, int status, timing_info*, char *, char * );
+ void (*func)( void *closure, int status, timing_info*, const char *, const char * );
void *closure;
time_t start_dt; /* start of command timestamp */
} cmdtab[ MAXJOBS ] = {{0}};
@@ -110,12 +110,12 @@ void onintr( int disp )
void exec_cmd
(
- char * string,
- void (*func)( void *closure, int status, timing_info*, char *, char * ),
+ const char * string,
+ void (*func)( void *closure, int status, timing_info*, const char *, const char * ),
void * closure,
LIST * shell,
- char * action,
- char * target
+ const char * action,
+ const char * target
)
{
static int initialized = 0;
@@ -123,7 +123,7 @@ void exec_cmd
int err[2];
int slot;
int len;
- char * argv[ MAXARGC + 1 ]; /* +1 for NULL */
+ const char * argv[ MAXARGC + 1 ]; /* +1 for NULL */
/* Find a slot in the running commands table for this one. */
for ( slot = 0; slot < MAXJOBS; ++slot )
@@ -139,21 +139,22 @@ void exec_cmd
/* Forumulate argv. If shell was defined, be prepared for % and ! subs.
* Otherwise, use stock /bin/sh on unix or cmd.exe on NT.
*/
- if ( shell )
+ if ( !list_empty( shell ) )
{
int i;
char jobno[4];
int gotpercent = 0;
+ LISTITER iter = list_begin( shell ), end = list_end( shell );
sprintf( jobno, "%d", slot + 1 );
- for ( i = 0; shell && i < MAXARGC; ++i, shell = list_next( shell ) )
+ for ( i = 0; iter != end && i < MAXARGC; ++i, iter = list_next( iter ) )
{
- switch ( shell->string[0] )
+ switch ( object_str( list_item( iter ) )[0] )
{
case '%': argv[ i ] = string; ++gotpercent; break;
case '!': argv[ i ] = jobno; break;
- default : argv[ i ] = shell->string;
+ default : argv[ i ] = object_str( list_item( iter ) );
}
if ( DEBUG_EXECCMD )
printf( "argv[%d] = '%s'\n", i, argv[ i ] );
@@ -242,7 +243,7 @@ void exec_cmd
setrlimit( RLIMIT_CPU, &r_limit );
}
setpgid( pid,pid );
- execvp( argv[0], argv );
+ execvp( argv[0], (char * *)argv );
perror( "execvp" );
_exit( 127 );
}
@@ -566,4 +567,15 @@ int exec_wait()
return 1;
}
+void exec_done( void )
+{
+ int i;
+ for( i = 0; i < MAXJOBS; ++i )
+ {
+ if( ! cmdtab[i].action ) break;
+ BJAM_FREE( cmdtab[i].action );
+ BJAM_FREE( cmdtab[i].target );
+ }
+}
+
# endif /* USE_EXECUNIX */