/[ascend]/trunk/tcltk/generic/interface/Driver.c
ViewVC logotype

Diff of /trunk/tcltk/generic/interface/Driver.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 587 by johnpye, Thu May 11 00:47:54 2006 UTC revision 588 by johnpye, Thu May 11 02:06:46 2006 UTC
# Line 35  Line 35 
35  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
36  #include <general/ospath.h>  #include <general/ospath.h>
37  #include <utilities/ascPrint.h>  #include <utilities/ascPrint.h>
38    #include <utilities/error.h>
39    
40  #ifndef __WIN32__  #ifndef __WIN32__
41  # include <unistd.h>  # include <unistd.h>
# Line 480  int AscDriver(int argc, CONST char *argv Line 481  int AscDriver(int argc, CONST char *argv
481      variable.      variable.
482  */  */
483  #define OSPATH_PUTENV(VAR,FP) \  #define OSPATH_PUTENV(VAR,FP) \
484      snprintf(envcmd,MAX_ENV_VAR_LENGTH,"%s=",VAR); \      CONSOLE_DEBUG("VAR: %s",VAR); \
485        sprintf(envcmd,"%s=",VAR); \
486      ospath_strcat(FP,envcmd,MAX_ENV_VAR_LENGTH); \      ospath_strcat(FP,envcmd,MAX_ENV_VAR_LENGTH); \
487        CONSOLE_DEBUG("ENVCMD: %s",envcmd); \
488      PUTENV(envcmd)      PUTENV(envcmd)
489    
490  /**  /**
# Line 508  int AscDriver(int argc, CONST char *argv Line 511  int AscDriver(int argc, CONST char *argv
511      Tcl_SetVar2(interp,#ARR,KEY,Tcl_DStringValue(&buffer),TCL_GLOBAL_ONLY); \      Tcl_SetVar2(interp,#ARR,KEY,Tcl_DStringValue(&buffer),TCL_GLOBAL_ONLY); \
512      Tcl_DStringFree(&buffer);      Tcl_DStringFree(&buffer);
513    
514    static void printenv(){
515        int n;
516        char **l;
517        l = Asc_EnvNames(&n);
518        CONSOLE_DEBUG("VARS = %d",n);
519    }
520    
521  /**  /**
522      Ensure that all required environment variables are present      Ensure that all required environment variables are present
523      and set values for them if they are not present. The names      and set values for them if they are not present. The names
# Line 543  static int AscCheckEnvironVars(Tcl_Inter Line 553  static int AscCheckEnvironVars(Tcl_Inter
553    
554      CONSOLE_DEBUG("IMPORTING VARS");      CONSOLE_DEBUG("IMPORTING VARS");
555    
556      distdir = getenv(ASC_ENV_DIST);      distdir = GETENV(ASC_ENV_DIST);
557      tkdir = getenv(ASC_ENV_TK);      tkdir = GETENV(ASC_ENV_TK);
558      bitmapsdir = getenv(ASC_ENV_BITMAPS);      bitmapsdir = GETENV(ASC_ENV_BITMAPS);
559      librarydir = getenv(ASC_ENV_LIBRARY);      librarydir = GETENV(ASC_ENV_LIBRARY);
560    
561      int guessedtk=0;      int guessedtk=0;
562    
# Line 588  static int AscCheckEnvironVars(Tcl_Inter Line 598  static int AscCheckEnvironVars(Tcl_Inter
598          ospath_free(fp);          ospath_free(fp);
599  # endif  # endif
600          distdir = ospath_str(distfp);          distdir = ospath_str(distfp);
601          ERROR_REPORTER_NOLINE(ASC_USER_NOTE,"GUESSING %s = %s\n",ASC_ENV_DIST,distdir);          CONSOLE_DEBUG("GUESSING %s = %s",ASC_ENV_DIST,distdir);
602          OSPATH_PUTENV(ASC_ENV_DIST,distfp);          OSPATH_PUTENV(ASC_ENV_DIST,distfp);
603            distdir = GETENV(ASC_ENV_DIST);
604            CONSOLE_DEBUG("RETRIEVED %s = %s",ASC_ENV_DIST,distdir);
605            printenv();
606      }      }
607    
608      if(tkdir == NULL){      if(tkdir == NULL){
# Line 614  static int AscCheckEnvironVars(Tcl_Inter Line 627  static int AscCheckEnvironVars(Tcl_Inter
627          /* Create a path $ASCENDTK/bitmaps */          /* Create a path $ASCENDTK/bitmaps */
628          bitmapsfp = ospath_new_expand_env("$ASCENDTK/bitmaps", &GETENV);          bitmapsfp = ospath_new_expand_env("$ASCENDTK/bitmaps", &GETENV);
629          OSPATH_PUTENV(ASC_ENV_BITMAPS,bitmapsfp);          OSPATH_PUTENV(ASC_ENV_BITMAPS,bitmapsfp);
630            bitmapsdir = ospath_str(bitmapsfp);
631      }      }
632    
633      /**      /**
# Line 627  static int AscCheckEnvironVars(Tcl_Inter Line 641  static int AscCheckEnvironVars(Tcl_Inter
641          libraryfp = ospath_new_expand_env("$ASCENDDIST/models", &GETENV);          libraryfp = ospath_new_expand_env("$ASCENDDIST/models", &GETENV);
642          ospath_free(fp);          ospath_free(fp);
643          OSPATH_PUTENV(ASC_ENV_LIBRARY,libraryfp);          OSPATH_PUTENV(ASC_ENV_LIBRARY,libraryfp);
644            librarydir = ospath_str(libraryfp);
645      }      }
646    
647    

Legend:
Removed from v.587  
changed lines
  Added in v.588

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22