0

I pretty much got my assignment working except for one part, I need to reverse the output if the user enters "-r" in the command line. Can anyone help me with this?

EDIT: By reverse I mean list the last child first down to the original process.

int j = strcmp( argv[2] , "-r" );
if ( j == 0 ){
	 printf("if statement entered\n");
   	 for( c = 0; c < depth; c++ ){
	
		if((fork())== 0)
   	       printf( "Process %d reporting; parent is %d\n", getpid(), getppid() );
  	     else{
		   wait();
		   exit(0);
		}
  	  }		

    }
1
Contributor
1
Reply
3
Views
8 Years
Discussion Span
Last Post by DeadJustice
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.