comparison src/callproc.c @ 44890:01b93e5e53a7

Patch for building Emacs on Mac OS X. April 26, 2002. See ChangeLog, lisp/ChangeLog, and src/ChangeLog for list of changes.
author Andrew Choi <akochoi@shaw.ca>
date Fri, 26 Apr 2002 23:39:06 +0000
parents 7b98c268f335
children 1ed68fd25957
comparison
equal deleted inserted replaced
44889:e3b9f45140a5 44890:01b93e5e53a7
152 152
153 Lisp_Object 153 Lisp_Object
154 call_process_cleanup (fdpid) 154 call_process_cleanup (fdpid)
155 Lisp_Object fdpid; 155 Lisp_Object fdpid;
156 { 156 {
157 #if defined (MSDOS) || defined (macintosh) 157 #if defined (MSDOS) || defined (MAC_OS8)
158 /* for MSDOS fdpid is really (fd . tempfile) */ 158 /* for MSDOS fdpid is really (fd . tempfile) */
159 register Lisp_Object file; 159 register Lisp_Object file;
160 file = Fcdr (fdpid); 160 file = Fcdr (fdpid);
161 emacs_close (XFASTINT (Fcar (fdpid))); 161 emacs_close (XFASTINT (Fcar (fdpid)));
162 if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0) 162 if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0)
163 unlink (XSTRING (file)->data); 163 unlink (XSTRING (file)->data);
164 #else /* not MSDOS and not macintosh */ 164 #else /* not MSDOS and not MAC_OS8 */
165 register int pid = XFASTINT (Fcdr (fdpid)); 165 register int pid = XFASTINT (Fcdr (fdpid));
166 166
167 if (call_process_exited) 167 if (call_process_exited)
168 { 168 {
169 emacs_close (XFASTINT (Fcar (fdpid))); 169 emacs_close (XFASTINT (Fcar (fdpid)));
230 Lisp_Object error_file; 230 Lisp_Object error_file;
231 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ 231 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
232 char *outf, *tempfile; 232 char *outf, *tempfile;
233 int outfilefd; 233 int outfilefd;
234 #endif 234 #endif
235 #ifdef macintosh 235 #ifdef MAC_OS8
236 char *tempfile; 236 char *tempfile;
237 int outfilefd; 237 int outfilefd;
238 #endif 238 #endif
239 #if 0 239 #if 0
240 int mask; 240 int mask;
438 } 438 }
439 fd[0] = filefd; 439 fd[0] = filefd;
440 fd[1] = outfilefd; 440 fd[1] = outfilefd;
441 #endif /* MSDOS */ 441 #endif /* MSDOS */
442 442
443 #ifdef macintosh 443 #ifdef MAC_OS8
444 /* Since we don't have pipes on the Mac, create a temporary file to 444 /* Since we don't have pipes on the Mac, create a temporary file to
445 hold the output of the subprocess. */ 445 hold the output of the subprocess. */
446 tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); 446 tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
447 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, 447 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile,
448 STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); 448 STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
456 report_file_error ("Opening process output file", 456 report_file_error ("Opening process output file",
457 Fcons (build_string (tempfile), Qnil)); 457 Fcons (build_string (tempfile), Qnil));
458 } 458 }
459 fd[0] = filefd; 459 fd[0] = filefd;
460 fd[1] = outfilefd; 460 fd[1] = outfilefd;
461 #endif /* macintosh */ 461 #endif /* MAC_OS8 */
462 462
463 if (INTEGERP (buffer)) 463 if (INTEGERP (buffer))
464 fd[1] = emacs_open (NULL_DEVICE, O_WRONLY, 0), fd[0] = -1; 464 fd[1] = emacs_open (NULL_DEVICE, O_WRONLY, 0), fd[0] = -1;
465 else 465 else
466 { 466 {
467 #ifndef MSDOS 467 #ifndef MSDOS
468 #ifndef macintosh 468 #ifndef MAC_OS8
469 errno = 0; 469 errno = 0;
470 if (pipe (fd) == -1) 470 if (pipe (fd) == -1)
471 { 471 {
472 emacs_close (filefd); 472 emacs_close (filefd);
473 report_file_error ("Creating process pipe", Qnil); 473 report_file_error ("Creating process pipe", Qnil);
529 Qnil)); 529 Qnil));
530 } 530 }
531 531
532 current_dir = ENCODE_FILE (current_dir); 532 current_dir = ENCODE_FILE (current_dir);
533 533
534 #ifdef macintosh 534 #ifdef MAC_OS8
535 { 535 {
536 /* Call run_mac_command in sysdep.c here directly instead of doing 536 /* Call run_mac_command in sysdep.c here directly instead of doing
537 a child_setup as for MSDOS and other platforms. Note that this 537 a child_setup as for MSDOS and other platforms. Note that this
538 code does not handle passing the environment to the synchronous 538 code does not handle passing the environment to the synchronous
539 Mac subprocess. */ 539 Mac subprocess. */
574 unlink (tempfile); 574 unlink (tempfile);
575 close (filefd); 575 close (filefd);
576 report_file_error ("Cannot re-open temporary file", Qnil); 576 report_file_error ("Cannot re-open temporary file", Qnil);
577 } 577 }
578 } 578 }
579 #else /* not macintosh */ 579 #else /* not MAC_OS8 */
580 #ifdef MSDOS /* MW, July 1993 */ 580 #ifdef MSDOS /* MW, July 1993 */
581 /* Note that on MSDOS `child_setup' actually returns the child process 581 /* Note that on MSDOS `child_setup' actually returns the child process
582 exit status, not its PID, so we assign it to `synch_process_retcode' 582 exit status, not its PID, so we assign it to `synch_process_retcode'
583 below. */ 583 below. */
584 pid = child_setup (filefd, outfilefd, fd_error, (char **) new_argv, 584 pid = child_setup (filefd, outfilefd, fd_error, (char **) new_argv,
633 633
634 /* The MSDOS case did this already. */ 634 /* The MSDOS case did this already. */
635 if (fd_error >= 0) 635 if (fd_error >= 0)
636 emacs_close (fd_error); 636 emacs_close (fd_error);
637 #endif /* not MSDOS */ 637 #endif /* not MSDOS */
638 #endif /* not macintosh */ 638 #endif /* not MAC_OS8 */
639 639
640 environ = save_environ; 640 environ = save_environ;
641 641
642 /* Close most of our fd's, but not fd[0] 642 /* Close most of our fd's, but not fd[0]
643 since we will use that to read input from. */ 643 since we will use that to read input from. */
667 } 667 }
668 668
669 /* Enable sending signal if user quits below. */ 669 /* Enable sending signal if user quits below. */
670 call_process_exited = 0; 670 call_process_exited = 0;
671 671
672 #if defined(MSDOS) || defined(macintosh) 672 #if defined(MSDOS) || defined(MAC_OS8)
673 /* MSDOS needs different cleanup information. */ 673 /* MSDOS needs different cleanup information. */
674 record_unwind_protect (call_process_cleanup, 674 record_unwind_protect (call_process_cleanup,
675 Fcons (make_number (fd[0]), build_string (tempfile))); 675 Fcons (make_number (fd[0]), build_string (tempfile)));
676 #else 676 #else
677 record_unwind_protect (call_process_cleanup, 677 record_unwind_protect (call_process_cleanup,
678 Fcons (make_number (fd[0]), make_number (pid))); 678 Fcons (make_number (fd[0]), make_number (pid)));
679 #endif /* not MSDOS and not macintosh */ 679 #endif /* not MSDOS and not MAC_OS8 */
680 680
681 681
682 if (BUFFERP (buffer)) 682 if (BUFFERP (buffer))
683 Fset_buffer (buffer); 683 Fset_buffer (buffer);
684 684