comparison src/process.c @ 288:e11d67e05968 r21-0b42

Import from CVS: tag r21-0b42
author cvs
date Mon, 13 Aug 2007 10:35:54 +0200
parents c42ec1d1cded
children 8e84bee8ddd0
comparison
equal deleted inserted replaced
287:13a0bd77a29d 288:e11d67e05968
493 What's going on here? */ 493 What's going on here? */
494 #endif /* FILE_CODING */ 494 #endif /* FILE_CODING */
495 } 495 }
496 496
497 static void 497 static void
498 create_process (Lisp_Object process, 498 create_process (Lisp_Object process, Lisp_Object *argv, int nargv,
499 char **new_argv, CONST char *current_dir) 499 Lisp_Object program, Lisp_Object cur_dir)
500 { 500 {
501 struct Lisp_Process *p = XPROCESS (process); 501 struct Lisp_Process *p = XPROCESS (process);
502 int pid; 502 int pid;
503 503
504 /* *_create_process may change status_symbol, if the process 504 /* *_create_process may change status_symbol, if the process
505 is a kind of "fire-and-forget" (no I/O, unwaitable) */ 505 is a kind of "fire-and-forget" (no I/O, unwaitable) */
506 p->status_symbol = Qrun; 506 p->status_symbol = Qrun;
507 p->exit_code = 0; 507 p->exit_code = 0;
508 508
509 pid = PROCMETH (create_process, (p, new_argv, current_dir)); 509 pid = PROCMETH (create_process, (p, argv, nargv, program, cur_dir));
510 510
511 p->pid = make_int (pid); 511 p->pid = make_int (pid);
512 if (!NILP(p->pipe_instream)) 512 if (!NILP(p->pipe_instream))
513 event_stream_select_process (p); 513 event_stream_select_process (p);
514 } 514 }
547 /* !!#### This function has not been Mule-ized */ 547 /* !!#### This function has not been Mule-ized */
548 Lisp_Object buffer, name, program, proc, current_dir; 548 Lisp_Object buffer, name, program, proc, current_dir;
549 Lisp_Object tem; 549 Lisp_Object tem;
550 int speccount = specpdl_depth (); 550 int speccount = specpdl_depth ();
551 struct gcpro gcpro1, gcpro2, gcpro3; 551 struct gcpro gcpro1, gcpro2, gcpro3;
552 char **new_argv;
553 int i;
554 552
555 name = args[0]; 553 name = args[0];
556 buffer = args[1]; 554 buffer = args[1];
557 program = args[2]; 555 program = args[2];
558 current_dir = Qnil; 556 current_dir = Qnil;
605 { 603 {
606 if (!NILP (Ffile_directory_p (program))) 604 if (!NILP (Ffile_directory_p (program)))
607 error ("Specified program for new process is a directory"); 605 error ("Specified program for new process is a directory");
608 } 606 }
609 607
610 /* Nothing below here GCs so our string pointers shouldn't move. */
611 new_argv = alloca_array (char *, nargs - 1);
612 new_argv[0] = (char *) XSTRING_DATA (program);
613 for (i = 3; i < nargs; i++)
614 {
615 tem = args[i];
616 CHECK_STRING (tem);
617 new_argv[i - 2] = (char *) XSTRING_DATA (tem);
618 }
619 new_argv[i - 2] = 0;
620
621 proc = make_process_internal (name); 608 proc = make_process_internal (name);
622 609
623 XPROCESS (proc)->buffer = buffer; 610 XPROCESS (proc)->buffer = buffer;
624 XPROCESS (proc)->command = Flist (nargs - 2, 611 XPROCESS (proc)->command = Flist (nargs - 2,
625 args + 2); 612 args + 2);
633 remove it from the process list. This means that each error 620 remove it from the process list. This means that each error
634 check in create_process doesn't need to call remove_process 621 check in create_process doesn't need to call remove_process
635 itself; it's all taken care of here. */ 622 itself; it's all taken care of here. */
636 record_unwind_protect (start_process_unwind, proc); 623 record_unwind_protect (start_process_unwind, proc);
637 624
638 create_process (proc, new_argv, (char *) XSTRING_DATA (current_dir)); 625 create_process (proc, args + 3, nargs - 3, program, current_dir);
639 626
640 UNGCPRO; 627 UNGCPRO;
641 return unbind_to (speccount, proc); 628 return unbind_to (speccount, proc);
642 } 629 }
643 630