-/* $Id$
-
-This file is part of builder
-Copyright © 2006-2009 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#include <sys/wait.h>
#include <fcntl.h>
#include <cstdlib>
#include <cstring>
+#include <unistd.h>
#include <msp/io/print.h>
#include "misc.h"
string result;
- pid_t pid=fork();
+ pid_t pid = fork();
if(pid==0)
{
char *argv_[argv.size()+1];
- unsigned j=0;
+ unsigned j = 0;
for(StringList::const_iterator i=argv.begin(); i!=argv.end(); ++i)
- argv_[j++]=strdup(i->c_str());
- argv_[j]=0;
+ argv_[j++] = strdup(i->c_str());
+ argv_[j] = 0;
close(pfd[0]);
dup2(pfd[1], 1);
close(pfd[1]);
- int devnull=open("/dev/null", O_WRONLY);
+ int devnull = open("/dev/null", O_WRONLY);
dup2(devnull, 2);
close(devnull);
while(1)
{
char buf[1024];
- int len=read(pfd[0], buf, sizeof(buf));
+ int len = read(pfd[0], buf, sizeof(buf));
if(len<=0)
{
int s;
if(status)
{
if(WIFEXITED(s))
- *status=WEXITSTATUS(s);
+ *status = WEXITSTATUS(s);
else
- *status=-1;
+ *status = -1;
}
break;
}