Annotation of OpenXM/src/kxx/oxlog.c, Revision 1.1
1.1 ! maekawa 1: #include <stdio.h>
! 2: #include <signal.h>
! 3: #include <sys/types.h>
! 4: #include <sys/stat.h>
! 5: #include <fcntl.h>
! 6: /* In some distributions of linux you need to include the following file
! 7: #include <linux/sched.h>
! 8: */
! 9: #include <unistd.h>
! 10:
! 11: /* oxlog /usr/X11R6/bin/xterm -icon -e /home/nobuki/kxx/ox
! 12: 0 1 2 3 4
! 13: -ox /home/nobuki/kxx/ox_asir
! 14: 5 6
! 15: */
! 16: /* oxlog /home/nobuki/kxx/ox
! 17: 0 1
! 18: -ox /home/nobuki/kxx/ox_asir >& /dev/null
! 19: 2 3
! 20: */
! 21: main(int argc, char *argv[]) {
! 22: sigset_t sss;
! 23: int i;
! 24: /* char *env[2];
! 25: env[0] = NULL;*/
! 26: sigemptyset(&sss);
! 27: sigaddset(&sss,SIGINT);
! 28: sigprocmask(SIG_BLOCK,&sss,NULL);
! 29:
! 30: if (argc == 4) {
! 31: execl(argv[1],argv[1],argv[2],argv[3],NULL);
! 32: }else if (argc == 5) {
! 33: execl(argv[1],argv[1],argv[2],argv[3],argv[4],NULL);
! 34: }else if (argc == 6) {
! 35: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],NULL);
! 36: }else if (argc == 7) {
! 37: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],NULL);
! 38: }else if (argc == 8) {
! 39: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 40: argv[7],NULL);
! 41: }else if (argc == 9) {
! 42: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 43: argv[7],argv[8],NULL);
! 44: }else if (argc == 10) {
! 45: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 46: argv[7],argv[8],argv[9],NULL);
! 47: }else if (argc == 11) {
! 48: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 49: argv[7],argv[8],argv[9],argv[10],NULL);
! 50: }else if (argc == 12) {
! 51: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 52: argv[7],argv[8],argv[9],argv[10],argv[11],NULL);
! 53: }else if (argc == 13) {
! 54: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 55: argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],NULL);
! 56: }else if (argc == 14) {
! 57: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 58: argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],NULL);
! 59: }else if (argc == 15) {
! 60: execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
! 61: argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],NULL);
! 62: }else {
! 63: fprintf(stderr,"Error in oxlog: cannot handle argc=%d\n",argc);
! 64: for (i=0; i<argc; i++) {
! 65: fprintf(stderr,"argv[%d]=%s ",i,argv[i]);
! 66: }
! 67: fprintf(stderr,"\n");
! 68: fprintf(stderr,"Usage example 1: oxlog /usr/X11R6/bin/xterm -icon -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir\n");
! 69: fprintf(stderr," example 2: oxlog /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir >& /dev/null\n");
! 70: exit(10);
! 71: }
! 72: fprintf(stderr,"\nError in oxlog: Failed to start the process.\n");
! 73: for (i=0; i<argc; i++) {
! 74: fprintf(stderr,"argv[%d]=%s ",i,argv[i]);
! 75: }
! 76: fprintf(stderr,"\n");
! 77: exit(20);
! 78: }
! 79: mainold1() {
! 80: sigset_t sss;
! 81: int i;
! 82: /* char *env[2];
! 83: env[0] = NULL;*/
! 84: sigemptyset(&sss);
! 85: sigaddset(&sss,SIGINT);
! 86: sigprocmask(SIG_BLOCK,&sss,NULL);
! 87: /* for (i=0; i<1000; i++) {
! 88: sleep(1);
! 89: printf("Hello\n");
! 90: }
! 91: exit(0); */
! 92: execl("/usr/X11R6/bin/xterm","/usr/X11R6/bin/xterm",
! 93: "-e","/home/nobuki/kxx/ox","-ox","/home/nobuki/kxx/ox_asir",NULL);
! 94: /* execl("/home/nobuki/kxx/ox","/home/nobuki/kxx/ox","-ox","/home/nobuki/kxx/ox_asir",NULL);*/
! 95: }
! 96:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>