X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/b78265036088d5d0eac2a03b929adb50aa59b45c..534c20b22f89ffbe99a4d6a1035b74eacc544ee5:/src/callproc.c diff --git a/src/callproc.c b/src/callproc.c index 21cfc11dd6..1a3ff6fcca 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -105,7 +105,7 @@ extern char **environ; Lisp_Object Vexec_path, Vexec_directory, Vexec_suffixes; Lisp_Object Vdata_directory, Vdoc_directory; -Lisp_Object Vconfigure_info_directory; +Lisp_Object Vconfigure_info_directory, Vshared_game_score_directory; Lisp_Object Vtemp_file_name_pattern; Lisp_Object Vshell_file_name; @@ -154,14 +154,14 @@ Lisp_Object call_process_cleanup (fdpid) Lisp_Object fdpid; { -#if defined (MSDOS) || defined (macintosh) +#if defined (MSDOS) || defined (MAC_OS8) /* for MSDOS fdpid is really (fd . tempfile) */ register Lisp_Object file; file = Fcdr (fdpid); emacs_close (XFASTINT (Fcar (fdpid))); if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0) unlink (XSTRING (file)->data); -#else /* not MSDOS and not macintosh */ +#else /* not MSDOS and not MAC_OS8 */ register int pid = XFASTINT (Fcdr (fdpid)); if (call_process_exited) @@ -232,7 +232,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) char *outf, *tempfile; int outfilefd; #endif -#ifdef macintosh +#ifdef MAC_OS8 char *tempfile; int outfilefd; #endif @@ -381,7 +381,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) struct gcpro gcpro1; GCPRO1 (current_dir); - openp (Vexec_path, args[0], Vexec_suffixes, &path, 1); + openp (Vexec_path, args[0], Vexec_suffixes, &path, make_number (X_OK)); UNGCPRO; } if (NILP (path)) @@ -440,7 +440,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) fd[1] = outfilefd; #endif /* MSDOS */ -#ifdef macintosh +#ifdef MAC_OS8 /* Since we don't have pipes on the Mac, create a temporary file to hold the output of the subprocess. */ tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); @@ -458,14 +458,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) } fd[0] = filefd; fd[1] = outfilefd; -#endif /* macintosh */ +#endif /* MAC_OS8 */ if (INTEGERP (buffer)) fd[1] = emacs_open (NULL_DEVICE, O_WRONLY, 0), fd[0] = -1; else { #ifndef MSDOS -#ifndef macintosh +#ifndef MAC_OS8 errno = 0; if (pipe (fd) == -1) { @@ -531,7 +531,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) current_dir = ENCODE_FILE (current_dir); -#ifdef macintosh +#ifdef MAC_OS8 { /* Call run_mac_command in sysdep.c here directly instead of doing a child_setup as for MSDOS and other platforms. Note that this @@ -576,7 +576,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) report_file_error ("Cannot re-open temporary file", Qnil); } } -#else /* not macintosh */ +#else /* not MAC_OS8 */ #ifdef MSDOS /* MW, July 1993 */ /* Note that on MSDOS `child_setup' actually returns the child process exit status, not its PID, so we assign it to `synch_process_retcode' @@ -635,7 +635,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (fd_error >= 0) emacs_close (fd_error); #endif /* not MSDOS */ -#endif /* not macintosh */ +#endif /* not MAC_OS8 */ environ = save_environ; @@ -669,14 +669,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) /* Enable sending signal if user quits below. */ call_process_exited = 0; -#if defined(MSDOS) || defined(macintosh) +#if defined(MSDOS) || defined(MAC_OS8) /* MSDOS needs different cleanup information. */ record_unwind_protect (call_process_cleanup, Fcons (make_number (fd[0]), build_string (tempfile))); #else record_unwind_protect (call_process_cleanup, Fcons (make_number (fd[0]), make_number (pid))); -#endif /* not MSDOS and not macintosh */ +#endif /* not MSDOS and not MAC_OS8 */ if (BUFFERP (buffer)) @@ -897,8 +897,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) but not past 64k. */ if (bufsize < 64 * 1024 && total_read > 32 * bufsize) { + char *tempptr; bufsize *= 2; - bufptr = (char *) alloca (bufsize); + + tempptr = (char *) alloca (bufsize); + bcopy (bufptr, tempptr, bufsize / 2); + bufptr = tempptr; } if (!NILP (display) && INTERACTIVE) @@ -1147,7 +1151,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) #ifdef SET_EMACS_PRIORITY { - extern int emacs_priority; + extern EMACS_INT emacs_priority; if (emacs_priority < 0) nice (- emacs_priority); @@ -1485,7 +1489,11 @@ init_callproc () #ifndef DOS_NT /* MSDOS uses wrapped binaries, so don't do this. */ if (NILP (Fmember (tem, Vexec_path))) - Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil)); + { + Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); + Vexec_path = Fcons (tem, Vexec_path); + Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); + } Vexec_directory = Ffile_name_as_directory (tem); #endif /* not DOS_NT */ @@ -1508,12 +1516,15 @@ init_callproc () source directory. */ if (data_dir == 0) { - Lisp_Object tem, tem1, newdir; + Lisp_Object tem, tem1, srcdir; + srcdir = Fexpand_file_name (build_string ("../src/"), + build_string (PATH_DUMPLOADSEARCH)); tem = Fexpand_file_name (build_string ("GNU"), Vdata_directory); tem1 = Ffile_exists_p (tem); - if (NILP (tem1)) + if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1)) { + Lisp_Object newdir; newdir = Fexpand_file_name (build_string ("../etc/"), build_string (PATH_DUMPLOADSEARCH)); tem = Fexpand_file_name (build_string ("GNU"), newdir); @@ -1615,6 +1626,15 @@ Emacs's info files; the default value for Info-default-directory-list includes this. */); Vconfigure_info_directory = build_string (PATH_INFO); + DEFVAR_LISP ("shared-game-score-directory", &Vshared_game_score_directory, + doc: /* Directory of score files for games which come with GNU Emacs. +If this variable is nil, then Emacs is unable to use a shared directory. */); +#ifdef HAVE_SHARED_GAME_DIR + Vshared_game_score_directory = build_string(HAVE_SHARED_GAME_DIR); +#else + Vshared_game_score_directory = Qnil; +#endif + DEFVAR_LISP ("temp-file-name-pattern", &Vtemp_file_name_pattern, doc: /* Pattern for making names for temporary files. This is used by `call-process-region'. */);