| 99 | */ |
| 100 | |
| 101 | void exec_cmd |
| 102 | ( |
| 103 | string const * command, |
| 104 | int flags, |
| 105 | ExecCmdCallback func, |
| 106 | void * closure, |
| 107 | LIST * shell |
| 108 | ) |
| 109 | { |
| 110 | char * s; |
| 111 | char * e; |
| 112 | char * p; |
| 113 | int vms_status; |
| 114 | int status; |
| 115 | int rstat = EXEC_CMD_OK; |
| 116 | int exit_reason = EXIT_OK; |
| 117 | timing_info time_info; |
| 118 | timestamp start_dt; |
| 119 | struct tms start_time; |
| 120 | struct tms end_time; |
| 121 | char * cmd_string = command->value; |
| 122 | |
| 123 | |
| 124 | /* Start the command */ |
| 125 | |
| 126 | timestamp_current( &time_info.start ); |
| 127 | times( &start_time ); |
| 128 | |
| 129 | /* See if command is more than one line discounting leading/trailing white |
| 130 | * space. |
| 131 | */ |
| 132 | for ( s = cmd_string; *s && isspace( *s ); ++s ); |
| 133 | |
| 134 | e = p = strchr( s, '\n' ); |
| 135 | |
| 136 | while ( p && isspace( *p ) ) |
| 137 | ++p; |
| 138 | |
| 139 | /* If multi line or long, write to com file. Otherwise, exec directly. */ |
| 140 | if ( ( p && *p ) || ( e - s > WRTLEN ) ) |
| 141 | { |
| 142 | FILE * f; |
| 143 | |
| 144 | /* Create temp file invocation. */ |
| 145 | |
| 146 | if ( !*commandbuf ) |
| 147 | { |
| 148 | OBJECT * tmp_filename = 0; |
| 149 | |
| 150 | tmp_filename = path_tmpfile(); |
| 151 | |
| 152 | |
| 153 | /* Get tmp file name is VMS-format. */ |
| 154 | { |
| 155 | string os_filename[ 1 ]; |
| 156 | string_new( os_filename ); |
| 157 | path_translate_to_os( object_str( tmp_filename ), os_filename ); |
| 158 | object_free( tmp_filename ); |
nothing calls this directly
no test coverage detected