Received: from PURCCVM.BITNET by FINTUVM.UTU.FI (Mailer X1.25) with BSMTP id
 6787; Fri, 08 Jul 88 22:44:38 EET
Received: from PURCCVM by PURCCVM.BITNET (Mailer X1.25) with BSMTP id 2745;
 Fri, 08 Jul 88 11:42:29 EST
Received: from j.cc.purdue.edu by VM.CC.PURDUE.EDU ; Fri, 08 Jul 88 11:42:11 EST
Received: by j.cc.purdue.edu (5.54/1.14)
    id AA25003; Fri, 8 Jul 88 11:39:53 EST
Date: Fri, 8 Jul 88 11:39:53 EST
From: ain@j.cc.purdue.edu (Patrick White)
Message-Id: <8807081639.AA25003@j.cc.purdue.edu>
To: fys-ma@fintuvm.BITNET
Subject: comp.binaries.amiga, comp.sources.amiga:
 sources/amiga/volume5/runback2.d.sh binaries/amiga/volume8/runback2.d.sh
 
Newsgroups: comp.binaries.amiga, comp.sources.amiga
Subject: RunBack (docs)
Keywords: runback, background
Approved: ain@j.cc.purdue.edu    (Patrick White)
 
Program Name:    RunBack  (docs 1 fo 1)
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: myProgram >NIL: <NIL: arg1 arg2
 
So a Lattice RunBack would translate from:
 
    RunBack c:emacs "my file"
 
into:
 
    Run >NIL: <NIL: c:emacs >NIL: <NIL: "my file"
 
HOWEVER, Manx-compiled RunBack translates it into:
 
    Run >NIL: <NIL: c:emacs >NIL: <NIL: my file
 
which is clearly WRONG.
 
    What did I do about it?  I added a few lines of #ifdef AZTEC_C
code to the runback.c program, plus the file aztec.c.  I am effectively
replacing quotes around quoted arguments.  My algorithm is this:  if
an argument has a blank space in it, then it must have been quoted, so
put quotes around it.
    If you don't like this algorithm, the source code is included
and you can change it any way you like.
    Since I don't have the Lattice compiler, I cannot be sure that
my changes will work under Lattice.  That is why I made all my changes
#ifdef AZTEC_C, a constant that is automatically defined by Manx C
after version 3.4a.
 
    Enjoy the program!
SHAR_EOF
if test 2561 -ne "`wc -c README`"
then
echo shar: error transmitting README '(should have been 2561 characters)'
fi
echo shar: extracting README.peck '(2695 characters)'
cat << \SHAR_EOF > 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: "
    preceding your own file pathname and ">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
