comparison src/callproc.c @ 9138:6c814eb4d892

(Fcall_process, child_setup, getenv_internal): Use type test macros.
author Karl Heuer <kwzh@gnu.org>
date Tue, 27 Sep 1994 03:10:43 +0000
parents f44e40e722b2
children 74985a8972e4
comparison
equal deleted inserted replaced
9137:412e94c1dbf2 9138:6c814eb4d892
198 #endif 198 #endif
199 CHECK_STRING (args[0], 0); 199 CHECK_STRING (args[0], 0);
200 200
201 #ifndef subprocesses 201 #ifndef subprocesses
202 /* Without asynchronous processes we cannot have BUFFER == 0. */ 202 /* Without asynchronous processes we cannot have BUFFER == 0. */
203 if (nargs >= 3 && XTYPE (args[2]) == Lisp_Int) 203 if (nargs >= 3 && INTEGERP (args[2]))
204 error ("Operating system cannot handle asynchronous subprocesses"); 204 error ("Operating system cannot handle asynchronous subprocesses");
205 #endif /* subprocesses */ 205 #endif /* subprocesses */
206 206
207 if (nargs >= 2 && ! NILP (args[1])) 207 if (nargs >= 2 && ! NILP (args[1]))
208 { 208 {
312 close (filefd); 312 close (filefd);
313 report_file_error ("Opening process output file", Fcons (tempfile, Qnil)); 313 report_file_error ("Opening process output file", Fcons (tempfile, Qnil));
314 } 314 }
315 #endif 315 #endif
316 316
317 if (XTYPE (buffer) == Lisp_Int) 317 if (INTEGERP (buffer))
318 fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1; 318 fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1;
319 else 319 else
320 { 320 {
321 #ifndef MSDOS 321 #ifndef MSDOS
322 pipe (fd); 322 pipe (fd);
389 if (fd[0] >= 0) 389 if (fd[0] >= 0)
390 close (fd[0]); 390 close (fd[0]);
391 report_file_error ("Doing vfork", Qnil); 391 report_file_error ("Doing vfork", Qnil);
392 } 392 }
393 393
394 if (XTYPE (buffer) == Lisp_Int) 394 if (INTEGERP (buffer))
395 { 395 {
396 if (fd[0] >= 0) 396 if (fd[0] >= 0)
397 close (fd[0]); 397 close (fd[0]);
398 #ifndef subprocesses 398 #ifndef subprocesses
399 /* If Emacs has been built with asynchronous subprocess support, 399 /* If Emacs has been built with asynchronous subprocess support,
415 record_unwind_protect (call_process_cleanup, 415 record_unwind_protect (call_process_cleanup,
416 Fcons (make_number (fd[0]), make_number (pid))); 416 Fcons (make_number (fd[0]), make_number (pid)));
417 #endif /* not MSDOS */ 417 #endif /* not MSDOS */
418 418
419 419
420 if (XTYPE (buffer) == Lisp_Buffer) 420 if (BUFFERP (buffer))
421 Fset_buffer (buffer); 421 Fset_buffer (buffer);
422 422
423 immediate_quit = 1; 423 immediate_quit = 1;
424 QUIT; 424 QUIT;
425 425
640 register char **new_env; 640 register char **new_env;
641 register int new_length; 641 register int new_length;
642 642
643 new_length = 0; 643 new_length = 0;
644 for (tem = Vprocess_environment; 644 for (tem = Vprocess_environment;
645 (XTYPE (tem) == Lisp_Cons 645 CONSP (tem) && STRINGP (XCONS (tem)->car);
646 && XTYPE (XCONS (tem)->car) == Lisp_String);
647 tem = XCONS (tem)->cdr) 646 tem = XCONS (tem)->cdr)
648 new_length++; 647 new_length++;
649 648
650 /* new_length + 2 to include PWD and terminating 0. */ 649 /* new_length + 2 to include PWD and terminating 0. */
651 env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *)); 650 env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *));
655 if (getenv ("PWD")) 654 if (getenv ("PWD"))
656 *new_env++ = pwd_var; 655 *new_env++ = pwd_var;
657 656
658 /* Copy the Vprocess_environment strings into new_env. */ 657 /* Copy the Vprocess_environment strings into new_env. */
659 for (tem = Vprocess_environment; 658 for (tem = Vprocess_environment;
660 (XTYPE (tem) == Lisp_Cons 659 CONSP (tem) && STRINGP (XCONS (tem)->car);
661 && XTYPE (XCONS (tem)->car) == Lisp_String);
662 tem = XCONS (tem)->cdr) 660 tem = XCONS (tem)->cdr)
663 { 661 {
664 char **ep = env; 662 char **ep = env;
665 char *string = (char *) XSTRING (XCONS (tem)->car)->data; 663 char *string = (char *) XSTRING (XCONS (tem)->car)->data;
666 /* See if this string duplicates any string already in the env. 664 /* See if this string duplicates any string already in the env.
779 for (scan = Vprocess_environment; CONSP (scan); scan = XCONS (scan)->cdr) 777 for (scan = Vprocess_environment; CONSP (scan); scan = XCONS (scan)->cdr)
780 { 778 {
781 Lisp_Object entry; 779 Lisp_Object entry;
782 780
783 entry = XCONS (scan)->car; 781 entry = XCONS (scan)->car;
784 if (XTYPE (entry) == Lisp_String 782 if (STRINGP (entry)
785 && XSTRING (entry)->size > varlen 783 && XSTRING (entry)->size > varlen
786 && XSTRING (entry)->data[varlen] == '=' 784 && XSTRING (entry)->data[varlen] == '='
787 && ! bcmp (XSTRING (entry)->data, var, varlen)) 785 && ! bcmp (XSTRING (entry)->data, var, varlen))
788 { 786 {
789 *value = (char *) XSTRING (entry)->data + (varlen + 1); 787 *value = (char *) XSTRING (entry)->data + (varlen + 1);