Mercurial > emacs
comparison src/process.c @ 48053:f840e449c328
(Fsignal_process): Allow PROCESS to be specified by
name in addition to pid (as integer or string).
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Mon, 28 Oct 2002 23:18:50 +0000 |
parents | b30942bd85f3 |
children | 9618c046ce89 |
comparison
equal
deleted
inserted
replaced
48052:0e3c2c0b690a | 48053:f840e449c328 |
---|---|
5389 #endif | 5389 #endif |
5390 return process; | 5390 return process; |
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)) \ |
5405 XSETINT (sigcode, VALUE) | 5437 XSETINT (sigcode, VALUE) |
5406 | 5438 |