comparison src/callproc.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 966663fcf606
children ca9a9ec9c1c1
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
263 263
264 if (!(EQ (buffer, Qnil) 264 if (!(EQ (buffer, Qnil)
265 || EQ (buffer, Qt) 265 || EQ (buffer, Qt)
266 || ZEROP (buffer))) 266 || ZEROP (buffer)))
267 { 267 {
268 Lisp_Object spec_buffer; 268 Lisp_Object spec_buffer = buffer;
269 spec_buffer = buffer;
270 buffer = Fget_buffer (buffer); 269 buffer = Fget_buffer (buffer);
271 /* Mention the buffer name for a better error message. */ 270 /* Mention the buffer name for a better error message. */
272 if (NILP (buffer)) 271 if (NILP (buffer))
273 CHECK_BUFFER (spec_buffer); 272 CHECK_BUFFER (spec_buffer);
274 CHECK_BUFFER (buffer); 273 CHECK_BUFFER (buffer);
343 342
344 if (NILP (error_file)) 343 if (NILP (error_file))
345 fd_error = open (NULL_DEVICE, O_WRONLY | OPEN_BINARY); 344 fd_error = open (NULL_DEVICE, O_WRONLY | OPEN_BINARY);
346 else if (STRINGP (error_file)) 345 else if (STRINGP (error_file))
347 { 346 {
347 fd_error = open ((CONST char *) XSTRING_DATA (error_file),
348 #ifdef DOS_NT 348 #ifdef DOS_NT
349 fd_error = open (XSTRING_DATA (error_file),
350 O_WRONLY | O_TRUNC | O_CREAT | O_TEXT, 349 O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
351 S_IREAD | S_IWRITE); 350 S_IREAD | S_IWRITE
352 #else /* not DOS_NT */ 351 #else /* not DOS_NT */
353 fd_error = open (XSTRING_DATA (error_file),
354 O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY, 352 O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
355 CREAT_MODE); 353 CREAT_MODE
356 #endif /* not DOS_NT */ 354 #endif /* not DOS_NT */
355 );
357 } 356 }
358 357
359 if (fd_error < 0) 358 if (fd_error < 0)
360 { 359 {
361 close (filefd); 360 close (filefd);
623 622
624 /* Set `env' to a vector of the strings in Vprocess_environment. */ 623 /* Set `env' to a vector of the strings in Vprocess_environment. */
625 { 624 {
626 REGISTER Lisp_Object tem; 625 REGISTER Lisp_Object tem;
627 REGISTER char **new_env; 626 REGISTER char **new_env;
628 REGISTER int new_length; 627 REGISTER int new_length = 0;
629 628
630 new_length = 0;
631 for (tem = Vprocess_environment; 629 for (tem = Vprocess_environment;
632 (CONSP (tem) 630 (CONSP (tem)
633 && STRINGP (XCAR (tem))); 631 && STRINGP (XCAR (tem)));
634 tem = XCDR (tem)) 632 tem = XCDR (tem))
635 new_length++; 633 new_length++;
853 void 851 void
854 init_callproc (void) 852 init_callproc (void)
855 { 853 {
856 /* This function can GC */ 854 /* This function can GC */
857 REGISTER char *sh; 855 REGISTER char *sh;
858 Lisp_Object tempdir;
859 856
860 Vprocess_environment = Qnil; 857 Vprocess_environment = Qnil;
861 /* jwz: always initialize Vprocess_environment, so that egetenv() works 858 /* jwz: always initialize Vprocess_environment, so that egetenv() works
862 in temacs. */ 859 in temacs. */
863 { 860 {
875 ** If NT then we look at COMSPEC for the shell program. 872 ** If NT then we look at COMSPEC for the shell program.
876 */ 873 */
877 sh = egetenv ("COMSPEC"); 874 sh = egetenv ("COMSPEC");
878 { 875 {
879 char *tem; 876 char *tem;
880 /* 877 /*
881 ** If COMSPEC has been set, then convert the 878 ** If COMSPEC has been set, then convert the
882 ** DOS formatted name into a UNIX format. Then 879 ** DOS formatted name into a UNIX format. Then
883 ** create a LISP object. 880 ** create a LISP object.
884 */ 881 */
885 if (sh) 882 if (sh)
886 { 883 {
887 tem = (char *) alloca (strlen (sh) + 1); 884 tem = (char *) alloca (strlen (sh) + 1);
888 dostounix_filename (strcpy (tem, sh)); 885 dostounix_filename (strcpy (tem, sh));
889 Vshell_file_name = build_string (tem); 886 Vshell_file_name = build_string (tem);
890 } 887 }
891 /* 888 /*
892 ** Odd, no COMSPEC, so let's default to our 889 ** Odd, no COMSPEC, so let's default to our
893 ** best guess for NT. 890 ** best guess for NT.
894 */ 891 */
895 else 892 else
896 { 893 {
897 Vshell_file_name = build_string ("/WINNT/system32/cmd.exe"); 894 Vshell_file_name = build_string ("/WINNT/system32/cmd.exe");
898 } 895 }
899 } 896 }
900 #else /* not WINDOWSNT */ 897 #else /* not WINDOWSNT */
901 sh = (char *) egetenv ("SHELL"); 898 sh = (char *) egetenv ("SHELL");
902 Vshell_file_name = build_string (sh ? sh : "/bin/sh"); 899 Vshell_file_name = build_string (sh ? sh : "/bin/sh");
903 #endif 900 #endif