diff options
| author | Kim F. Storm | 2002-10-28 23:18:50 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2002-10-28 23:18:50 +0000 |
| commit | cdd5ea86dbc2ddc27094813503f00e8b13579dbb (patch) | |
| tree | 7b9b21e0dcf8e765eddc8a0fa65e4cd5c8ff8e03 /src/process.c | |
| parent | e8a3259964f68a6de15487e3f4dd1f223ca93613 (diff) | |
| download | emacs-cdd5ea86dbc2ddc27094813503f00e8b13579dbb.tar.gz emacs-cdd5ea86dbc2ddc27094813503f00e8b13579dbb.zip | |
(Fsignal_process): Allow PROCESS to be specified by
name in addition to pid (as integer or string).
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c index 7af60a08742..c1379a923aa 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5391,14 +5391,46 @@ If PROCESS is a network process, resume handling of incoming traffic. */) | |||
| 5391 | } | 5391 | } |
| 5392 | 5392 | ||
| 5393 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, | 5393 | DEFUN ("signal-process", Fsignal_process, Ssignal_process, |
| 5394 | 2, 2, "nProcess number: \nnSignal code: ", | 5394 | 2, 2, "sProcess (name or number): \nnSignal code: ", |
| 5395 | doc: /* Send the process with process id PID the signal with code SIGCODE. | 5395 | doc: /* Send PROCESS the signal with code SIGCODE. |
| 5396 | PID must be an integer. The process need not be a child of this Emacs. | 5396 | PROCESS may also be an integer specifying the process id of the |
| 5397 | process to signal; in this case, the process need not be a child of | ||
| 5398 | this Emacs. | ||
| 5397 | SIGCODE may be an integer, or a symbol whose name is a signal name. */) | 5399 | SIGCODE may be an integer, or a symbol whose name is a signal name. */) |
| 5398 | (pid, sigcode) | 5400 | (process, sigcode) |
| 5399 | Lisp_Object pid, sigcode; | 5401 | Lisp_Object process, sigcode; |
| 5400 | { | 5402 | { |
| 5401 | CHECK_NUMBER (pid); | 5403 | Lisp_Object pid; |
| 5404 | |||
| 5405 | if (INTEGERP (process)) | ||
| 5406 | { | ||
| 5407 | pid = process; | ||
| 5408 | goto got_it; | ||
| 5409 | } | ||
| 5410 | |||
| 5411 | if (STRINGP (process)) | ||
| 5412 | { | ||
| 5413 | Lisp_Object tem; | ||
| 5414 | if (tem = Fget_process (process), NILP (tem)) | ||
| 5415 | { | ||
| 5416 | pid = Fstring_to_number (process, make_number (10)); | ||
| 5417 | if (XINT (pid) != 0) | ||
| 5418 | goto got_it; | ||
| 5419 | } | ||
| 5420 | process = tem; | ||
| 5421 | } | ||
| 5422 | else | ||
| 5423 | process = get_process (process); | ||
| 5424 | |||
| 5425 | if (NILP (process)) | ||
| 5426 | return process; | ||
| 5427 | |||
| 5428 | CHECK_PROCESS (process); | ||
| 5429 | pid = XPROCESS (process)->pid; | ||
| 5430 | if (!INTEGERP (pid) || XINT (pid) <= 0) | ||
| 5431 | error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); | ||
| 5432 | |||
| 5433 | got_it: | ||
| 5402 | 5434 | ||
| 5403 | #define handle_signal(NAME, VALUE) \ | 5435 | #define handle_signal(NAME, VALUE) \ |
| 5404 | else if (!strcmp (name, NAME)) \ | 5436 | else if (!strcmp (name, NAME)) \ |