
/* process creation in unix          */
/* Examples using system call fork  */

#include "myhdr.h"

main()
{
  int retVal;

  printf(" Just one process so far\n");
  printf(" Calling fork() system call\n");

  retVal = fork();  /* create new process*/

  if (retVal == 0)
    { 
      printf(" I am the child \n");
      execl("/bin/ls", "ls", "-l", (char *)0);
      printf("exec failed \n");
    }
  else if (retVal > 0)
    {
      wait((int *)0);
      printf(" I am the parent, ls has been completed \n");
 
    }
  else
    printf(" Fork returned an error %d \n", retVal);
  return 0;
}
