// Note: This file will be called each time when ch is invoked 
//############################################################
//  DO NOT MODIFY THIS PART OF CODE
string_t chhome_, tmp_;
chhome_ = getenv("CHHOME");
/* set system aliases */
if(_prompt != NULL) { // interactive mode 
  __declspec(global) char *g_dirstack;   
}
alias("dirs", ". dirs"); 
alias("pushd", ". pushd"); 
alias("popd", ". popd");
alias("alias", ". alias_.ch");
alias("unalias", ". unalias_.ch");
alias("which", ". which.ch");
alias("FILE", "_FILE"); 
alias("logout", "exit");
//  DO NOT MODIFY THE CODE ABOVE

putenv(stradd("GNUPLOT_PS_DIR=", chhome_, "/sbin/PostScript"));
putenv(stradd("GNUPLOT_DRIVER_DIR=", chhome_, "/sbin")); // for gnuplot_x11 driver
putenv(stradd("GNUHELP=", chhome_, "/sbin/gnuplot.gih"));
if(strcmp(_Chedition, "Professional"))
  putenv(stradd("SILIB_HOME=", chhome_, "/silib"));
/***** OS dependent stuff goes here *****/
#if defined(_LINUX_)
  putenv(stradd("LD_LIBRARY_PATH=", chhome_, "/extern/lib:/lib:/usr/lib:/usr/local/lib:"));
#elif defined(_DARWIN_)
  putenv("GNUTERM=x11"); // for plotting using X11
  putenv(stradd("GDFONTPATH=", stradd(_home,"/Library/Fonts:/Library/Fonts:/System/Library/Fonts")));
  putenv(stradd("DYLD_LIBRARY_PATH=", chhome_, "/extern/lib:"));
#if defined(__ppc__)
  /* not 10.1.X for PPC */
  if(atof(`uname -r`) < 5.0 ||  /* 10.0.X */
     atof(`uname -r`) > 6.0)   /* 10.2.X */
  {
    putenv("DYLD_FORCE_FLAT_NAMESPACE=1");
    putenv("DYLD_INSERT_LIBRARIES=/usr/lib/libncurses.dylib");
  }
#endif
#elif defined(_SUN_) || defined(_SOLARIS_)
  tmp_ = stradd("LIBPATH=", chhome_, "/extern/lib:");
#if defined(_M64_)
  tmp_ = stradd(tmp_,"/usr/openwin/lib:");
#else
  tmp_ = stradd(tmp_,"/usr/openwin/lib/amd64:");
#endif
  putenv(tmp_);
  tmp_ = stradd("LD_LIBRARY_PATH=", chhome_, "/extern/lib:");
#if defined(_M64_)
  tmp_ = stradd(tmp_,"/usr/openwin/lib/amd64;/usr/sfw/lib/amd64:/usr/X11R6/lib/amd64:/usr/lib/amd64:/usr/local/lib:");
#else
  tmp_ = stradd(tmp_,"/usr/openwin/lib:/opt/SUNWmotif/lib:/lib:usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/usr/local/lib:");
#endif
  putenv(tmp_);
  tmp_ = stradd("NPX_PLUGIN_PATH=", chhome_, "/www/plugins:");
#elif defined(_HPUX_)
  tmp_ = stradd("SHLIB_PATH=", chhome_, "/extern/lib:");
  //tmp_ = stradd(tmp_,"/lib:/usr/lib:/usr/lib/X11R6:");
  putenv(tmp_);
#elif defined(_AIX_)
   putenv(stradd("LD_LIBRARY_PATH=", chhome_, "/extern/lib:/lib:/usr/lib:/usr/local/lib:"));
  _path = stradd(_path,"/usr/vacpp/bin;");
#elif defined(_QNX_)
  _path = stradd(_path,"/usr/photon/bin;/usr/photon/appbuilder;/opt/X11R6/bin;/opt/bin;");
  _path = stradd(_path,"/usr/qnx630/host/qnx6/x86/usr/qde/eclipse/jre/bin;/usr/qnx630/host/qnx6/x86/usr/bin;/usr/qnx630/host/qnx6/x86/usr/sbin;/usr/qnx630/host/qnx6/x86/sbin;/usr/qnx630/host/qnx6/x86/bin;/usr/qnx630/host/qnx6/x86/usr/photon/appbuilder;");
#elif defined(_LYNX_)
  tmp_ = stradd("LIBPATH=", chhome_, "/extern/lib:", "/lib:/usr/lib:");
  putenv(tmp_);
#endif

/* Add current path  */
_fpath = stradd(_fpath, ".;");
_ipath = stradd(_ipath, ".;");
_lpath = stradd(_lpath, ".;");

/* Add local path below by the system administrator */
_path = stradd(_path,"/usr/bin/X11;/usr/X11R6/bin;");
_path = stradd(_path,"/etc;/usr/sbin;/usr/dt/bin;/usr/local/bin;");
//_path = stradd(_path,"/usr/local/gnu/bin;/usr/ccs/bin;");

/* modify and uncomment the line below to use locale wide characters
setlocale(0, "Chinese-Simplified);
*/

/* include .chrc from user's home directory */
/* root / */
#if strlen(_home)==1 
#if !access(stradd(_home, ".chrc"), 4)
#pragma import stradd(_home, ".chrc");
#endif
#else
#if !access(stradd(_home, "/.chrc"), 4)
#pragma import stradd(_home, "/.chrc");
#endif
#endif
