Annotation of OpenXM/src/util/ox_pathfinder.c, Revision 1.1
1.1 ! takayama 1: /* $OpenXM$ */
! 2: /* Moved from misc-2003/07/cygwin/test.c */
! 3: #include <stdio.h>
! 4: #include <sys/types.h>
! 5: #include <sys/stat.h>
! 6: #include <fcntl.h>
! 7: #include <stdlib.h>
! 8: #include <unistd.h>
! 9: #include <sys/wait.h>
! 10: #include <signal.h>
! 11: #include <ctype.h>
! 12: #include "ox_pathfinder.h"
! 13:
! 14: extern char **environ;
! 15:
! 16: static int getOStypei();
! 17: static char *addSlash();
! 18: static char *get_sm1_lib_path();
! 19: static char *get_k0_lib_path();
! 20: static char *get_ox_asir_path();
! 21: static char *get_ox_sm1_path();
! 22: static char *get_ox_path();
! 23: static char *get_oxc_path();
! 24: static char *get_oxlog_path();
! 25: static char **setOXenv();
! 26: static int forkExec(char **argv);
! 27: static void usage();
! 28:
! 29:
! 30: static int Verbose_get_home = 1;
! 31: static int NoX = 0;
! 32:
! 33: #define MYFORKCP_SIZE 100
! 34: static int Myforkchildren[MYFORKCP_SIZE];
! 35: static int Myforkcp=0;
! 36: static void myforkwait() {
! 37: int status;
! 38: int pid;
! 39: int i,j;
! 40: signal(SIGCHLD,SIG_IGN);
! 41: pid = wait(&status);
! 42: fprintf(stderr,"Child process %d is exiting.\n",pid);
! 43: for (i=0; i<Myforkcp; i++) {
! 44: if (Myforkchildren[i] == pid) {
! 45: for (j=i; j<Myforkcp-1; j++) {
! 46: Myforkchildren[j] = Myforkchildren[j+1];
! 47: }
! 48: if (Myforkcp > 0) Myforkcp--;
! 49: }
! 50: }
! 51: signal(SIGCHLD,myforkwait);
! 52: }
! 53:
! 54: #define nomemory(a) {fprintf(stderr,"(%d) no more memory.\n",a);exit(10);}
! 55: #define mymalloc(a) malloc(a)
! 56:
! 57: /* See kxx/ox100start.c for main. */
! 58:
! 59: static int forkExec(char **argv) {
! 60: int pid;
! 61: char **eee;
! 62: int m;
! 63: m = 0;
! 64: if (argv == NULL) {
! 65: fprintf(stderr,"Cannot fork and exec.\n"); return -1;
! 66: }
! 67: if ((pid = fork()) > 0) {
! 68: if (m&2) {
! 69: /* Do not call singal to turn around a trouble on cygwin. BUG. */
! 70: }else{
! 71: signal(SIGCHLD,myforkwait); /* to kill Zombie */
! 72: }
! 73: Myforkchildren[Myforkcp++] = pid;
! 74: if (Myforkcp >= MYFORKCP_SIZE-1) {
! 75: fprintf(stderr,"Child process table is full.\n");
! 76: Myforkcp = 0;
! 77: }
! 78: }else{
! 79: /* close the specified files */
! 80: if (m&1) {
! 81: sigset_t sss;
! 82: sigemptyset(&sss);
! 83: sigaddset(&sss,SIGINT);
! 84: sigprocmask(SIG_BLOCK,&sss,NULL);
! 85: }
! 86: eee = setOXenv();
! 87: if (NoX) {
! 88: FILE *null;
! 89: null = fopen("/dev/null","wb");
! 90: dup2(fileno(null),1);
! 91: dup2(fileno(null),2);
! 92: }
! 93: execve(argv[0],argv,environ);
! 94: /* This place will never be reached unless execv fails. */
! 95: fprintf(stderr,"forkExec fails: ");
! 96: }
! 97: }
! 98:
! 99: static int getOStypei() {
! 100: /*
! 101: 0 unix
! 102: 1 windows-cygwin
! 103: 2 windows-cygwin-on-X
! 104: 3 windows-native
! 105: */
! 106: int ostype;
! 107: char *s,*s2,*s3;
! 108: #if defined(__CYGWIN__)
! 109: ostype = 1;
! 110: #else
! 111: ostype = 0;
! 112: #endif
! 113: if (ostype == 0) return ostype;
! 114: /* Heuristic method */
! 115: s = (char *)getenv("WINDOWID");
! 116: if (s != NULL) {
! 117: return 2;
! 118: }
! 119: s = (char *)getenv("OSTYPE");
! 120: s2 = (char *)getenv("MACHTYPE");
! 121: s3 = (char *)getenv("PWD");
! 122: if ((s != NULL) || (s2 != NULL) || (s3 != NULL)) {
! 123: return 1;
! 124: }
! 125: return 3;
! 126: }
! 127:
! 128: char *getOStypes() {
! 129: int ostype;
! 130: ostype = getOStypei();
! 131:
! 132: if (ostype == 1) {
! 133: return("Windows-cygwin");
! 134: }else if (ostype == 2) {
! 135: return("Windows-cygwin-on-X");
! 136: }else if (ostype == 3) {
! 137: return("Windows-native");
! 138: }else{
! 139: return("unix");
! 140: }
! 141: }
! 142:
! 143: /*
! 144: kan96xx/Kan/ext.c
! 145: */
! 146: /*
! 147: -1 : no file
! 148: non-negative: there is a regular file or a directory
! 149: */
! 150: static int getFileSize(char *s) {
! 151: struct stat buf;
! 152: int m;
! 153: if (s == NULL) return -1;
! 154: m = stat(s,&buf);
! 155: if (m == -1) {
! 156: return -1;
! 157: /* fail */
! 158: }else{
! 159: /* success */
! 160: return (int) buf.st_size;
! 161: }
! 162: }
! 163:
! 164: static char *addSlash(char *p) {
! 165: char *p2;
! 166: if ((strlen(p) == 0) || (p == NULL)) return(p);
! 167: if (p[strlen(p)-1] == '/') return(p);
! 168: /* Add / */
! 169: p2 = (char *) mymalloc(sizeof(char)*(strlen(p)+3));
! 170: if (p2 == NULL) { fprintf(stderr,"No more memory.\n"); exit(10); }
! 171: strcpy(p2,p); strcat(p2,"/");
! 172: return(p2);
! 173:
! 174: }
! 175:
! 176: static void msg_get_home(int t,char *s) {
! 177: extern int Verbose_get_home;
! 178: if (!Verbose_get_home) return;
! 179: if (t == 1) {
! 180: fprintf(stderr,"getOpenXM_HOME(): ");
! 181: }else if (t == 2) {
! 182: fprintf(stderr,"getServerEnv(): ");
! 183: }else if (t == 3) {
! 184: fprintf(stderr,"setOXenv(): ");
! 185: }else if (t == 4) {
! 186: fprintf(stderr,"cygwinPathToWinPath(): ");
! 187: }else if (t == 5) {
! 188: fprintf(stderr,"catArgv(): ");
! 189: }else{
! 190: fprintf(stderr,"getting path...: ");
! 191: }
! 192: if (s != NULL) {
! 193: fprintf(stderr,"%s\n",s);
! 194: }else{
! 195: fprintf(stderr," --NULL-- \n");
! 196: }
! 197: }
! 198: /* cf. k097/d.c getLOAD_K_PATH();
! 199: kan96xx/Kan/scanner.c getLOAD_SM1_PATH();
! 200: */
! 201: char *getOpenXM_HOME() {
! 202: char *p;
! 203: char *h;
! 204: p = getOStypes();
! 205: msg_get_home(1,p);
! 206:
! 207: p = (char *) getenv("OpenXM_HOME");
! 208: if (getFileSize(p) != -1) return addSlash(p);
! 209: msg_get_home(1,"OpenXM_HOME is not found.");
! 210:
! 211: p = (char *) getenv("OPENXM_HOME");
! 212: if (getFileSize(p) != -1) return addSlash(p);
! 213: msg_get_home(1,"OPENXM_HOME is not found.");
! 214:
! 215: if (getOStypei() == 3) { /* cygwin-native */
! 216: p = (char *) getenv("OpenXM_HOME_WIN");
! 217: if (getFileSize(p) != -1) return addSlash(p);
! 218: msg_get_home(1,"OpenXM_HOME_WIN is not found.");
! 219:
! 220: p = (char *) getenv("OPENXMHOMEWIN");
! 221: if (getFileSize(p) != -1) return addSlash(p);
! 222: msg_get_home(1,"OPENXMHOMEWIN is not found.");
! 223: }
! 224:
! 225: /* Try to find default directories */
! 226: h = (char *)getenv("HOME");
! 227: if (h != NULL) {
! 228: p = (char *)mymalloc(strlen(h)+100);
! 229: if (p == NULL) {
! 230: fprintf(stderr,"No more memory.\n"); exit(100);
! 231: }
! 232: strcat(h,"/OpenXM");
! 233: p = h;
! 234: if (getFileSize(p) != -1) return addSlash(p);
! 235: msg_get_home(1,"OpenXM is not found under the home directory.");
! 236: }
! 237:
! 238: if (getOStypei() != 3) {
! 239: p = "/usr/local/OpenXM";
! 240: }else{
! 241: p = "/cygdrive/c/usr/local/OpenXM";
! 242: }
! 243: if (getFileSize(p) != -1) return addSlash(p);
! 244: msg_get_home(1,"OpenXM is not found under /usr/local");
! 245:
! 246: if (getOStypei() != 0) {
! 247: p = "/cygdrive/c/OpenXM";
! 248: if (getFileSize(p) != -1) return addSlash(p);
! 249: msg_get_home(1,"OpenXM is not found under c:\\");
! 250:
! 251: p = "/cygdrive/c/OpenXM-win";
! 252: if (getFileSize(p) != -1) return addSlash(p);
! 253: msg_get_home(1,"OpenXM-win is not found under c:\\");
! 254:
! 255: p = "/cygdrive/c/Program Files/OpenXM";
! 256: if (getFileSize(p) != -1) return addSlash(p);
! 257: msg_get_home(1,"OpenXM is not found under c:\\Program Files");
! 258:
! 259: p = "/cygdrive/c/Program Files/OpenXM-win";
! 260: if (getFileSize(p) != -1) return addSlash(p);
! 261: msg_get_home(1,"OpenXM-win is not found under c:\\Program Files");
! 262:
! 263: }
! 264:
! 265: msg_get_home(1,"Giving up!");
! 266: return NULL;
! 267:
! 268: }
! 269:
! 270: static char *get_k0_lib_path() {
! 271: char *oxhome;
! 272: char *p;
! 273:
! 274:
! 275: p = (char *)getenv("LOAD_K_PATH");
! 276: if (p != NULL) {
! 277: if (getFileSize(p) != -1) return addSlash(p);
! 278: msg_get_home(1,"LOAD_K0_PATH is not found.");
! 279: }
! 280:
! 281: oxhome = getOpenXM_HOME();
! 282: if (oxhome == NULL) return (char *)NULL;
! 283: p = (char *) mymalloc(strlen(oxhome)+100);
! 284: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 285:
! 286: strcpy(p,oxhome);
! 287: strcat(p,"lib/k097");
! 288: if (getFileSize(p) != -1) return addSlash(p);
! 289: msg_get_home(1,oxhome);
! 290: msg_get_home(1," is found, but ");
! 291: msg_get_home(1,p);
! 292: msg_get_home(1," is not found.");
! 293:
! 294: msg_get_home(1,"Giving up!");
! 295: return NULL;
! 296: }
! 297:
! 298: static char *get_sm1_lib_path() {
! 299: char *oxhome;
! 300: char *p;
! 301:
! 302: p = (char *)getenv("LOAD_SM1_PATH");
! 303: if (p != NULL) {
! 304: if (getFileSize(p) != -1) return addSlash(p);
! 305: msg_get_home(1,"LOAD_SM1_PATH is not found.");
! 306: }
! 307:
! 308: oxhome = getOpenXM_HOME();
! 309: if (oxhome == NULL) return NULL;
! 310: p = (char *) mymalloc(strlen(oxhome)+100);
! 311: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 312:
! 313: strcpy(p,oxhome);
! 314: strcat(p,"lib/sm1");
! 315: if (getFileSize(p) != -1) return addSlash(p);
! 316: msg_get_home(1,oxhome);
! 317: msg_get_home(1," is found, but ");
! 318: msg_get_home(1,p);
! 319: msg_get_home(1," is not found.");
! 320:
! 321: msg_get_home(1,"Giving up!");
! 322: return NULL;
! 323: }
! 324:
! 325: static char *get_ox_asir_path() {
! 326: char *oxhome;
! 327: char *p;
! 328:
! 329: oxhome = getOpenXM_HOME();
! 330: if (oxhome == NULL) return NULL;
! 331: p = (char *) mymalloc(strlen(oxhome)+100);
! 332: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 333:
! 334: strcpy(p,oxhome);
! 335: strcat(p,"bin/ox_asir");
! 336: if (getFileSize(p) != -1) return p;
! 337: msg_get_home(1,oxhome);
! 338: msg_get_home(1," is found, but ");
! 339: msg_get_home(1,p);
! 340: msg_get_home(1," is not found.");
! 341:
! 342: strcpy(p,oxhome);
! 343: strcat(p,"lib/asir/ox_asir");
! 344: if (getFileSize(p) != -1) return p;
! 345: msg_get_home(1,oxhome);
! 346: msg_get_home(1," is found, but ");
! 347: msg_get_home(1,p);
! 348: msg_get_home(1," is not found.");
! 349:
! 350: msg_get_home(1,"Giving up!");
! 351: return NULL;
! 352: }
! 353:
! 354: static char *get_ox_path() {
! 355: char *oxhome;
! 356: char *p;
! 357:
! 358: oxhome = getOpenXM_HOME();
! 359: if (oxhome == NULL) return NULL;
! 360: p = (char *) mymalloc(strlen(oxhome)+100);
! 361: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 362:
! 363: strcpy(p,oxhome);
! 364: strcat(p,"bin/ox");
! 365: if (getFileSize(p) != -1) return p;
! 366: msg_get_home(1,oxhome);
! 367: msg_get_home(1," is found, but ");
! 368: msg_get_home(1,p);
! 369: msg_get_home(1," is not found.");
! 370:
! 371: msg_get_home(1,"Giving up!");
! 372: return NULL;
! 373: }
! 374:
! 375:
! 376: static char *get_oxc_path() {
! 377: char *oxhome;
! 378: char *p;
! 379:
! 380: oxhome = getOpenXM_HOME();
! 381: if (oxhome == NULL) return NULL;
! 382: p = (char *) mymalloc(strlen(oxhome)+100);
! 383: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 384:
! 385: strcpy(p,oxhome);
! 386: strcat(p,"bin/oxc");
! 387: if (getFileSize(p) != -1) return p;
! 388: msg_get_home(1,oxhome);
! 389: msg_get_home(1," is found, but ");
! 390: msg_get_home(1,p);
! 391: msg_get_home(1," is not found.");
! 392:
! 393: msg_get_home(1,"Giving up!");
! 394: return NULL;
! 395: }
! 396:
! 397: static char *get_oxlog_path() {
! 398: char *oxhome;
! 399: char *p;
! 400:
! 401: oxhome = getOpenXM_HOME();
! 402: if (oxhome == NULL) return NULL;
! 403: p = (char *) mymalloc(strlen(oxhome)+100);
! 404: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 405:
! 406: strcpy(p,oxhome);
! 407: strcat(p,"bin/oxlog");
! 408: if (getFileSize(p) != -1) return p;
! 409: msg_get_home(1,oxhome);
! 410: msg_get_home(1," is found, but ");
! 411: msg_get_home(1,p);
! 412: msg_get_home(1," is not found.");
! 413:
! 414: msg_get_home(1,"Giving up!");
! 415: return NULL;
! 416: }
! 417:
! 418: char *cygwinPathToWinPath(char *s) {
! 419: char *pos;
! 420: char *ans;
! 421: int i;
! 422: msg_get_home(4,s);
! 423: if (s == NULL) return NULL;
! 424: if (strlen(s) == 0) return s;
! 425:
! 426: ans = (char *) mymalloc(strlen(s) + 32);
! 427: if (ans == NULL) nomemory(0);
! 428:
! 429: pos = (char *)strstr(s,"/cygdrive/");
! 430: if (pos == s) {
! 431: strcpy(ans,&(s[9]));
! 432: ans[0] = s[10]; ans[1] = ':'; ans[2] = '\\';
! 433: }else{
! 434: strcpy(ans,s);
! 435: }
! 436:
! 437: if (ans[0] == '/') {
! 438: strcpy(ans,"C:\\cygwin");
! 439: strcat(ans,s);
! 440: }
! 441:
! 442:
! 443: for (i=0; i <strlen(ans); i++) {
! 444: if (ans[i] == '/') ans[i] = '\\';
! 445: }
! 446: return ans;
! 447: }
! 448:
! 449: char **getServerEnv(char *oxServer) {
! 450: int ostype;
! 451: char *p;
! 452: char *oxhome;
! 453: char *xterm;
! 454: char *oxlog;
! 455: char *load_sm1_path;
! 456: char *load_k0_path;
! 457: char *openXM_HOME;
! 458: #define ARGV_SIZE 100
! 459: char *argv[ARGV_SIZE];
! 460: int i,k;
! 461: char **aaa;
! 462:
! 463: if (Verbose_get_home) {
! 464: if (oxServer == NULL) {
! 465: fprintf(stderr,"Server name is NULL.\n");
! 466: }else{
! 467: fprintf(stderr,"Server name is %s\n",oxServer);
! 468: }
! 469: }
! 470:
! 471: if (oxServer == NULL) return NULL;
! 472: i = 0;
! 473: argv[i] = NULL;
! 474:
! 475: ostype = getOStypei();
! 476:
! 477: oxhome = getOpenXM_HOME();
! 478: if (oxhome == NULL) return NULL;
! 479: p = (char *) mymalloc(strlen(oxhome)+strlen(oxServer)+100);
! 480: if (p == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 481:
! 482: strcpy(p,oxhome);
! 483: strcat(p,oxServer);
! 484: if (getFileSize(p) == -1) {
! 485: msg_get_home(2,oxhome);
! 486: msg_get_home(2," is found, but ");
! 487: msg_get_home(2,p);
! 488: msg_get_home(2," is not found.");
! 489: return (NULL);
! 490: }
! 491: oxServer = (char *) mymalloc(strlen(oxhome)+strlen(oxServer)+100);
! 492: if (oxServer == NULL) {fprintf(stderr,"No more memory.\n"); exit(100);}
! 493: strcpy(oxServer,p);
! 494:
! 495: if ((ostype == 0) || (ostype == 2)) {
! 496: if (!NoX) {
! 497: xterm = "/usr/X11R6/bin/xterm";
! 498: if (getFileSize(xterm) == -1) {
! 499: msg_get_home(2,"xterm is not found. NoX is automatically set.");
! 500: NoX = 1;
! 501: }
! 502: }
! 503: oxlog = get_oxlog_path();
! 504: xterm = "/usr/X11R6/bin/xterm -icon -e ";
! 505: argv[i] = oxlog; i++; argv[i] = NULL;
! 506: if (!NoX) {
! 507: argv[i] = "/usr/X11R6/bin/xterm"; i++; argv[i] = NULL;
! 508: argv[i] = "-icon"; i++; argv[i] = NULL;
! 509: argv[i] = "-e"; i++; argv[i] = NULL;
! 510: }
! 511: argv[i] = get_ox_path(); i++; argv[i] = NULL;
! 512: argv[i] = "-ox"; i++; argv[i] = NULL;
! 513: argv[i] = oxServer; i++; argv[i] = NULL;
! 514: }else{
! 515: if (!NoX) {
! 516: if (getFileSize("/cygdrive/c/winnt/system32/cmd.exe") >= 0) {
! 517: xterm = "/cygdrive/c/winnt/system32/cmd.exe /c start /min ";
! 518: argv[i] = "/cygdrive/c/winnt/system32/cmd.exe"; i++; argv[i] = NULL;
! 519: }else if (getFileSize("/cygdrive/c/windows/system32/cmd.exe") >= 0) {
! 520: xterm = "/cygdrive/c/windows/system32/cmd.exe /c start /min ";
! 521: argv[i] = "/cygdrive/c/windows/system32/cmd.exe"; i++; argv[i] = NULL;
! 522: }else{
! 523: msg_get_home(2,"cmd.exe is not found. NoX is automatically set.");
! 524: NoX = 1;
! 525: }
! 526: }
! 527: oxlog = " ";
! 528: if (!NoX) {
! 529: argv[i] = "/c"; i++; argv[i] = NULL;
! 530: argv[i] = "start"; i++; argv[i] = NULL;
! 531: argv[i] = "/min"; i++; argv[i] = NULL;
! 532: }
! 533: argv[i] = cygwinPathToWinPath(get_ox_path()); i++; argv[i] = NULL;
! 534: argv[i] = "-ox"; i++; argv[i] = NULL;
! 535: argv[i] = oxServer; i++; argv[i] = NULL;
! 536: }
! 537:
! 538: aaa = (char **) mymalloc(sizeof(char*)*(i+1));
! 539: if (aaa == NULL) nomemory(0);
! 540: msg_get_home(2,"--------- Result --------------");
! 541: for (k=0; k<i; k++) {
! 542: aaa[k] = argv[k];
! 543: msg_get_home(2,aaa[k]);
! 544: aaa[k+1] = NULL;
! 545: }
! 546: return aaa;
! 547: }
! 548:
! 549: char **setOXenv() {
! 550: /* Do nothing. */
! 551: return NULL;
! 552: }
! 553: char **setOXenv_old() {
! 554: char *openXM_HOME;
! 555: char *load_sm1_path;
! 556: char *load_k0_path;
! 557: char *asir_config;
! 558: char *asir_libdir;
! 559: char *asirloadpath;
! 560: char *asir_rsh;
! 561: char *ld_library_path;
! 562: char **aaa;
! 563: int n,i,k;
! 564:
! 565: /* set environmental variables */
! 566: n = 20; /* n must be larger than the number of env vars */
! 567: n++;
! 568: load_sm1_path = (char *) getenv("LOAD_SM1_PATH");
! 569: load_k0_path = (char *) getenv("LOAD_SM1_PATH");
! 570: asir_config = (char *) getenv("ASIR_CONFIG");
! 571: asir_libdir = (char *) getenv("ASIR_LIBDIR");
! 572: asirloadpath = (char *) getenv("ASIRLOADPATH");
! 573: asir_rsh = (char *) getenv("ASIR_RSH");
! 574: ld_library_path = (char *) getenv("LD_LIBRARY_PATH");
! 575:
! 576: openXM_HOME = getOpenXM_HOME();
! 577: if (openXM_HOME != NULL)
! 578: openXM_HOME[strlen(openXM_HOME)-1] = '\0';
! 579: /* How about ASIR... ? */
! 580:
! 581: msg_get_home(3,"OpenXM_HOME is"); msg_get_home(2,openXM_HOME);
! 582: msg_get_home(3,"LOAD_SM1_PATH is"); msg_get_home(2,load_sm1_path);
! 583: msg_get_home(3,"LOAD_K0_PATH is"); msg_get_home(2,load_k0_path);
! 584:
! 585: aaa = (char **) mymalloc(sizeof(char*)*n);
! 586: if (aaa == NULL) nomemory(0);
! 587:
! 588: i = 0;
! 589: if (openXM_HOME != NULL) {
! 590: aaa[i] = openXM_HOME; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 591: }
! 592: if (load_sm1_path != NULL) {
! 593: aaa[i] = load_sm1_path; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 594: }
! 595: if (load_k0_path != NULL) {
! 596: aaa[i] = load_k0_path; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 597: }
! 598: if (asir_config != NULL) {
! 599: aaa[i] = asir_config; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 600: }
! 601: if (asir_libdir != NULL) {
! 602: aaa[i] = asir_libdir; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 603: }
! 604: if (asirloadpath != NULL) {
! 605: aaa[i] = asirloadpath; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 606: }
! 607: if (asir_rsh != NULL) {
! 608: aaa[i] = asir_rsh; i++; aaa[i] = NULL; if (i > n-2) return aaa;
! 609: }
! 610:
! 611: msg_get_home(3,"--------- Result --------------");
! 612: for (k=0; k<n; k++) {
! 613: if (aaa[k] == NULL) break;
! 614: msg_get_home(3,aaa[k]);
! 615: }
! 616:
! 617: return aaa;
! 618: }
! 619:
! 620: char **debugServerEnv(char *oxServer)
! 621: {
! 622: int t;
! 623: char **aaa;
! 624: t = Verbose_get_home;
! 625: Verbose_get_home = 1;
! 626: aaa = getServerEnv(oxServer);
! 627: Verbose_get_home = t;
! 628: return ( aaa );
! 629: }
! 630:
! 631: char **catArgv(char **argv1,char **argv2)
! 632: {
! 633: int i,n1,n2;
! 634: char **argv;
! 635: n1=0;
! 636: while (argv1[n1] != NULL) n1++;
! 637: n2=0;
! 638: while (argv2[n2] != NULL) n2++;
! 639: argv = (char **) mymalloc(sizeof(char *)*(n1+n2+1));
! 640: if (argv == NULL) nomemory(0);
! 641: for (i=0; i<n1; i++) argv[i] = argv1[i];
! 642: for (i=0; i<n2; i++) argv[n1+i] = argv2[i];
! 643: argv[n1+n2]=NULL;
! 644: for (i=0; i<n1+n2; i++) {
! 645: msg_get_home(5,argv[i]);
! 646: }
! 647: return argv;
! 648: }
! 649:
! 650: char *getLOAD_SM1_PATH2() {
! 651: char *p;
! 652: p = get_sm1_lib_path();
! 653: if (p == NULL) {
! 654: return("/usr/local/lib/sm1/");
! 655: }else{
! 656: return p;
! 657: }
! 658: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>