[b87a5ed] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[76c7f65e] | 7 | // cfa.cc -- |
---|
[b87a5ed] | 8 | // |
---|
[51b7345] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Tue Aug 20 13:44:49 2002 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[6acb935] | 12 | // Last Modified On : Fri Jan 20 14:38:45 2017 |
---|
| 13 | // Update Count : 155 |
---|
[b87a5ed] | 14 | // |
---|
[51b7345] | 15 | |
---|
| 16 | #include <iostream> |
---|
[b87a5ed] | 17 | #include <cstdio> // perror |
---|
| 18 | #include <cstdlib> // putenv, exit |
---|
| 19 | #include <unistd.h> // execvp |
---|
| 20 | #include <string> // STL version |
---|
[51b7345] | 21 | |
---|
[b87a5ed] | 22 | #include "config.h" // configure info |
---|
[51b7345] | 23 | |
---|
| 24 | using std::cerr; |
---|
| 25 | using std::endl; |
---|
| 26 | using std::string; |
---|
[47a8d17] | 27 | using std::to_string; |
---|
[51b7345] | 28 | |
---|
| 29 | |
---|
| 30 | //#define __DEBUG_H__ |
---|
| 31 | |
---|
| 32 | |
---|
| 33 | bool prefix( string arg, string pre ) { |
---|
[b87a5ed] | 34 | return arg.substr( 0, pre.size() ) == pre; |
---|
[51b7345] | 35 | } // prefix |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | void shuffle( const char *args[], int S, int E, int N ) { |
---|
[b87a5ed] | 39 | // S & E index 1 passed the end so adjust with -1 |
---|
[51b7345] | 40 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 41 | cerr << "shuffle:" << S << " " << E << " " << N << endl; |
---|
[51b7345] | 42 | #endif // __DEBUG_H__ |
---|
[b87a5ed] | 43 | for ( int j = E-1 + N; j > S-1 + N; j -=1 ) { |
---|
[51b7345] | 44 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 45 | cerr << "\t" << j << " " << j-N << endl; |
---|
[51b7345] | 46 | #endif // __DEBUG_H__ |
---|
[b87a5ed] | 47 | args[j] = args[j-N]; |
---|
| 48 | } // for |
---|
[51b7345] | 49 | } // shuffle |
---|
| 50 | |
---|
| 51 | |
---|
[4b1afb6] | 52 | #define str(s) #s |
---|
| 53 | |
---|
[51b7345] | 54 | int main( int argc, char *argv[] ) { |
---|
[4b1afb6] | 55 | string Version( CFA_VERSION_LONG ); // current version number from CONFIG |
---|
| 56 | string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) ); |
---|
[51b7345] | 57 | |
---|
[00cc023] | 58 | string installincdir( CFA_INCDIR ); // fixed location of include files |
---|
| 59 | string installlibdir( CFA_LIBDIR ); // fixed location of cc1 and cfa-cpp commands |
---|
[51b7345] | 60 | |
---|
[b87a5ed] | 61 | string heading; // banner printed at start of cfa compilation |
---|
| 62 | string arg; // current command-line argument during command-line parsing |
---|
| 63 | string Bprefix; // path where gcc looks for compiler command steps |
---|
| 64 | string langstd; // language standard |
---|
[51b7345] | 65 | |
---|
[e24f13a] | 66 | string compiler_path( CFA_BACKEND_CC ); // path/name of C compiler |
---|
[b87a5ed] | 67 | string compiler_name; // name of C compiler |
---|
[51b7345] | 68 | |
---|
[b87a5ed] | 69 | bool nonoptarg = false; // indicates non-option argument specified |
---|
| 70 | bool link = true; // linking as well as compiling |
---|
| 71 | bool verbose = false; // -v flag |
---|
| 72 | bool quiet = false; // -quiet flag |
---|
| 73 | bool debug = true; // -debug flag |
---|
| 74 | bool help = false; // -help flag |
---|
| 75 | bool CFA_flag = false; // -CFA flag |
---|
| 76 | bool cpp_flag = false; // -E or -M flag, preprocessor only |
---|
[de62360d] | 77 | bool std_flag = false; // -std= flag |
---|
[35f9114] | 78 | bool noincstd_flag = false; // -no-include-stdhdr= flag |
---|
[6e4b913] | 79 | bool debugging __attribute(( unused )) = false; // -g flag |
---|
[51b7345] | 80 | |
---|
[b87a5ed] | 81 | const char *args[argc + 100]; // cfa command line values, plus some space for additional flags |
---|
| 82 | int sargs = 1; // starting location for arguments in args list |
---|
| 83 | int nargs = sargs; // number of arguments in args list; 0 => command name |
---|
[51b7345] | 84 | |
---|
[b87a5ed] | 85 | const char *libs[argc + 20]; // non-user libraries must come separately, plus some added libraries and flags |
---|
| 86 | int nlibs = 0; |
---|
[51b7345] | 87 | |
---|
| 88 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 89 | cerr << "CFA:" << endl; |
---|
[51b7345] | 90 | #endif // __DEBUG_H__ |
---|
| 91 | |
---|
[b87a5ed] | 92 | // process command-line arguments |
---|
[51b7345] | 93 | |
---|
[b87a5ed] | 94 | for ( int i = 1; i < argc; i += 1 ) { |
---|
[51b7345] | 95 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 96 | cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl; |
---|
[51b7345] | 97 | #endif // __DEBUG_H__ |
---|
[b87a5ed] | 98 | arg = argv[i]; // convert to string value |
---|
[51b7345] | 99 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 100 | cerr << "arg:\"" << arg << "\"" << endl; |
---|
[51b7345] | 101 | #endif // __DEBUG_H__ |
---|
[b87a5ed] | 102 | if ( prefix( arg, "-" ) ) { |
---|
| 103 | // pass through arguments |
---|
| 104 | |
---|
| 105 | if ( arg == "-Xlinker" || arg == "-o" ) { |
---|
| 106 | args[nargs] = argv[i]; // pass the argument along |
---|
| 107 | nargs += 1; |
---|
| 108 | i += 1; |
---|
| 109 | if ( i == argc ) continue; // next argument available ? |
---|
| 110 | args[nargs] = argv[i]; // pass the argument along |
---|
| 111 | nargs += 1; |
---|
| 112 | } else if ( arg == "-XCFA" ) { // CFA pass through |
---|
| 113 | i += 1; |
---|
| 114 | args[nargs] = ( *new string( string("-D__CFA_FLAG__=") + argv[i] ) ).c_str(); |
---|
| 115 | nargs += 1; |
---|
| 116 | |
---|
| 117 | // CFA specific arguments |
---|
| 118 | |
---|
| 119 | } else if ( arg == "-CFA" ) { |
---|
| 120 | CFA_flag = true; // strip the -CFA flag |
---|
| 121 | link = false; |
---|
| 122 | args[nargs] = "-E"; // replace the argument with -E |
---|
| 123 | nargs += 1; |
---|
| 124 | } else if ( arg == "-debug" ) { |
---|
| 125 | debug = true; // strip the debug flag |
---|
| 126 | } else if ( arg == "-nodebug" ) { |
---|
| 127 | debug = false; // strip the nodebug flag |
---|
| 128 | } else if ( arg == "-quiet" ) { |
---|
| 129 | quiet = true; // strip the quiet flag |
---|
| 130 | } else if ( arg == "-noquiet" ) { |
---|
| 131 | quiet = false; // strip the noquiet flag |
---|
| 132 | } else if ( arg == "-help" ) { |
---|
| 133 | help = true; // strip the help flag |
---|
| 134 | } else if ( arg == "-nohelp" ) { |
---|
| 135 | help = false; // strip the nohelp flag |
---|
[35f9114] | 136 | } else if ( arg == "-no-include-stdhdr" ) { |
---|
| 137 | noincstd_flag = true; // strip the no-include-stdhdr flag |
---|
[b87a5ed] | 138 | } else if ( arg == "-compiler" ) { |
---|
| 139 | // use the user specified compiler |
---|
| 140 | i += 1; |
---|
| 141 | if ( i == argc ) continue; // next argument available ? |
---|
| 142 | compiler_path = argv[i]; |
---|
| 143 | if ( putenv( (char *)( *new string( string( "__U_COMPILER__=" ) + argv[i]) ).c_str() ) != 0 ) { |
---|
| 144 | cerr << argv[0] << " error, cannot set environment variable." << endl; |
---|
| 145 | exit( EXIT_FAILURE ); |
---|
| 146 | } // if |
---|
| 147 | |
---|
[de62360d] | 148 | // C specific arguments |
---|
[b87a5ed] | 149 | |
---|
| 150 | } else if ( arg == "-v" ) { |
---|
| 151 | verbose = true; // verbosity required |
---|
| 152 | args[nargs] = argv[i]; // pass the argument along |
---|
| 153 | nargs += 1; |
---|
| 154 | } else if ( arg == "-g" ) { |
---|
| 155 | debugging = true; // symbolic debugging required |
---|
| 156 | args[nargs] = argv[i]; // pass the argument along |
---|
| 157 | nargs += 1; |
---|
[de62360d] | 158 | } else if ( prefix( arg, "-std=" ) ) { |
---|
[53ba273] | 159 | std_flag = true; // -std=XX provided |
---|
[de62360d] | 160 | args[nargs] = argv[i]; // pass the argument along |
---|
| 161 | nargs += 1; |
---|
[b87a5ed] | 162 | } else if ( prefix( arg, "-B" ) ) { |
---|
| 163 | Bprefix = arg.substr(2); // strip the -B flag |
---|
| 164 | args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str(); |
---|
| 165 | nargs += 1; |
---|
| 166 | } else if ( prefix( arg, "-b" ) ) { |
---|
| 167 | if ( arg.length() == 2 ) { // separate argument ? |
---|
| 168 | i += 1; |
---|
| 169 | if ( i == argc ) continue; // next argument available ? |
---|
| 170 | arg += argv[i]; // concatenate argument |
---|
| 171 | } // if |
---|
| 172 | // later versions of gcc require the -b option to appear at the start of the command line |
---|
| 173 | shuffle( args, sargs, nargs, 1 ); // make room at front of argument list |
---|
| 174 | args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along |
---|
| 175 | if ( putenv( (char *)( *new string( string( "__GCC_MACHINE__=" ) + arg ) ).c_str() ) != 0 ) { |
---|
| 176 | cerr << argv[0] << " error, cannot set environment variable." << endl; |
---|
| 177 | exit( EXIT_FAILURE ); |
---|
| 178 | } // if |
---|
| 179 | sargs += 1; |
---|
| 180 | nargs += 1; |
---|
| 181 | } else if ( prefix( arg, "-V" ) ) { |
---|
| 182 | if ( arg.length() == 2 ) { // separate argument ? |
---|
| 183 | i += 1; |
---|
| 184 | if ( i == argc ) continue; // next argument available ? |
---|
| 185 | arg += argv[i]; // concatenate argument |
---|
| 186 | } // if |
---|
| 187 | // later versions of gcc require the -V option to appear at the start of the command line |
---|
| 188 | shuffle( args, sargs, nargs, 1 ); // make room at front of argument list |
---|
| 189 | args[sargs] = ( *new string( arg ) ).c_str(); // pass the argument along |
---|
| 190 | if ( putenv( (char *)( *new string( string( "__GCC_VERSION__=" ) + arg ) ).c_str() ) != 0 ) { |
---|
| 191 | cerr << argv[0] << " error, cannot set environment variable." << endl; |
---|
| 192 | exit( EXIT_FAILURE ); |
---|
| 193 | } // if |
---|
| 194 | sargs += 1; |
---|
| 195 | nargs += 1; |
---|
| 196 | } else if ( arg == "-c" || arg == "-S" || arg == "-E" || arg == "-M" || arg == "-MM" ) { |
---|
| 197 | args[nargs] = argv[i]; // pass the argument along |
---|
| 198 | nargs += 1; |
---|
| 199 | if ( arg == "-E" || arg == "-M" || arg == "-MM" ) { |
---|
| 200 | cpp_flag = true; // cpp only |
---|
| 201 | } // if |
---|
| 202 | link = false; // no linkage required |
---|
| 203 | } else if ( arg[1] == 'l' ) { |
---|
| 204 | // if the user specifies a library, load it after user code |
---|
| 205 | libs[nlibs] = argv[i]; |
---|
| 206 | nlibs += 1; |
---|
| 207 | } else { |
---|
| 208 | // concatenate any other arguments |
---|
| 209 | args[nargs] = argv[i]; |
---|
| 210 | nargs += 1; |
---|
| 211 | } // if |
---|
| 212 | } else { |
---|
| 213 | // concatenate other arguments |
---|
| 214 | args[nargs] = argv[i]; |
---|
| 215 | nargs += 1; |
---|
| 216 | nonoptarg = true; |
---|
| 217 | } // if |
---|
| 218 | } // for |
---|
[51b7345] | 219 | |
---|
[b87a5ed] | 220 | #ifdef __DEBUG_H__ |
---|
| 221 | cerr << "args:"; |
---|
| 222 | for ( int i = 1; i < nargs; i += 1 ) { |
---|
| 223 | cerr << " " << args[i]; |
---|
| 224 | } // for |
---|
| 225 | cerr << endl; |
---|
| 226 | #endif // __DEBUG_H__ |
---|
[51b7345] | 227 | |
---|
[b87a5ed] | 228 | if ( cpp_flag && CFA_flag ) { |
---|
| 229 | cerr << argv[0] << " error, cannot use -E and -CFA flags together." << endl; |
---|
| 230 | exit( EXIT_FAILURE ); |
---|
| 231 | } // if |
---|
[51b7345] | 232 | |
---|
[6e4b913] | 233 | // add the CFA include-library paths, which allow direct access to header files without directory qualification |
---|
[b87a5ed] | 234 | args[nargs] = "-I" CFA_INCDIR; |
---|
| 235 | nargs += 1; |
---|
[d0542c4] | 236 | if ( ! noincstd_flag ) { // do not use during build |
---|
| 237 | args[nargs] = "-I" CFA_INCDIR "/stdhdr"; |
---|
| 238 | nargs += 1; |
---|
| 239 | } // if |
---|
[0e76cf4f] | 240 | args[nargs] = "-I" CFA_INCDIR "/concurrency"; |
---|
| 241 | nargs += 1; |
---|
[76c7f65e] | 242 | args[nargs] = "-I" CFA_INCDIR "/containers"; |
---|
| 243 | nargs += 1; |
---|
| 244 | |
---|
[0edebf8] | 245 | #ifdef HAVE_LIBCFA |
---|
[b87a5ed] | 246 | if ( link ) { |
---|
[0edebf8] | 247 | #if ! defined(HAVE_LIBCFA_RELEASE) |
---|
[ff2d7341] | 248 | if( !debug ) { |
---|
[0edebf8] | 249 | cerr << "error: Option -nodebug is not available, libcfa was not installed." << endl; |
---|
| 250 | exit( EXIT_FAILURE ); |
---|
| 251 | } |
---|
| 252 | #endif |
---|
| 253 | #if ! defined(HAVE_LIBCFA_DEBUG) |
---|
[ff2d7341] | 254 | if( debug ) { |
---|
[0edebf8] | 255 | cerr << "error: Option -debug is not available, libcfa-d was not installed." << endl; |
---|
| 256 | exit( EXIT_FAILURE ); |
---|
| 257 | } |
---|
| 258 | #endif |
---|
| 259 | |
---|
[b87a5ed] | 260 | // include the cfa library in case it's needed |
---|
| 261 | args[nargs] = "-L" CFA_LIBDIR; |
---|
[51b7345] | 262 | nargs += 1; |
---|
[0edebf8] | 263 | if( debug ) { |
---|
| 264 | args[nargs] = "-lcfa-d"; |
---|
| 265 | } else { |
---|
| 266 | args[nargs] = "-lcfa"; |
---|
| 267 | } |
---|
[51b7345] | 268 | nargs += 1; |
---|
[63f78f0] | 269 | args[nargs] = "-lpthread"; |
---|
| 270 | nargs += 1; |
---|
[9d944b2] | 271 | args[nargs] = "-ldl"; |
---|
| 272 | nargs += 1; |
---|
[c5ac6d5] | 273 | args[nargs] = "-lrt"; |
---|
| 274 | nargs += 1; |
---|
[9d944b2] | 275 | args[nargs] = "-Xlinker"; |
---|
| 276 | nargs += 1; |
---|
| 277 | args[nargs] = "--undefined=__lib_debug_write"; |
---|
| 278 | nargs += 1; |
---|
| 279 | |
---|
[51b7345] | 280 | } // if |
---|
[0edebf8] | 281 | #endif //HAVE_LIBCFA |
---|
[51b7345] | 282 | |
---|
[b87a5ed] | 283 | // add the correct set of flags based on the type of compile this is |
---|
[8c17ab0] | 284 | |
---|
[ec129c4] | 285 | args[nargs] = ( *new string( string("-D__CFA_MAJOR__=") + Major ) ).c_str(); |
---|
[51b7345] | 286 | nargs += 1; |
---|
[b87a5ed] | 287 | args[nargs] = ( *new string( string("-D__CFA_MINOR__=") + Minor ) ).c_str(); |
---|
[51b7345] | 288 | nargs += 1; |
---|
[ec129c4] | 289 | args[nargs] = ( *new string( string("-D__CFA_PATCH__=") + Patch ) ).c_str(); |
---|
[1db21619] | 290 | nargs += 1; |
---|
[4c82a3c] | 291 | args[nargs] = "-D__CFA__"; |
---|
| 292 | nargs += 1; |
---|
| 293 | args[nargs] = "-D__CFORALL__"; |
---|
[02e5ab6] | 294 | nargs += 1; |
---|
[6acb935] | 295 | args[nargs] = "-D__cforall"; |
---|
| 296 | nargs += 1; |
---|
[51b7345] | 297 | |
---|
[b87a5ed] | 298 | if ( cpp_flag ) { |
---|
| 299 | args[nargs] = "-D__CPP__"; |
---|
| 300 | nargs += 1; |
---|
| 301 | } // if |
---|
[51b7345] | 302 | |
---|
[b87a5ed] | 303 | if ( CFA_flag ) { |
---|
[4c82a3c] | 304 | args[nargs] = "-D__CFA_PREPROCESS_"; |
---|
[b87a5ed] | 305 | nargs += 1; |
---|
| 306 | } // if |
---|
[51b7345] | 307 | |
---|
[b87a5ed] | 308 | if ( debug ) { |
---|
| 309 | heading += " (debug)"; |
---|
| 310 | args[nargs] = "-D__CFA_DEBUG__"; |
---|
| 311 | nargs += 1; |
---|
| 312 | } else { |
---|
| 313 | heading += " (no debug)"; |
---|
| 314 | } // if |
---|
[51b7345] | 315 | |
---|
[b87a5ed] | 316 | if ( Bprefix.length() == 0 ) { |
---|
| 317 | Bprefix = installlibdir; |
---|
| 318 | args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str(); |
---|
| 319 | nargs += 1; |
---|
| 320 | } // if |
---|
[51b7345] | 321 | |
---|
[b87a5ed] | 322 | // execute the compilation command |
---|
[51b7345] | 323 | |
---|
[b87a5ed] | 324 | args[0] = compiler_path.c_str(); // set compiler command for exec |
---|
| 325 | // find actual name of the compiler independent of the path to it |
---|
| 326 | int p = compiler_path.find_last_of( '/' ); // scan r -> l for first '/' |
---|
| 327 | if ( p == -1 ) { |
---|
| 328 | compiler_name = compiler_path; |
---|
| 329 | } else { |
---|
| 330 | compiler_name = *new string( compiler_path.substr( p + 1 ) ); |
---|
| 331 | } // if |
---|
[51b7345] | 332 | |
---|
[b87a5ed] | 333 | if ( prefix( compiler_name, "gcc" ) ) { // allow suffix on gcc name |
---|
| 334 | args[nargs] = "-no-integrated-cpp"; |
---|
| 335 | nargs += 1; |
---|
[76c7f65e] | 336 | args[nargs] = "-Wno-deprecated"; |
---|
[b87a5ed] | 337 | nargs += 1; |
---|
[de62360d] | 338 | if ( ! std_flag ) { // default c99, if none specified |
---|
[53ba273] | 339 | args[nargs] = "-std=gnu99"; |
---|
[de62360d] | 340 | nargs += 1; |
---|
| 341 | } // if |
---|
[76c7f65e] | 342 | args[nargs] = "-fgnu89-inline"; |
---|
[6e991d6] | 343 | nargs += 1; |
---|
[b87a5ed] | 344 | args[nargs] = ( *new string( string("-B") + Bprefix + "/" ) ).c_str(); |
---|
| 345 | nargs += 1; |
---|
[d3b7937] | 346 | args[nargs] = "-lm"; |
---|
| 347 | nargs += 1; |
---|
[b87a5ed] | 348 | } else { |
---|
[e24f13a] | 349 | cerr << argv[0] << " error, compiler \"" << compiler_name << "\" unsupported." << endl; |
---|
[b87a5ed] | 350 | exit( EXIT_FAILURE ); |
---|
| 351 | } // if |
---|
[51b7345] | 352 | |
---|
[b87a5ed] | 353 | for ( int i = 0; i < nlibs; i += 1 ) { // copy non-user libraries after all user libraries |
---|
| 354 | args[nargs] = libs[i]; |
---|
| 355 | nargs += 1; |
---|
| 356 | } // for |
---|
[51b7345] | 357 | |
---|
[b87a5ed] | 358 | args[nargs] = NULL; // terminate with NULL |
---|
[51b7345] | 359 | |
---|
| 360 | #ifdef __DEBUG_H__ |
---|
[b87a5ed] | 361 | cerr << "nargs: " << nargs << endl; |
---|
| 362 | cerr << "args:" << endl; |
---|
| 363 | for ( int i = 0; args[i] != NULL; i += 1 ) { |
---|
| 364 | cerr << " \"" << args[i] << "\"" << endl; |
---|
| 365 | } // for |
---|
[51b7345] | 366 | #endif // __DEBUG_H__ |
---|
| 367 | |
---|
[b87a5ed] | 368 | if ( ! quiet ) { |
---|
| 369 | cerr << "CFA " << "Version " << Version << heading << endl; |
---|
| 370 | |
---|
| 371 | if ( help ) { |
---|
| 372 | cerr << |
---|
| 373 | "-debug\t\t\t: use cfa runtime with debug checking" << endl << |
---|
| 374 | "-help\t\t\t: print this help message" << endl << |
---|
| 375 | "-quiet\t\t\t: print no messages from the cfa command" << endl << |
---|
| 376 | "-CFA\t\t\t: run the cpp preprocessor and the cfa-cpp translator" << endl << |
---|
| 377 | "-XCFA -cfa-cpp-flag\t: pass next flag as-is to the cfa-cpp translator" << endl << |
---|
| 378 | "...\t\t\t: any other " << compiler_name << " flags" << endl; |
---|
| 379 | } // if |
---|
[51b7345] | 380 | } // if |
---|
| 381 | |
---|
[b87a5ed] | 382 | if ( verbose ) { |
---|
| 383 | if ( argc == 2 ) exit( EXIT_SUCCESS ); // if only the -v flag is specified, do not invoke gcc |
---|
[51b7345] | 384 | |
---|
[b87a5ed] | 385 | for ( int i = 0; args[i] != NULL; i += 1 ) { |
---|
| 386 | cerr << args[i] << " "; |
---|
| 387 | } // for |
---|
| 388 | cerr << endl; |
---|
| 389 | } // if |
---|
[51b7345] | 390 | |
---|
[b87a5ed] | 391 | if ( ! nonoptarg ) { |
---|
| 392 | cerr << argv[0] << " error, no input files" << endl; |
---|
| 393 | exit( EXIT_FAILURE ); |
---|
| 394 | } // if |
---|
[51b7345] | 395 | |
---|
[b87a5ed] | 396 | // execute the command and return the result |
---|
[51b7345] | 397 | |
---|
[b87a5ed] | 398 | execvp( args[0], (char *const *)args ); // should not return |
---|
| 399 | perror( "CFA Translator error: cfa level, execvp" ); |
---|
| 400 | exit( EXIT_FAILURE ); |
---|
[51b7345] | 401 | } // main |
---|
| 402 | |
---|
| 403 | // Local Variables: // |
---|
[b87a5ed] | 404 | // tab-width: 4 // |
---|
| 405 | // mode: c++ // |
---|
[51b7345] | 406 | // compile-command: "make install" // |
---|
| 407 | // End: // |
---|