bb2d87bb44d4dcb59dad48dbe7ca250a8756d268
[oota-llvm.git] / utils / not / not.cpp
1 //===- not.cpp - The 'not' testing tool -----------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/Support/Path.h"
11 #include "llvm/Support/Program.h"
12 #include "llvm/Support/raw_ostream.h"
13 using namespace llvm;
14
15 int main(int argc, const char **argv) {
16   sys::Path Program = sys::FindProgramByName(argv[1]);
17
18   std::string ErrMsg;
19   int Result = sys::ExecuteAndWait(Program, argv + 1, 0, 0, 0, 0, &ErrMsg);
20   if (Result < 0) {
21     errs() << "Error: " << ErrMsg << "\n";
22     return 1;
23   }
24
25   return Result == 0;
26 }