return 0;
int monitor(char *cmdname, int pid, int numfds, int *fds, int reexec, int quiet) {    struct pollfd *pfds;    char *buf=malloc(2048*sizeof(char));    int outpipe[2];    char *tmpstr=NULL;    int x,y,rc=-1;    int done=0;    int output=0;        pipe(outpipe);       pfds = malloc(numfds*sizeof(struct pollfd));    for (x=0;x<numfds;x++) {	pfds[x].fd = fds[x];	pfds[x].events = POLLIN | POLLPRI;    }	    while (!done) {       if ((x=poll(pfds,numfds,500))==-1) {	  perror("poll");	  return -1;       }       if (waitpid(pid,&rc,WNOHANG))	 done=1;       y=0;       while (y<numfds) {	  if ( x && ((pfds[y].revents & (POLLIN | POLLPRI)) )) {	     int bytesread = 0;	     	     do {		buf=calloc(2048,sizeof(char));		bytesread = read(pfds[y].fd,buf,2048);		if (bytesread==-1) {		   perror("read");		   return -1;		}		if (bytesread) {		  if (!quiet && !reexec)		    write(1,buf,bytesread);		  if (quiet) {		     output = 1;		     write(outpipe[1],buf,bytesread);		  }		  while ((tmpstr=getLine(&buf))) {		     if (!reexec) 		       logString(cmdname,tmpstr);		     else {			char **cmdargs=NULL;			char **tmpargs=NULL;			int cmdargc,x;						poptParseArgvString(tmpstr,&cmdargc,&tmpargs);			cmdargs=malloc( (cmdargc++) * sizeof(char *) );			cmdargs[0]=strdup("initlog");			for (x=0;x<(cmdargc-1);x++) {			   cmdargs[x+1]=tmpargs[x];			}			processArgs(cmdargc,cmdargs);		     }		  }		}	        	     } while ( bytesread==2048 );	  }	  y++;       }    }   rc = rc>>8;    if (!rc)      return 0;   else {      /* If there was an error and we're quiet, be loud */      int x;            if (quiet && output) {	 buf=calloc(2048,sizeof(char));	 do {	    x=read(outpipe[0],buf,2048);	    write(1,"\n",1);	    write(1,buf,x);	    buf=calloc(2048,sizeof(char));	 } while (x==2048);      }      return (rc);   }}