Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pd/pragma.h"
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "dirty/dm/file.h"
- #include <string>
- #include <fstream>
- using namespace std;
- void fileToString(string& str, FILE *f)
- {
- char psBuffer[1024*16]; //16k should be big enough for any single line gcc and other apps throw at us
- while( !feof(f) )
- {
- if( fgets( psBuffer, sizeof(psBuffer), f ) != NULL )
- str += ( psBuffer );
- }
- }
- long getRevionNumber(const string& s)
- {
- const char revStr []= "At revision ";
- size_t l, v;
- l = s.rfind(revStr);
- if (l == -1) return 0;
- l += sizeof(revStr)-1;
- v = atoi( &s.c_str()[l] );
- return v;
- }
- int main(int argc, char *argv[])
- {
- /*
- STARTUPINFO siStartupInfo;
- PROCESS_INFORMATION piProcessInfo;
- memset(&siStartupInfo, 0, sizeof(siStartupInfo));
- memset(&piProcessInfo, 0, sizeof(piProcessInfo));
- siStartupInfo.cb = sizeof(siStartupInfo);
- siStartupInfo.hStdError =
- CreateProcess("C:/nightly/autobuild.bat ", 0, NULL, NULL, FALSE, 0, NULL, NULL, &siStartupInfo, &piProcessInfo);
- */
- #ifdef _DEBUG
- fs_chdir("C:/nightly/targetdir");
- #endif
- long doClean=0, i;
- for (i=1; i<argc; i++)
- {
- if (argv[i] == '-r') //rebuild/clean
- doClean = 1;
- else if (argv[i] == '-d')
- {
- if (i+1 >= argc)
- printf("-d but missing directory?\r\n")
- if (argv[i+1][0] == '-')
- printf("-d with option after it?\r\n")
- fs_chdir(argv[i+1]);
- }
- }
- string log, text;
- FILE *pipe;
- pipe = _popen("svn update 2>&1", "r");
- text = "";
- fileToString(text, pipe);
- _pclose(pipe);
- long revNo = getRevionNumber(text);
- log += text;
- pipe = _popen("make clean 2>&1", "r");
- fileToString(log, pipe);
- _pclose(pipe);
- pipe = _popen("make 2>&1", "r");
- fileToString(log, pipe);
- _pclose(pipe);
- printf("%s", log.c_str());
- ofstream fs;
- fs.open ("log.txt");
- fs << log;
- fs.close();
- //call upload media to server func
- //call upload binary to server func (along with logs)
- //call update rss func
- return 0;
- }
- #include "../dm/filesystem_win32.c"
Add Comment
Please, Sign In to add comment