MCPcopy Create free account
hub / github.com/boostorg/build / argv_from_shell

Function argv_from_shell

v2/engine/execcmd.c:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 */
41
42void argv_from_shell( char const * * argv, LIST * shell, char const * command,
43 int const slot )
44{
45 static char jobno[ 4 ];
46
47 int i;
48 int gotpercent = 0;
49 LISTITER iter = list_begin( shell );
50 LISTITER end = list_end( shell );
51
52 assert( 0 <= slot );
53 assert( slot < 999 );
54 sprintf( jobno, "%d", slot + 1 );
55
56 for ( i = 0; iter != end && i < MAXARGC; ++i, iter = list_next( iter ) )
57 {
58 switch ( object_str( list_item( iter ) )[ 0 ] )
59 {
60 case '%': argv[ i ] = command; ++gotpercent; break;
61 case '!': argv[ i ] = jobno; break;
62 default : argv[ i ] = object_str( list_item( iter ) );
63 }
64 }
65
66 if ( !gotpercent )
67 argv[ i++ ] = command;
68
69 argv[ i ] = NULL;
70}
71
72
73/* Returns whether the given command string contains lines longer than the given

Callers 2

exec_cmdFunction · 0.85
exec_cmdFunction · 0.85

Calls 3

list_beginFunction · 0.85
list_endFunction · 0.85
object_strFunction · 0.85

Tested by

no test coverage detected