/[emacs]/emacs/src/callproc.c
ViewVC logotype

Diff of /emacs/src/callproc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.195 by rms, Sat Aug 24 03:14:32 2002 UTC revision 1.196 by lektu, Tue Feb 4 14:03:11 2003 UTC
# Line 253  usage: (call-process PROGRAM &optional I Line 253  usage: (call-process PROGRAM &optional I
253    
254  #ifndef subprocesses  #ifndef subprocesses
255    /* Without asynchronous processes we cannot have BUFFER == 0.  */    /* Without asynchronous processes we cannot have BUFFER == 0.  */
256    if (nargs >= 3    if (nargs >= 3
257        && (INTEGERP (CONSP (args[2]) ? XCAR (args[2]) : args[2])))        && (INTEGERP (CONSP (args[2]) ? XCAR (args[2]) : args[2])))
258      error ("Operating system cannot handle asynchronous subprocesses");      error ("Operating system cannot handle asynchronous subprocesses");
259  #endif /* subprocesses */  #endif /* subprocesses */
# Line 339  usage: (call-process PROGRAM &optional I Line 339  usage: (call-process PROGRAM &optional I
339            CHECK_BUFFER (buffer);            CHECK_BUFFER (buffer);
340          }          }
341      }      }
342    else    else
343      buffer = Qnil;      buffer = Qnil;
344    
345    /* Make sure that the child will be able to chdir to the current    /* Make sure that the child will be able to chdir to the current
# Line 431  usage: (call-process PROGRAM &optional I Line 431  usage: (call-process PROGRAM &optional I
431        *tempfile = '\0';        *tempfile = '\0';
432      }      }
433    dostounix_filename (tempfile);    dostounix_filename (tempfile);
434    if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')    if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
435      strcat (tempfile, "/");      strcat (tempfile, "/");
436    strcat (tempfile, "detmp.XXX");    strcat (tempfile, "detmp.XXX");
437    mktemp (tempfile);    mktemp (tempfile);
# Line 545  usage: (call-process PROGRAM &optional I Line 545  usage: (call-process PROGRAM &optional I
545           code does not handle passing the environment to the synchronous           code does not handle passing the environment to the synchronous
546           Mac subprocess.  */           Mac subprocess.  */
547        char *infn, *outfn, *errfn, *currdn;        char *infn, *outfn, *errfn, *currdn;
548          
549        /* close these files so subprocess can write to them */        /* close these files so subprocess can write to them */
550        close (outfilefd);        close (outfilefd);
551        if (fd_error != outfilefd)        if (fd_error != outfilefd)
# Line 780  usage: (call-process PROGRAM &optional I Line 780  usage: (call-process PROGRAM &optional I
780    
781          /* Now NREAD is the total amount of data in the buffer.  */          /* Now NREAD is the total amount of data in the buffer.  */
782          immediate_quit = 0;          immediate_quit = 0;
783            
784          if (!NILP (buffer))          if (!NILP (buffer))
785            {            {
786              if (! CODING_MAY_REQUIRE_DECODING (&process_coding))              if (! CODING_MAY_REQUIRE_DECODING (&process_coding))
# Line 793  usage: (call-process PROGRAM &optional I Line 793  usage: (call-process PROGRAM &optional I
793                repeat_decoding:                repeat_decoding:
794                  size = decoding_buffer_size (&process_coding, nread);                  size = decoding_buffer_size (&process_coding, nread);
795                  decoding_buf = (char *) xmalloc (size);                  decoding_buf = (char *) xmalloc (size);
796                    
797                  /* We can't use the macro CODING_REQUIRE_DETECTION                  /* We can't use the macro CODING_REQUIRE_DETECTION
798                     because it always returns nonzero if the coding                     because it always returns nonzero if the coding
799                     system requires EOL detection.  Here, we have to                     system requires EOL detection.  Here, we have to
# Line 807  usage: (call-process PROGRAM &optional I Line 807  usage: (call-process PROGRAM &optional I
807                    }                    }
808                  if (process_coding.cmp_data)                  if (process_coding.cmp_data)
809                    process_coding.cmp_data->char_offset = PT;                    process_coding.cmp_data->char_offset = PT;
810                    
811                  decode_coding (&process_coding, bufptr, decoding_buf,                  decode_coding (&process_coding, bufptr, decoding_buf,
812                                 nread, size);                                 nread, size);
813                    
814                  if (display_on_the_fly                  if (display_on_the_fly
815                      && saved_coding.type == coding_type_undecided                      && saved_coding.type == coding_type_undecided
816                      && process_coding.type != coding_type_undecided)                      && process_coding.type != coding_type_undecided)
# Line 825  usage: (call-process PROGRAM &optional I Line 825  usage: (call-process PROGRAM &optional I
825                      carryover = nread;                      carryover = nread;
826                      continue;                      continue;
827                    }                    }
828                    
829                  if (process_coding.produced > 0)                  if (process_coding.produced > 0)
830                    insert_1_both (decoding_buf, process_coding.produced_char,                    insert_1_both (decoding_buf, process_coding.produced_char,
831                                   process_coding.produced, 0, 1, 0);                                   process_coding.produced, 0, 1, 0);
# Line 840  usage: (call-process PROGRAM &optional I Line 840  usage: (call-process PROGRAM &optional I
840                          /* CRs have been replaced with LFs.  Undo                          /* CRs have been replaced with LFs.  Undo
841                             that in the text inserted above.  */                             that in the text inserted above.  */
842                          unsigned char *p;                          unsigned char *p;
843                            
844                          move_gap_both (PT, PT_BYTE);                          move_gap_both (PT, PT_BYTE);
845                            
846                          p = BYTE_POS_ADDR (pt_byte_orig);                          p = BYTE_POS_ADDR (pt_byte_orig);
847                          for (; p < GPT_ADDR; ++p)                          for (; p < GPT_ADDR; ++p)
848                            if (*p == '\n')                            if (*p == '\n')
# Line 858  usage: (call-process PROGRAM &optional I Line 858  usage: (call-process PROGRAM &optional I
858                          old_pt = PT;                          old_pt = PT;
859                          old_pt_byte = PT_BYTE;                          old_pt_byte = PT_BYTE;
860                          nCR = 0;                          nCR = 0;
861                            
862                          for (bytepos = PT_BYTE - 1;                          for (bytepos = PT_BYTE - 1;
863                               bytepos >= pt_byte_orig;                               bytepos >= pt_byte_orig;
864                               --bytepos)                               --bytepos)
# Line 882  usage: (call-process PROGRAM &optional I Line 882  usage: (call-process PROGRAM &optional I
882                        coding = AREF (eol_type, CODING_EOL_LF);                        coding = AREF (eol_type, CODING_EOL_LF);
883                      else                      else
884                        coding = saved_coding.symbol;                        coding = saved_coding.symbol;
885                        
886                      process_coding.symbol = coding;                      process_coding.symbol = coding;
887                      process_coding.eol_type = CODING_EOL_LF;                      process_coding.eol_type = CODING_EOL_LF;
888                      process_coding.mode                      process_coding.mode
889                        &= ~CODING_MODE_INHIBIT_INCONSISTENT_EOL;                        &= ~CODING_MODE_INHIBIT_INCONSISTENT_EOL;
890                    }                    }
891                    
892                  nread -= process_coding.consumed;                  nread -= process_coding.consumed;
893                  carryover = nread;                  carryover = nread;
894                  if (carryover > 0)                  if (carryover > 0)
# Line 1106  usage: (call-process-region START END PR Line 1106  usage: (call-process-region START END PR
1106      unbind_to (count1, Qnil);      unbind_to (count1, Qnil);
1107    }    }
1108    
1109    /* Note that Fcall_process takes care of binding    /* Note that Fcall_process takes care of binding
1110       coding-system-for-read.  */       coding-system-for-read.  */
1111    
1112    record_unwind_protect (delete_temp_file, filename_string);    record_unwind_protect (delete_temp_file, filename_string);
# Line 1144  static int relocate_fd (); Line 1144  static int relocate_fd ();
1144     of environ around the vfork and the call to this function.     of environ around the vfork and the call to this function.
1145    
1146     SET_PGRP is nonzero if we should put the subprocess into a separate     SET_PGRP is nonzero if we should put the subprocess into a separate
1147     process group.       process group.
1148    
1149     CURRENT_DIR is an elisp string giving the path of the current     CURRENT_DIR is an elisp string giving the path of the current
1150     directory the subprocess should have.  Since we can't really signal     directory the subprocess should have.  Since we can't really signal
# Line 1467  egetenv (var) Line 1467  egetenv (var)
1467  #endif /* not VMS */  #endif /* not VMS */
1468    
1469  /* This is run before init_cmdargs.  */  /* This is run before init_cmdargs.  */
1470      
1471  void  void
1472  init_callproc_1 ()  init_callproc_1 ()
1473  {  {
# Line 1475  init_callproc_1 () Line 1475  init_callproc_1 ()
1475    char *doc_dir = egetenv ("EMACSDOC");    char *doc_dir = egetenv ("EMACSDOC");
1476    
1477    Vdata_directory    Vdata_directory
1478      = Ffile_name_as_directory (build_string (data_dir ? data_dir      = Ffile_name_as_directory (build_string (data_dir ? data_dir
1479                                               : PATH_DATA));                                               : PATH_DATA));
1480    Vdoc_directory    Vdoc_directory
1481      = Ffile_name_as_directory (build_string (doc_dir ? doc_dir      = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
# Line 1494  void Line 1494  void
1494  init_callproc ()  init_callproc ()
1495  {  {
1496    char *data_dir = egetenv ("EMACSDATA");    char *data_dir = egetenv ("EMACSDATA");
1497        
1498    register char * sh;    register char * sh;
1499    Lisp_Object tempdir;    Lisp_Object tempdir;
1500    
# Line 1512  init_callproc () Line 1512  init_callproc ()
1512            Vexec_path = Fcons (tem, Vexec_path);            Vexec_path = Fcons (tem, Vexec_path);
1513            Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);            Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
1514          }          }
1515          
1516        Vexec_directory = Ffile_name_as_directory (tem);        Vexec_directory = Ffile_name_as_directory (tem);
1517  #endif /* not DOS_NT */  #endif /* not DOS_NT */
1518    

Legend:
Removed from v.1.195  
changed lines
  Added in v.1.196

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26