From 5437e9f97e19ea0eba3288def1734e61a76ca3c7 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 30 Mar 1993 23:05:56 +0000 Subject: [PATCH] New macros NULL_DEVICE and EXEC_SUFFIXES, to give the name of the equivalent of /dev/null, and the suffixes used by executable files. This is simple, and helps people porting Emacs to other operating systems. * process.h (NULL_DEVICE): Give this a default value. * process.c (Fstart_process): Pass EXEC_SUFFIXES to openp. (Fprocess_send_eof): Use NULL_DEVICE instead of "/dev/null". * callproc.c (Fcall_process): Pass EXEC_SUFFIXES to openp. Use NULL_DEVICE instead of "/dev/null". --- src/callproc.c | 10 +++------- src/process.c | 4 ++-- src/process.h | 11 +++++++++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/callproc.c b/src/callproc.c index 4b674eb9946..72d2b8c6ddd 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -151,11 +151,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") CHECK_STRING (infile, 1); } else -#ifdef VMS - infile = build_string ("NLA0:"); -#else - infile = build_string ("/dev/null"); -#endif /* not VMS */ + infile = build_string (NULL_DEVICE); if (nargs >= 3) { @@ -220,7 +216,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") report_file_error ("Opening process input file", Fcons (infile, Qnil)); } /* Search for program; barf if not found. */ - openp (Vexec_path, args[0], "", &path, 1); + openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 1); if (NILP (path)) { close (filefd); @@ -229,7 +225,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") new_argv[0] = XSTRING (path)->data; if (XTYPE (buffer) == Lisp_Int) - fd[1] = open ("/dev/null", O_WRONLY), fd[0] = -1; + fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1; else { pipe (fd); diff --git a/src/process.c b/src/process.c index ed80460286a..d52f52bcdfd 100644 --- a/src/process.c +++ b/src/process.c @@ -1034,7 +1034,7 @@ Remaining arguments are strings to give program as arguments.") if (new_argv[0][0] != '/') { tem = Qnil; - openp (Vexec_path, program, "", &tem, 1); + openp (Vexec_path, program, EXEC_SUFFIXES, &tem, 1); if (NILP (tem)) report_file_error ("Searching for program", Fcons (program, Qnil)); new_argv[0] = XSTRING (tem)->data; @@ -2597,7 +2597,7 @@ nil, indicating the current buffer's process.") else { close (XPROCESS (proc)->outfd); - XFASTINT (XPROCESS (proc)->outfd) = open ("/dev/null", O_WRONLY); + XFASTINT (XPROCESS (proc)->outfd) = open (NULL_DEVICE, O_WRONLY); } #endif /* VMS */ #endif /* did not do TOICREMOTE */ diff --git a/src/process.h b/src/process.h index 8f476f6894d..2ac7b59c6b7 100644 --- a/src/process.h +++ b/src/process.h @@ -91,3 +91,14 @@ extern char *synch_process_death; this is exit code of synchronous subprocess. */ extern int synch_process_retcode; +/* The name of the file open to get a null file, or a data sink. + VMS, MS-DOS, and OS/2 redefine this. */ +#ifndef NULL_DEVICE +#define NULL_DEVICE "/dev/null" +#endif + +/* A string listing the possible suffixes used for executable files, + separated by colons. VMS, MS-DOS, and OS/2 redefine this. */ +#ifndef EXEC_SUFFIXES +#define EXEC_SUFFIXES "" +#endif