1987-03-09 16:02:32 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1985-02-15 14:20:04 +00:00
|
|
|
char rcs_id[] = "$Header$" ;
|
|
|
|
|
1985-02-06 21:25:27 +00:00
|
|
|
main(argc,argv) char **argv ; {
|
|
|
|
int child, waitchild ;
|
|
|
|
int status ;
|
|
|
|
child=fork() ;
|
|
|
|
if ( child== -1 ) {
|
|
|
|
printf("fork returned -1\n") ;
|
|
|
|
return 1 ;
|
|
|
|
}
|
|
|
|
if ( child ) {
|
|
|
|
/* The parent */
|
1989-11-20 14:35:23 +00:00
|
|
|
/* printf("childno %d\n",child ) ; */
|
1985-02-06 21:25:27 +00:00
|
|
|
do {
|
|
|
|
waitchild= wait(&status ) ;
|
1989-11-20 14:35:23 +00:00
|
|
|
/* printf("Child %d, status 0x%x\n",waitchild,status) ;*/
|
1985-02-06 21:25:27 +00:00
|
|
|
if ( waitchild== -1 ) {
|
|
|
|
printf("No children\n") ;
|
|
|
|
return 1 ;
|
|
|
|
}
|
|
|
|
} while ( waitchild!=child ) ;
|
|
|
|
if ( argc<=1 && status != (8<<8) ) {
|
|
|
|
printf("incorrect status return\n") ;
|
|
|
|
return 2 ;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* The child */
|
|
|
|
if ( argc>1 ) pause() ;
|
|
|
|
return 8 ;
|
|
|
|
}
|
|
|
|
printf("fork/wait ok\n") ;
|
|
|
|
return 0 ;
|
|
|
|
}
|