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