Back to index

lightning-sunbird  0.9+nobinonly
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 "gcconfig.h"
00004 # include <stdio.h>
00005 
00006 int main(argc, argv, envp)
00007 int argc;
00008 char ** argv;
00009 char ** envp;
00010 {
00011     if (argc < 4) goto Usage;
00012     if (strcmp(MACH_TYPE, argv[1]) != 0) return(0);
00013     if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0
00014         && strcmp(OS_TYPE, argv[2]) != 0) return(0);
00015     printf("^^^^Starting command^^^^\n");
00016     execvp(argv[3], argv+3);
00017     perror("Couldn't execute");
00018     
00019 Usage:
00020     fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]);
00021     fprintf(stderr, "Currently mach_type = %s, os_type = %s\n",
00022            MACH_TYPE, OS_TYPE);
00023     return(1);
00024 }
00025