Xref: utzoo comp.binaries.amiga:259 comp.sources.amiga:190 Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!i.cc.purdue.edu!j.cc.purdue.edu!ain From: ain@j.cc.purdue.edu (Patrick White) Newsgroups: comp.binaries.amiga,comp.sources.amiga Subject: RunBack (docs) Keywords: runback, background Message-ID: <7372@j.cc.purdue.edu> Date: 8 Jul 88 16:39:33 GMT Organization: PUCC Land, USA Lines: 197 Approved: ain@j.cc.purdue.edu (Patrick White) Submitted by: barrett@crabcake.cs.JHU.EDU Summary: Runs a program in the background without attachments to the CLI. Poster Boy: Patrick White (ain@j.cc.purdue.edu) Archive Name: sources/amiga/volume5/runback2.d.sh.Z binaries/amiga/volume8/runback2.d.sh.Z tested. NOTES: I tried it, but didn't tru compiling it. Reshared it to separate sources, docs, and binaries. It worked perfectly except when I tried to runback the info.library.. but that is a dumb thing to be doing anyway :-) (did it cause older versions died when you tried to run soemthign that was not there). . -- Pat White (co-moderator comp.sources/binaries.amiga) ARPA/UUCP: j.cc.purdue.edu!ain BITNET: PATWHITE@PURCCVM PHONE: (317) 743-8421 U.S. Mail: 320 Brown St. apt. 406, West Lafayette, IN 47906 [archives at: j.cc.purdue.edu.ARPA] ======================================== # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # README # README.peck # This archive created: Fri Jul 8 11:32:50 1988 # By: Patrick White (PUCC Land, USA) echo shar: extracting README '(2561 characters)' cat << \SHAR_EOF > README RunBack: Run a program in the background. *** Now searches your command search path. *** A revision of Rob Peck's "RunBack" program and Carolyn Scheppner's "Which" program. Author: Daniel Barrett Department of Computer Science The Johns Hopkins University Baltimore, MD 21218 barrett@cs.jhu.edu ins_adjb@jhunix.UUCP Note: Both the original RunBackground and Which are in the Public Domain. So is all my code that I added. Use it however you please. INTRODUCTION ------------ This is my altered version of Rob Peck's fine program, RunBack. RunBack, similar to Run, allows you to startup a CLI program and let it run in the background. Unlike Run, however, RunBack then allows the original CLI to be closed. Run would hang the CLI if you did this. See the file README.peck for Rob Peck's original documentation. Also unlike Run, the old RunBack did not search your command search path; you always had to specify the complete pathname of your command. My new version eliminates this hassle -- it searches your path. The path-searching code is largely taken from Carolyn Scheppner's "Which" program. Thanks, Carolyn!! A PROBLEM I HAD TO OVERCOME --------------------------- The original RunBack program I obtained was a binary version, compiled with the Lattice C compiler. I use the Manx (Aztec) compiler, version 3.6a. When I compiled Rob's original program with Manx, something did not work anymore... quoted arguments on the command line. The Manx version completely drops the quotes! The way RunBack works is that it translates: RunBack myProgram arg1 arg2 into: Run >NIL: NIL: NIL: NIL: NIL: NIL: README.peck /* -------------- runbackground.c --------------- SUMMARY: A Workbench Disk can be used to autostart an application through the use of the startup script and close the startup CLI. Users have commented that it is not possible to start a process going from the startup script and then cause the initial CLI to go away. Here is the solution to that problem, named appropriately: RUNBACKGROUND which starts and runs a background task. This does indeed allow you to create a startup script that will set up your workbench running any programs you might wish, removing the initial CLI in the process. Your s/startup-sequence can contain lines such as the following: RUNBACKGROUND -3 clock RUNBACKGROUND utilities/calculator RUNBACKGROUND -5 utilities/notepad where RUNBACKGROUND is the command and the second parameter is the filename which may be preceded by a flag-variable that specifies an optional delay time. The delay can be from 0 to 9, for the number of seconds that the startup script should sleep while allowing the background task to load and start. I've put that in to minimize thrashing of the disk as it tries to load several projects at once. LIMITATIONS: The program that you run cannot require any input from an interactive CLI that starts it. Additionally, you cannot specify any file redirection in the command line since this program provides the redirection for you already. If you need to use redirection for your command, you can modify the source code where shown, thus allowing the redirection to become one of the parameters passed through to your program. RUNBACKGROUND does pass your command line parameters to the program you wish to start, but limits the total length of your command string to 227 (255 minus the 28 characters for "RUN >NIL: NIL: < NIL: " following it.) LINKING INFORMATION: (Amiga/Lattice C) use -v option for pass 2 (lc2 -v filename.q) to disable stack checking code installation. (stack checking code sometimes is incorrect). FROM lib:Astartup.obj runbackground.o TO runbackground LIBRARY lib:amiga.lib, lib:lc.lib **************************** NOTE: ******************************** If you use Lstartup.obj, it won't let the startup CLI go away. This is because the source code for Lstartup.asm either opens its own window or uses an existing CLI window (Open("*",....)), so that it has some guaranteed place to put the output. Astartup.obj does not do this. ********************************************************************* Hope this helps. robp. */ SHAR_EOF if test 2695 -ne "`wc -c README.peck`" then echo shar: error transmitting README.peck '(should have been 2695 characters)' fi # End of shell archive exit 0