printstatus.c
void print_status_info(struct cmd* cmd) {

	if (strlen(cmd->scmd) == 0
		&& cmd->type != PIPE)
		return;
	
	if (cmd->type == PIPE) {

		fprintf(stdout, "%s	Command: [", COLOR_BLUE);
		
		print_pipe_info(cmd);
		
		fprintf(stdout, "] done %s\n", COLOR_RESET);
	
		// Sets global variable 'status'
		status = WEXITSTATUS(status);

		return;
	}

	if (WIFEXITED(status)) {

		fprintf(stdout, "%s	Program: [%s] exited, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, WEXITSTATUS(status), COLOR_RESET);
		status = WEXITSTATUS(status);

	} else if (WIFSIGNALED(status)) {

		fprintf(stdout, "%s	Program: [%s] killed, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, -WTERMSIG(status), COLOR_RESET);
		status = -WTERMSIG(status);

	} else if (WTERMSIG(status)) {

		fprintf(stdout, "%s	Program: [%s] stopped, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, -WSTOPSIG(status), COLOR_RESET);
		status = -WSTOPSIG(status);
	}
}
// prints information of process' status
prints information of process' status
prints information of process ' status
void print_status_info(struct cmd* cmd) {
	if (strlen(cmd->scmd) == 0
		&& cmd->type != PIPE)
		return;
	if (cmd->type == PIPE) {
		fprintf(stdout, "%s	Command: [", COLOR_BLUE);
		print_pipe_info(cmd);
		fprintf(stdout, "] done %s\n", COLOR_RESET);
		status = WEXITSTATUS(status);
		return;
	}
	if (WIFEXITED(status)) {
		fprintf(stdout, "%s	Program: [%s] exited, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, WEXITSTATUS(status), COLOR_RESET);
		status = WEXITSTATUS(status);
	} else if (WIFSIGNALED(status)) {
		fprintf(stdout, "%s	Program: [%s] killed, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, -WTERMSIG(status), COLOR_RESET);
		status = -WTERMSIG(status);
	} else if (WTERMSIG(status)) {
		fprintf(stdout, "%s	Program: [%s] stopped, status: %d %s\n",
			COLOR_BLUE, cmd->scmd, -WSTOPSIG(status), COLOR_RESET);
		status = -WSTOPSIG(status);
	}
}
void print_status_info ( struct cmd * cmd ) { if ( strlen ( cmd -> scmd ) == 0 && cmd -> type != PIPE ) return ; if ( cmd -> type == PIPE ) { fprintf ( stdout , " " , COLOR_BLUE ) ; print_pipe_info ( cmd ) ; fprintf ( stdout , " \n " , COLOR_RESET ) ; status = WEXITSTATUS ( status ) ; return ; } if ( WIFEXITED ( status ) ) { fprintf ( stdout , " \n " , COLOR_BLUE , cmd -> scmd , WEXITSTATUS ( status ) , COLOR_RESET ) ; status = WEXITSTATUS ( status ) ; } else if ( WIFSIGNALED ( status ) ) { fprintf ( stdout , " \n " , COLOR_BLUE , cmd -> scmd , - WTERMSIG ( status ) , COLOR_RESET ) ; status = - WTERMSIG ( status ) ; } else if ( WTERMSIG ( status ) ) { fprintf ( stdout , " \n " , COLOR_BLUE , cmd -> scmd , - WSTOPSIG ( status ) , COLOR_RESET ) ; status = - WSTOPSIG ( status ) ; } }
prints information of process' status
prints information of process ' status
// Sets global variable 'status'