Update of /cvsroot/boost/boost/tools/jam/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2951
Modified Files:
Tag: Boost_Jam_994
execcmd.h execunix.c jam.c jam.h
Log Message:
Added support for bjam -px options per discussions with Rene Rivera.
Index: execcmd.h
===================================================================
RCS file: /cvsroot/boost/boost/tools/jam/src/execcmd.h,v
retrieving revision 1.3.6.1
retrieving revision 1.3.6.2
diff -u -d -r1.3.6.1 -r1.3.6.2
--- execcmd.h 1 Jun 2007 21:39:28 -0000 1.3.6.1
+++ execcmd.h 2 Jun 2007 21:55:30 -0000 1.3.6.2
@@ -22,7 +22,7 @@
void (*func)( void *closure, int status, timing_info* ),
void *closure,
LIST *shell,
- char *rule_name,
+ char *action,
char *target);
int execwait();
Index: execunix.c
===================================================================
RCS file: /cvsroot/boost/boost/tools/jam/src/execunix.c,v
retrieving revision 1.10.2.7
retrieving revision 1.10.2.8
diff -u -d -r1.10.2.7 -r1.10.2.8
--- execunix.c 2 Jun 2007 15:34:53 -0000 1.10.2.7
+++ execunix.c 2 Jun 2007 21:55:30 -0000 1.10.2.8
@@ -95,7 +95,7 @@
void (*func)( void *closure, int status, timing_info* ),
void *closure,
LIST *shell,
- char *rule_name,
+ char *action,
char *target )
{
int out[2], err[2];
@@ -162,13 +162,13 @@
fcntl(out[0], F_SETFL, O_NONBLOCK);
fcntl(out[1], F_SETFL, O_NONBLOCK);
-#if 0
+
if (pipe(err) < 0)
exit(EXITBAD);
fcntl(err[0], F_SETFL, O_NONBLOCK);
fcntl(err[1], F_SETFL, O_NONBLOCK);
-#endif
+
/* Start the command */
if ((cmdtab[slot].pid = vfork()) == 0)
@@ -176,12 +176,15 @@
close(out[0]);
dup2(out[1], STDOUT_FILENO);
-#if 0
- close(err[0]);
- dup2(err[1], STDERR_FILENO);
-#else
- dup2(out[1], STDERR_FILENO);
-#endif
+ if (globs.pipe_action == 0)
+ {
+ dup2(out[1], STDERR_FILENO);
+ }
+ else
+ {
+ close(err[0]);
+ dup2(err[1], STDERR_FILENO);
+ }
execvp( argv[0], argv );
_exit(127);
@@ -192,44 +195,36 @@
exit( EXITBAD );
}
- /* close write end of pipe, open read end of pipe */
+ /* child writes stdout to out[1], parent reads from out[0] */
close(out[1]);
-#if 0
- close(err[1]);
-#endif
-
- /* child writes stdout to out[1], parent reads from out[0]
- child writes stderr to err[1], parent reads from err[0] */
cmdtab[slot].fd[OUT] = out[0];
-#if 0
- cmdtab[slot].fd[ERR] = err[0];
-#endif
-
cmdtab[slot].stream[OUT] = fdopen(cmdtab[slot].fd[OUT], "rb");
if (cmdtab[slot].stream[OUT] == NULL) {
perror( "fdopen" );
exit( EXITBAD );
}
-#if 0
+
+ /* child writes stderr to err[1], parent reads from err[0] */
+ close(err[1]);
+ cmdtab[slot].fd[ERR] = err[0];
cmdtab[slot].stream[ERR] = fdopen(cmdtab[slot].fd[ERR], "rb");
if (cmdtab[slot].stream[ERR] == NULL) {
perror( "fdopen" );
exit( EXITBAD );
}
-#endif
/* ensure enough room for rule and target name */
- if (rule_name && target)
+ if (action && target)
{
- len = strlen(rule_name) + strlen(target) + 2;
+ len = strlen(action) + strlen(target) + 2;
if (cmdtab[slot].com_len < len)
{
BJAM_FREE(cmdtab[ slot ].command);
cmdtab[ slot ].command = BJAM_MALLOC_ATOMIC(len);
cmdtab[ slot ].com_len = len;
}
- strcpy(cmdtab[ slot ].command, rule_name);
+ strcpy(cmdtab[ slot ].command, action);
strcat(cmdtab[ slot ].command, " ");
strcat(cmdtab[ slot ].command, target);
}
@@ -340,13 +335,11 @@
fd_max = fd_max < cmdtab[i].fd[OUT] ? cmdtab[i].fd[OUT] :
fd_max;
FD_SET(cmdtab[i].fd[OUT], &fds);
}
-#if 0
if (0 < cmdtab[i].fd[ERR])
{
fd_max = fd_max < cmdtab[i].fd[ERR] ? cmdtab[i].fd[ERR] :
fd_max;
FD_SET(cmdtab[i].fd[ERR], &fds);
}
-#endif
}
/* select will wait until io on a descriptor or a signal */
@@ -359,10 +352,10 @@
int out = 0, err = 0;
if (FD_ISSET(cmdtab[i].fd[OUT], &fds))
out = read_descriptor(i, OUT);
-#if 0
+
if (FD_ISSET(cmdtab[i].fd[ERR], &fds))
err = read_descriptor(i, ERR);
-#endif
+
/* if either descriptor closed, then we're done */
if (out || err)
{
@@ -382,17 +375,22 @@
{
printf("%s\n", cmdtab[i].command);
- /* print out the command output, if any */
- if (cmdtab[i].buffer[OUT])
+ /* print out the command output, if requested */
+ if (globs.pipe_action & STDOUT_FILENO ||
+ globs.pipe_action == 0)
{
- printf("%s", cmdtab[i].buffer[OUT]);
- /* print out rule and target to both stdout
and stderr */
- if (cmdtab[i].buffer[ERR])
- fprintf(stderr, "%s\n", cmdtab[i].command);
+ if (cmdtab[i].buffer[OUT])
+ {
+ printf("%s", cmdtab[i].buffer[OUT]);
+ if (globs.pipe_action & STDERR_FILENO)
+ if (cmdtab[i].buffer[ERR])
+ fprintf(stderr, "%s\n",
cmdtab[i].command);
+ }
}
- if (cmdtab[i].buffer[ERR])
- fprintf(stderr, "%s", cmdtab[i].buffer[ERR]);
+ if (globs.pipe_action & STDERR_FILENO)
+ if (cmdtab[i].buffer[ERR])
+ fprintf(stderr, "%s",
cmdtab[i].buffer[ERR]);
}
BJAM_FREE(cmdtab[i].buffer[OUT]);
@@ -422,11 +420,6 @@
cmdtab[i].func = 0;
cmdtab[i].closure = 0;
}
- if (0 != pid)
- {
- printf("pid not one of our processes?\n");
- exit(EXITBAD);
- }
}
}
}
Index: jam.c
===================================================================
RCS file: /cvsroot/boost/boost/tools/jam/src/jam.c,v
retrieving revision 1.41.2.2
retrieving revision 1.41.2.3
diff -u -d -r1.41.2.2 -r1.41.2.3
--- jam.c 1 Jun 2007 21:39:30 -0000 1.41.2.2
+++ jam.c 2 Jun 2007 21:55:30 -0000 1.41.2.3
@@ -141,6 +141,7 @@
1, /* jobs */
0, /* quitquick */
0, /* newestfirst */
+ 0, /* pipes action stdout and stderr merged to
action output */
# ifdef OS_MAC
{ 0, 0 }, /* debug - suppress tracing output */
# else
@@ -227,19 +228,20 @@
argc--, argv++;
- if( getoptions( argc, argv, "-:l:d:j:f:gs:t:ano:qv", optv ) < 0 )
+ if( getoptions( argc, argv, "-:l:d:j:p:f:gs:t:ano:qv", optv ) < 0 )
{
printf( "\nusage: %s [ options ] targets...\n\n", progname );
printf( "-a Build all targets, even if they are current.\n" );
printf( "-dx Set the debug level to x (0-9).\n" );
printf( "-fx Read x instead of Jambase.\n" );
- /* printf( "-g Build from newest sources first.\n" ); */
+ /* printf( "-g Build from newest sources first.\n" ); */
printf( "-jx Run up to x shell commands concurrently.\n" );
printf( "-lx Limit actions to x number of seconds after which they
are stopped.\n" );
printf( "-n Don't actually execute the updating actions.\n" );
printf( "-ox Write the updating actions to file x.\n" );
- printf( "-q Quit quickly as soon as a target fails.\n" );
+ printf( "-px x=0, pipes action stdout and stderr merged into action
output.\n" );
+ printf( "-q Quit quickly as soon as a target fails.\n" );
printf( "-sx=y Set variable x=y, overriding environment.\n" );
printf( "-tx Rebuild x, even if it is up-to-date.\n" );
printf( "-v Print the version of jam and exit.\n" );
@@ -254,7 +256,7 @@
{
printf( "Boost.Jam " );
printf( "Version %s. %s.\n", VERSION, OSMINOR );
- printf( " Copyright 1993-2002 Christopher Seiwald and Perforce
Software, Inc. \n" );
+ printf( " Copyright 1993-2002 Christopher Seiwald and Perforce
Software, Inc. \n" );
printf( " Copyright 2001 David Turner.\n" );
printf( " Copyright 2001-2004 David Abrahams.\n" );
printf( " Copyright 2002-2005 Rene Rivera.\n" );
@@ -268,16 +270,21 @@
if( ( s = getoptval( optv, 'n', 0 ) ) )
globs.noexec++, globs.debug[2] = 1;
- if( ( s = getoptval( optv, 'q', 0 ) ) )
- globs.quitquick = 1;
+ if( ( s = getoptval( optv, 'p', 0 ) ) )
+ /* undocumented -p3 (acts like both -p1 -p2) means separate pipe
action stdout and stderr */
+ globs.pipe_action = atoi(s);
+
+ if( ( s = getoptval( optv, 'q', 0 ) ) )
+ globs.quitquick = 1;
+
if( ( s = getoptval( optv, 'a', 0 ) ) )
anyhow++;
if( ( s = getoptval( optv, 'j', 0 ) ) )
globs.jobs = atoi( s );
- if( ( s = getoptval( optv, 'g', 0 ) ) )
- globs.newestfirst = 1;
+ if( ( s = getoptval( optv, 'g', 0 ) ) )
+ globs.newestfirst = 1;
if( ( s = getoptval( optv, 'l', 0 ) ) )
globs.timeout = atoi( s );
Index: jam.h
===================================================================
RCS file: /cvsroot/boost/boost/tools/jam/src/jam.h,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -u -d -r1.21.2.1 -r1.21.2.2
--- jam.h 30 May 2007 16:39:25 -0000 1.21.2.1
+++ jam.h 2 Jun 2007 21:55:30 -0000 1.21.2.2
@@ -522,6 +522,7 @@
int jobs;
int quitquick;
int newestfirst; /* build newest sources first */
+ int pipe_action;
char debug[DEBUG_MAX];
FILE *cmdout; /* print cmds, not run them */
long timeout; /* number of seconds to limit actions to, default
0 for no limit. */
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs