Listing 3

/* all_true.c */
/* -----------*/
*/
    No matter what code the calling program returns, this
    program will always return 0 (success).
    
    Usage: all_true program args
    Example: all_true sleep 5

*/

#include <stdio.h>
#include <signal.h>

#define RET_VALUE        0

main(argc,argv)
int argc;
char **argv;
    {
    process(argc,argv);
    exit(RET_VALUE);
    }
    
process(argc,argv)
int argc;
char **argv;
    {
    int pid;
    
    if ((pid = fork()) == -1)
     {
        perror("all_true");
        exit(l);
     }
    
    if (pid > 0 )
     {
     signal(SIGINT,SIG_IGN); /* Ignore interrupt key */
        while (wait( (int *) 0 ) == pid);
        return;
     }
    
    signal(SIGINT,SIG_DFL);  /* Default interrupt key */
    argv++;                  /* Point to program argument */
    execvp(*argv, argv);
    perror("all_true");
    }