diff options
| author | Dmitry Antipov | 2015-01-14 10:08:44 +0300 |
|---|---|---|
| committer | Dmitry Antipov | 2015-01-14 10:08:44 +0300 |
| commit | d7e26b44109f4068d41a075fa89d11c1a8156f66 (patch) | |
| tree | 141efe83d87a6bfceeadb4e04e38979e5df3c8c1 /src/callproc.c | |
| parent | 01ebf7a3655541ef09cee068bddffbc1b38c69c8 (diff) | |
| download | emacs-d7e26b44109f4068d41a075fa89d11c1a8156f66.tar.gz emacs-d7e26b44109f4068d41a075fa89d11c1a8156f66.zip | |
Consolidate common path transformation code.
* process.h (remove_slash_colon): New function.
* callproc.c (encode_current_directory, call_process):
* process.c (Fstart_process): Use it.
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/callproc.c b/src/callproc.c index 970a2017b38..63ab9bf70db 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -131,11 +131,9 @@ encode_current_directory (void) | |||
| 131 | report_file_error ("Setting current directory", | 131 | report_file_error ("Setting current directory", |
| 132 | BVAR (current_buffer, directory)); | 132 | BVAR (current_buffer, directory)); |
| 133 | 133 | ||
| 134 | /* Remove "/:" from dir. */ | 134 | /* Remove "/:" from DIR and encode it. */ |
| 135 | if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil))) | 135 | dir = ENCODE_FILE (remove_slash_colon (dir)); |
| 136 | dir = Fsubstring (dir, make_number (2), Qnil); | ||
| 137 | 136 | ||
| 138 | dir = ENCODE_FILE (dir); | ||
| 139 | if (! file_accessible_directory_p (dir)) | 137 | if (! file_accessible_directory_p (dir)) |
| 140 | report_file_error ("Setting current directory", | 138 | report_file_error ("Setting current directory", |
| 141 | BVAR (current_buffer, directory)); | 139 | BVAR (current_buffer, directory)); |
| @@ -467,11 +465,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 467 | report_file_error ("Searching for program", args[0]); | 465 | report_file_error ("Searching for program", args[0]); |
| 468 | } | 466 | } |
| 469 | 467 | ||
| 470 | /* If program file name starts with /: for quoting a magic name, | 468 | /* Remove "/:" from PATH. */ |
| 471 | discard that. */ | 469 | path = remove_slash_colon (path); |
| 472 | if (SBYTES (path) > 2 && SREF (path, 0) == '/' | ||
| 473 | && SREF (path, 1) == ':') | ||
| 474 | path = Fsubstring (path, make_number (2), Qnil); | ||
| 475 | 470 | ||
| 476 | SAFE_NALLOCA (new_argv, 1, nargs < 4 ? 2 : nargs - 2); | 471 | SAFE_NALLOCA (new_argv, 1, nargs < 4 ? 2 : nargs - 2); |
| 477 | 472 | ||