Back to index

plt-scheme  4.2.1
if_mach.c
Go to the documentation of this file.
00001 /* Conditionally execute a command based on machine and OS from gcconfig.h */
00002 
00003 # include "private/gcconfig.h"
00004 # include <stdio.h>
00005 # include <string.h>
00006 # include <unistd.h>
00007 
00008 int main(argc, argv, envp)
00009 int argc;
00010 char ** argv;
00011 char ** envp;
00012 {
00013     if (argc < 4) goto Usage;
00014     if (strcmp(MACH_TYPE, argv[1]) != 0) return(0);
00015     if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0
00016         && strcmp(OS_TYPE, argv[2]) != 0) return(0);
00017     fprintf(stderr, "^^^^Starting command^^^^\n");
00018     fflush(stdout);
00019     execvp(argv[3], argv+3);
00020     perror("Couldn't execute");
00021     
00022 Usage:
00023     fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]);
00024     fprintf(stderr, "Currently mach_type = %s, os_type = %s\n",
00025            MACH_TYPE, OS_TYPE);
00026     return(1);
00027 }
00028