1 #include <libgen.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <strings.h> 5 #include <unistd.h> 6 7 #include "execute.h" 8 9 /* globals */ 10 FILE* yyin; 11 char* yyfn; 12 int n_labels; 13 Label **route_labels; /* parent */ 14 Label **host_labels; /* child */ 15 Options current_options; 16 17 void usage(); 18 19 /* 20 * H = Process as a host file 21 * R = Process as route file 22 */ usage()23void usage() { 24 fprintf(stderr, "usage: ./which filename\n"); 25 exit(1); 26 } 27 main(int argc,char * argv[])28int main(int argc, char *argv[]) 29 { 30 char *prog; 31 char *found; 32 33 if (argc != 2) usage(); 34 prog = argv[1]; 35 found = findprog(prog); 36 printf("%s\n", found); 37 38 return 0; 39 } 40