File: toolwrapper.cpp

package info (click to toggle)
odin 2.0.5-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,196 kB
  • sloc: cpp: 62,638; sh: 4,541; makefile: 779
file content (37 lines) | stat: -rw-r--r-- 879 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<string>
#include<fstream>
#include <cstdlib>

// Win-style process handling
#include <process.h>
#include <errno.h>
#include <windows.h>

using namespace std;

int main(int argc, char* argv[]) {

  string tool;
  string toolpath;

#include "toolwrapper_config.h"

  // add path for ppc-compiler binaries
  string newpath="PATH="+toolpath;
  const char* oldpath_ptr=getenv("PATH");
  if(oldpath_ptr) {
    string oldpath=oldpath_ptr;

    // remove blanks which make ccppc fail
    while(oldpath.find("; ")!=string::npos) oldpath.replace(oldpath.find("; "),2,";");
    while(oldpath.find(" ;")!=string::npos) oldpath.replace(oldpath.find(" ;"),2,";");

    newpath+=";"+string(oldpath);
  }
  _putenv(newpath.c_str());

  _putenv("WIND_BASE=;"); // for VB20, value seems to be irrelevant

  argv[0]=(char*)tool.c_str();
  return _spawnv( _P_WAIT, tool.c_str(), argv );
}