=================================================================== RCS file: /home/cvs/OpenXM/src/kxx/oxlog.c,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -p -r1.1.1.1 -r1.6 --- OpenXM/src/kxx/oxlog.c 1999/10/08 02:12:13 1.1.1.1 +++ OpenXM/src/kxx/oxlog.c 2000/02/09 12:02:56 1.6 @@ -1,5 +1,8 @@ +/*$OpenXM: OpenXM/src/kxx/oxlog.c,v 1.5 2000/01/19 03:13:40 takayama Exp $*/ #include #include +#include +#include #include #include #include @@ -18,49 +21,79 @@ -ox /home/nobuki/kxx/ox_asir >& /dev/null 2 3 */ +static int Debug_which = 1; +char *toFullPath(char *s); +char *which(char *s,char *env); main(int argc, char *argv[]) { sigset_t sss; int i; + char *oxname ="???"; /* char *env[2]; env[0] = NULL;*/ sigemptyset(&sss); sigaddset(&sss,SIGINT); sigprocmask(SIG_BLOCK,&sss,NULL); - - if (argc == 4) { - execl(argv[1],argv[1],argv[2],argv[3],NULL); + if (argc >= 2) { + oxname = argv[1]; + oxname = toFullPath(oxname); + } + if (argc == 2) { + execl(oxname,oxname,NULL); + }else if (argc == 3) { + execl(oxname,oxname,argv[2],NULL); + }else if (argc == 4) { + execl(oxname,oxname,argv[2],argv[3],NULL); }else if (argc == 5) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],NULL); + execl(oxname,oxname,argv[2],argv[3],argv[4],NULL); }else if (argc == 6) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],NULL); + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],NULL); }else if (argc == 7) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],NULL); + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6],NULL); }else if (argc == 8) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],NULL); }else if (argc == 9) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],NULL); }else if (argc == 10) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],NULL); }else if (argc == 11) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],argv[10],NULL); }else if (argc == 12) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],argv[10],argv[11],NULL); }else if (argc == 13) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],NULL); }else if (argc == 14) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],NULL); }else if (argc == 15) { - execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6], + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],NULL); + }else if (argc == 16) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],NULL); + }else if (argc == 17) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],NULL); + }else if (argc == 18) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],NULL); + }else if (argc == 19) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],NULL); + }else if (argc == 20) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19],NULL); + }else if (argc == 21) { + execl(oxname,oxname,argv[2],argv[3],argv[4],argv[5],argv[6], + argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],argv[17],argv[18],argv[19],argv[20],NULL); }else { fprintf(stderr,"Error in oxlog: cannot handle argc=%d\n",argc); + fprintf(stderr,"oxname=%s\n",oxname); for (i=0; i