Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: CShell 5.10, arp stuff, A3000 w/2.0; should they go together Message-ID: Date: 29 May 91 20:42:01 GMT References: <1845@contex.contex.com> <37100008@hpfcdc.HP.COM> Organization: Not an Organization Lines: 66 In article <37100008@hpfcdc.HP.COM> koren@hpfcdc.HP.COM (Steve Koren) writes: > >> RunCommand(seglist,stacksize,arguments,argument length). This is what >>is used by the system shell to run commands on your process. > >Well, I admit I don't have the docs for RunCommand, but from the arguments >to it listed above, it appears there is no way to redirect input and >output to the command. If true, that would make it unusable for a shell. > > - steve There are THREE main 2.0 calls associated with running programs: (1) RunCommand() RunCommand() runs a seglist under THE CALLERS CONTEXT, using the caller's task. THIS IS THE COMMAND A SHELL WRITER WOULD USE TO RUN COMMANDS. The caller must LoadSeg() or FindResident() (and bump the resident tag count as appropriate) to get a segment which may be used in a call to RunCommand(). The argument line must be terminated with \n\0 instead of just \0 to be compatible with resident C: commands. All other setup is up to the calling program (in terms of setting up input, output, etc...) Since no new process is created and the seglist may be pre-cached or found in a resident list, this call can be made to run VERY quickly. (2) System() System() will start up a shell, executable your command (like Execute()), then return the exit code. It has options similar to CreateNewProc() below in terms of directing input and output and choosing between the system shell or a custom shell. Commands run under System() run in a separate shell context, meaning that ^C-^F will not be propogated. However, full shell command lines are allowed, including redirection on the command line, and use of internal shell commands. Running a command via System() is slower than RunCommand() since a separate process will be created, a shell/cli run, and the command then interpreted by the shell/cli. (3) CreateNewProc() Create a new process specifying either an entry point or seglist, with options to set input, output, current dir, stack, name, priority, console task, windowptr, CLI, etc etc etc.... This call is faster than System() but slower than RunCommand(). However, it is an excellent method to start up asynchronous processes or tasks (such as servers, handlers, co-processes...) -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA