/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* Uses the perror function to display an error message.  */
#include <stdio.h>
#include <signal.h>
int delay = 1;
void childHandler();

int main()
{
   int pid;
   char *argv[3];
   
   argv[0]="-l";
   signal(SIGCHLD, childHandler);
   pid=fork();
   if(pid==0)
   {
      execvp("i",argv);
      perror("Error:");
   }
   else
   {
      sleep(delay);
      printf("Child %d exceeded limit and is being killed \n",pid);
      kill(pid, SIGINT);
   }
}

void childHandler()
{
   int childPid, childStatus;
   childPid=wait(&childStatus);
   printf("Child %d terminated within %d seconds \n", childPid, delay);
   exit(0);
}
   

