[BACK]Return to oxlog.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Annotation of OpenXM/src/kxx/oxlog.c, Revision 1.2

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);
1.2     ! takayama   62:   }else if (argc == 16) {
        !            63:     execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
        !            64:          argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],NULL);
        !            65:   }else if (argc == 17) {
        !            66:     execl(argv[1],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],
        !            67:          argv[7],argv[8],argv[9],argv[10],argv[11], argv[12],argv[13],argv[14],argv[15],argv[16],NULL);
1.1       maekawa    68:   }else {
                     69:     fprintf(stderr,"Error in oxlog: cannot handle argc=%d\n",argc);
                     70:     for (i=0; i<argc; i++) {
                     71:       fprintf(stderr,"argv[%d]=%s ",i,argv[i]);
                     72:     }
                     73:     fprintf(stderr,"\n");
                     74:     fprintf(stderr,"Usage example 1: oxlog /usr/X11R6/bin/xterm -icon -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir\n");
                     75:     fprintf(stderr,"      example 2: oxlog /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_asir >& /dev/null\n");
                     76:     exit(10);
                     77:   }
                     78:   fprintf(stderr,"\nError in oxlog: Failed to start the process.\n");
                     79:   for (i=0; i<argc; i++) {
                     80:     fprintf(stderr,"argv[%d]=%s ",i,argv[i]);
                     81:   }
                     82:   fprintf(stderr,"\n");
                     83:   exit(20);
                     84: }
                     85: mainold1() {
                     86:   sigset_t sss;
                     87:   int i;
                     88:   /* char *env[2];
                     89:   env[0] = NULL;*/
                     90:   sigemptyset(&sss);
                     91:   sigaddset(&sss,SIGINT);
                     92:   sigprocmask(SIG_BLOCK,&sss,NULL);
                     93:   /* for (i=0; i<1000; i++) {
                     94:      sleep(1);
                     95:      printf("Hello\n");
                     96:      }
                     97:      exit(0); */
                     98:   execl("/usr/X11R6/bin/xterm","/usr/X11R6/bin/xterm",
                     99:        "-e","/home/nobuki/kxx/ox","-ox","/home/nobuki/kxx/ox_asir",NULL);
                    100: /*  execl("/home/nobuki/kxx/ox","/home/nobuki/kxx/ox","-ox","/home/nobuki/kxx/ox_asir",NULL);*/
                    101: }
                    102:

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>