comparison src/callproc.c @ 267:966663fcf606 r20-5b32

Import from CVS: tag r20-5b32
author cvs
date Mon, 13 Aug 2007 10:26:29 +0200
parents 727739f917cb
children c5d627a313b1
comparison
equal deleted inserted replaced
266:18d185df8c54 267:966663fcf606
52 \r\n). Similar for output: if newlines are written as \r\n then it's 52 \r\n). Similar for output: if newlines are written as \r\n then it's
53 text process output, otherwise it's binary. */ 53 text process output, otherwise it's binary. */
54 Lisp_Object Vbinary_process_input; 54 Lisp_Object Vbinary_process_input;
55 Lisp_Object Vbinary_process_output; 55 Lisp_Object Vbinary_process_output;
56 #endif /* DOS_NT */ 56 #endif /* DOS_NT */
57
58 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
59 Lisp_Object Vdata_directory_list;
60 Lisp_Object Vconfigure_info_directory, Vsite_directory;
61 Lisp_Object Vinfopath_internal;
62
63 /* The default base directory XEmacs is installed under. */
64 Lisp_Object Vprefix_directory;
65 57
66 Lisp_Object Vshell_file_name; 58 Lisp_Object Vshell_file_name;
67 59
68 /* The environment to pass to all subprocesses when they are started. 60 /* The environment to pass to all subprocesses when they are started.
69 This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... ) 61 This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... )
875 Vprocess_environment = Fcons (build_ext_string (*envp, FORMAT_OS), 867 Vprocess_environment = Fcons (build_ext_string (*envp, FORMAT_OS),
876 Vprocess_environment); 868 Vprocess_environment);
877 } 869 }
878 } 870 }
879 871
880 /* jwz: don't do these things when in temacs (this used to be the case by
881 virtue of egetenv() always returning 0, but that has been changed).
882 */
883 #ifndef CANNOT_DUMP
884 if (!initialized)
885 {
886 Vdata_directory = Qnil;
887 Vsite_directory = Qnil;
888 Vdoc_directory = Qnil;
889 Vexec_path = Qnil;
890 }
891 else
892 #endif
893 {
894 char *data_dir = egetenv ("EMACSDATA");
895 char *site_dir = egetenv ("EMACSSITE");
896 char *doc_dir = egetenv ("EMACSDOC");
897
898 #ifdef PATH_DATA
899 if (!data_dir)
900 data_dir = (char *) PATH_DATA;
901 #endif
902 #ifdef PATH_DOC
903 if (!doc_dir)
904 doc_dir = (char *) PATH_DOC;
905 #endif
906 #ifdef PATH_SITE
907 if (!site_dir)
908 site_dir = (char *) PATH_SITE;
909 #endif
910
911 if (data_dir)
912 Vdata_directory = Ffile_name_as_directory
913 (build_string (data_dir));
914 else
915 Vdata_directory = Qnil;
916 if (doc_dir)
917 Vdoc_directory = Ffile_name_as_directory
918 (build_string (doc_dir));
919 else
920 Vdoc_directory = Qnil;
921 if (site_dir)
922 Vsite_directory = Ffile_name_as_directory
923 (build_string (site_dir));
924 else
925 Vsite_directory = Qnil;
926
927 /* Check the EMACSPATH environment variable, defaulting to the
928 PATH_EXEC path from paths.h. */
929 Vexec_path = decode_env_path ("EMACSPATH",
930 #ifdef PATH_EXEC
931 PATH_EXEC
932 #else
933 0
934 #endif
935 );
936 }
937
938 if (NILP (Vexec_path))
939 Vexec_directory = Qnil;
940 else
941 Vexec_directory = Ffile_name_as_directory
942 (Fcar (Vexec_path));
943
944 if (initialized)
945 Vexec_path = nconc2 (decode_env_path ("PATH", 0),
946 Vexec_path);
947
948 if (!NILP (Vexec_directory))
949 {
950 tempdir = Fdirectory_file_name (Vexec_directory);
951 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
952 {
953 /* If the hard-coded path is bogus, fail silently.
954 This will allow the normal heuristics to make an attempt. */
955 #if 0
956 warn_when_safe
957 (Qpath, Qwarning,
958 "Warning: machine-dependent data dir (%s) does not exist.\n",
959 XSTRING_DATA (Vexec_directory));
960 #else
961 Vexec_directory = Qnil;
962 #endif
963 }
964 }
965
966 if (!NILP (Vdata_directory))
967 {
968 tempdir = Fdirectory_file_name (Vdata_directory);
969 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
970 {
971 /* If the hard-coded path is bogus, fail silently.
972 This will allow the normal heuristics to make an attempt. */
973 #if 0
974 warn_when_safe
975 (Qpath, Qwarning,
976 "Warning: machine-independent data dir (%s) does not exist.\n",
977 XSTRING_DATA (Vdata_directory));
978 #else
979 Vdata_directory = Qnil;
980 #endif
981 }
982 }
983
984 if (!NILP (Vsite_directory))
985 {
986 tempdir = Fdirectory_file_name (Vsite_directory);
987 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
988 {
989 /* If the hard-coded path is bogus, fail silently.
990 This will allow the normal heuristics to make an attempt. */
991 #if 0
992 warn_when_safe
993 (Qpath, Qwarning,
994 "Warning: machine-independent site dir (%s) does not exist.\n",
995 XSTRING_DATA (Vsite_directory));
996 #else
997 Vsite_directory = Qnil;
998 #endif
999 }
1000 }
1001
1002 #ifdef PATH_PREFIX
1003 Vprefix_directory = build_string ((char *) PATH_PREFIX);
1004 #else
1005 Vprefix_directory = Qnil;
1006 #endif
1007
1008 #ifdef WINDOWSNT 872 #ifdef WINDOWSNT
1009 /* Sync with FSF Emacs 19.34.6 note: this is not in 19.34.6. --marcpa */ 873 /* Sync with FSF Emacs 19.34.6 note: this is not in 19.34.6. --marcpa */
1010 /* 874 /*
1011 ** If NT then we look at COMSPEC for the shell program. 875 ** If NT then we look at COMSPEC for the shell program.
1012 */ 876 */
1081 DEFVAR_LISP ("shell-file-name", &Vshell_file_name /* 945 DEFVAR_LISP ("shell-file-name", &Vshell_file_name /*
1082 *File name to load inferior shells from. 946 *File name to load inferior shells from.
1083 Initialized from the SHELL environment variable. 947 Initialized from the SHELL environment variable.
1084 */ ); 948 */ );
1085 949
1086 DEFVAR_LISP ("exec-path", &Vexec_path /*
1087 *List of directories to search programs to run in subprocesses.
1088 Each element is a string (directory name) or nil (try default directory).
1089 */ );
1090
1091 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
1092 Directory of architecture-dependent files that come with XEmacs,
1093 especially executable programs intended for XEmacs to invoke.
1094 */ );
1095
1096 DEFVAR_LISP ("data-directory", &Vdata_directory /*
1097 Directory of architecture-independent files that come with XEmacs,
1098 intended for XEmacs to use.
1099 Use of this variable in new code is almost never correct. See the
1100 function `locate-data-directory' and the variable `data-directory-list'.
1101 */ );
1102
1103 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /*
1104 List of directories of architecture-independent files that come with XEmacs
1105 or were installed as packages, and are intended for XEmacs to use.
1106 */ );
1107 Vdata_directory_list = Qnil;
1108
1109 DEFVAR_LISP ("site-directory", &Vsite_directory /*
1110 Directory of architecture-independent files that do not come with XEmacs,
1111 intended for XEmacs to use.
1112 */ );
1113
1114 /* FSF puts the DOC file into data-directory. They do a bunch of
1115 contortions to attempt to put everything into the DOC file
1116 whether the support is there or not. */
1117 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
1118 Directory containing the DOC file that comes with XEmacs.
1119 This is usually the same as exec-directory.
1120 */ );
1121
1122 DEFVAR_LISP ("prefix-directory", &Vprefix_directory /*
1123 The default directory under which XEmacs is installed.
1124 */ );
1125
1126 DEFVAR_LISP ("process-environment", &Vprocess_environment /* 950 DEFVAR_LISP ("process-environment", &Vprocess_environment /*
1127 List of environment variables for subprocesses to inherit. 951 List of environment variables for subprocesses to inherit.
1128 Each element should be a string of the form ENVVARNAME=VALUE. 952 Each element should be a string of the form ENVVARNAME=VALUE.
1129 The environment which Emacs inherits is placed in this variable 953 The environment which Emacs inherits is placed in this variable
1130 when Emacs starts. 954 when Emacs starts.
1131 */ ); 955 */ );
1132 } 956 }
1133
1134 void
1135 complex_vars_of_callproc (void)
1136 {
1137 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
1138 For internal use by the build procedure only.
1139 This is the name of the directory in which the build procedure installed
1140 Emacs's info files; the default value for Info-default-directory-list
1141 includes this.
1142 */ );
1143
1144 #ifdef PATH_INFO
1145 Vconfigure_info_directory =
1146 Ffile_name_as_directory (build_string (PATH_INFO));
1147 #else
1148 Vconfigure_info_directory = Qnil;
1149 #endif
1150
1151 DEFVAR_LISP ("infopath-internal", &Vinfopath_internal /*
1152 The configured initial value of Info-default-directory-list.
1153 */ );
1154
1155 #ifdef PATH_INFOPATH
1156 Vinfopath_internal = build_string (PATH_INFOPATH);
1157 #else
1158 Vinfopath_internal =
1159 build_string ("/usr/info:/usr/local/info:/usr/lib/texmf/doc/info:/usr/local/lib/texmf/doc/info");
1160 #endif
1161 }