home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff240.lzh / RunBack / ReadMe < prev    next >
Text File  |  1989-08-28  |  8KB  |  214 lines

  1. RunBack version 6.  Original program by Rob Peck.
  2.     *
  3.     *    improved 8/10/89 by Doug Keller
  4.     *
  5.     *    compiled with Lattice C v5.02 with:
  6.     *        -rr    registerized parameters
  7.     *        -v     no stack checking
  8.     *        -w     short integers
  9.     *        -cusf  unsigned chars, only one occurence of same
  10.     *               string, force prototyping
  11.     *        -O     global optimizer
  12.     *
  13.     *    linked wth cres.lib,  program can be resident now!
  14.     *
  15.     *
  16.  
  17. Runs programs in the background fully detached from the
  18. initial CLI, unlike the RUN command alone.  CLI will not
  19. "hang around," waiting for the program to close.
  20.  
  21. * Improved 7/14/89 by Greg Searle
  22.  
  23. * Doesn't crash anymore when a task tries to access the CLI.
  24. * Allows priority setting.
  25. * Major code cleanup and simplification.
  26.  
  27. Usage:  RUNBACK [[-]delay [priority]] command [arguments...]
  28.  
  29. "delay" is a time in seconds for RunBack to wait for the command
  30. to load.  This is useful if you are starting up many tasks from
  31. a script, and wish to avoid "disk-thrashing" caused by many
  32. tasks trying to load at once.  Dash is optional (Kept for
  33. compatibility).
  34.  
  35. "priority" is the system task priority that you wish to run this
  36. task at.  Recommended values are -5 to 5, with the current
  37. priority being the default (usually 0).  Theoretically may be
  38. -127 to 127, but this could lock out essential system tasks.
  39. Use this with care, as it's very easy to lock yourself out of
  40. the CLI or Workbench with a high-priority, runaway task.
  41.  
  42. "command" is the program that you wish to run.  RunBack
  43. simply passes on your arguments to the RUN command.  This may be
  44. in your C: directory or in any other directory that your PATH
  45. is set to.  This path will also be searched for your command.
  46. Order is totally up to AmigaDOS.  It's a little strange.
  47.  
  48. "arguments" are, of course, the arguments that you wish to pass
  49. to your program.  Note that the program won't be able to input
  50. or output to the CLI, or to anywhere else.  These are re-directed
  51. to the NIL: device.
  52.  
  53. This version solves the major problem with the original:  the system would
  54. crash when a program tried to input or output to the CLI.  This is now
  55. corrected.  The program will properly access the NIL: device, merrily
  56. outputting its data into the void, and receiving blank nothings for input -
  57. as it should be.  I have yet to find a program that will crash with this.
  58.  
  59.                               - Greg 7/14/89
  60.  
  61. I took the liberty of removing obsolete code, files, and comments from this
  62. archive.  Earlier README files are included after the dotted line.  Version
  63. 3 was used as a base for version 5, so version 4's notes are not included
  64. here.
  65.  
  66. Compiled in Manx 3.6a, but should compile in Lattice.
  67.  
  68. -----------------------------------------------------------------
  69. Author:      Daniel Barrett            [version 3]
  70.       Department of Computer Science
  71.       The Johns Hopkins University
  72.       Baltimore, MD  21218
  73.  
  74.       barrett@cs.jhu.edu
  75.       ins_adjb@jhunix.UUCP
  76.  
  77. Note:      Both the original RunBackground and Which are in 
  78.       the Public Domain.  So is all my code that I added.
  79.       Use it however you please.
  80.  
  81. INTRODUCTION
  82. ------------
  83.    This is my altered version of Rob Peck's fine program, RunBack.
  84. RunBack, similar to Run, allows you to startup a CLI program and let
  85. it run in the background.  Unlike Run, however, RunBack then allows 
  86. the original CLI to be closed.  Run would hang the CLI if you did this.
  87. See the file README.peck for Rob Peck's original documentation.
  88.  
  89.    Also unlike Run, the old RunBack did not search your command search
  90. path; you always had to specify the complete pathname of your command.
  91. My new version eliminates this hassle -- it searches your path.
  92.  
  93.    The path-searching code is largely taken from Carolyn Scheppner's
  94. "Which" program.  Thanks, Carolyn!!
  95.  
  96. A PROBLEM I HAD TO OVERCOME
  97. ---------------------------
  98.  
  99.    The original RunBack program I obtained was a binary version, 
  100. compiled with the Lattice C compiler.  I use the Manx (Aztec) compiler, 
  101. version 3.6a.  When I compiled Rob's original program with Manx, something
  102. did not work anymore... quoted arguments on the command line.  The Manx 
  103. version completely drops the quotes!
  104.  
  105. The way RunBack works is that it translates:
  106.  
  107.    RunBack myProgram arg1 arg2
  108.  
  109. into:
  110.  
  111.    Run >NIL: <NIL: myProgram >NIL: <NIL: arg1 arg2
  112.  
  113. So a Lattice RunBack would translate from:
  114.  
  115.    RunBack c:emacs "my file"
  116.  
  117. into:
  118.  
  119.    Run >NIL: <NIL: c:emacs >NIL: <NIL: "my file"
  120.  
  121. HOWEVER, Manx-compiled RunBack translates it into:
  122.  
  123.    Run >NIL: <NIL: c:emacs >NIL: <NIL: my file
  124.  
  125. which is clearly WRONG.
  126.  
  127.    What did I do about it?  I added a few lines of #ifdef AZTEC_C
  128. code to the runback.c program, plus the file aztec.c.  I am effectively
  129. replacing quotes around quoted arguments.  My algorithm is this:  if
  130. an argument has a blank space in it, then it must have been quoted, so
  131. put quotes around it.
  132.    If you don't like this algorithm, the source code is included 
  133. and you can change it any way you like.
  134.    Since I don't have the Lattice compiler, I cannot be sure that
  135. my changes will work under Lattice.  That is why I made all my changes
  136. #ifdef AZTEC_C, a constant that is automatically defined by Manx C
  137. after version 3.4a.
  138.  
  139.    Enjoy the program!
  140.  
  141. -----------------------------------------------------------------------------
  142.  
  143. --------------
  144. runbackground.c   [original version by Rob Peck]
  145. ---------------
  146.  
  147. SUMMARY:  A Workbench Disk can be used to autostart an application
  148.      through the use of the startup script and close the startup CLI.
  149.  
  150.  
  151. Users have commented that it is not possible to start a process going 
  152. from the startup script and then cause the initial CLI to go away.   
  153. Here is the solution to that problem, named appropriately:
  154.  
  155.    RUNBACKGROUND
  156.  
  157. which starts and runs a background task.  This does indeed allow you to
  158. create a startup script that will set up your workbench running any
  159. programs you might wish, removing the initial CLI in the process.
  160.  
  161. Your s/startup-sequence can contain lines such as the following:
  162.  
  163.    RUNBACKGROUND -3 clock
  164.    RUNBACKGROUND utilities/calculator
  165.    RUNBACKGROUND -5 utilities/notepad
  166.  
  167. where RUNBACKGROUND is the command and the second parameter is the filename
  168. which may be preceded by a flag-variable that specifies an optional delay 
  169. time.  The delay can be from 0 to 9, for the number of seconds that 
  170. the startup script should sleep while allowing the background task to 
  171. load and start.  I've put that in to minimize thrashing of the disk as it
  172. tries to load several projects at once.
  173.  
  174.  
  175. LIMITATIONS:
  176.  
  177.     The program that you run cannot require any input from an interactive
  178.     CLI that starts it.    Additionally, you cannot specify any file 
  179.     redirection in the command line since this program provides the
  180.     redirection for you already.  If you need to use redirection for
  181.     your command, you can modify the source code where shown, thus
  182.     allowing the redirection to become one of the parameters passed
  183.     through to your program.
  184.  
  185.     RUNBACKGROUND does pass your command line parameters to the program
  186.     you wish to start, but limits the total length of your command
  187.     string to 227 (255 minus the 28 characters for "RUN >NIL: <NIL: " 
  188.     preceding your own file pathname and ">NIL: < NIL: " following it.)
  189.  
  190.  
  191. LINKING INFORMATION:
  192.  
  193.     (Amiga/Lattice C)   use -v option for pass 2   (lc2 -v filename.q)
  194.          to disable stack checking code installation.
  195.          (stack checking code sometimes is incorrect).
  196.  
  197.     FROM lib:Astartup.obj runbackground.o
  198.     TO runbackground
  199.     LIBRARY lib:amiga.lib, lib:lc.lib
  200.  
  201.     ****************************  NOTE:  ********************************
  202.     If you use Lstartup.obj, it won't let the startup CLI go away. This is
  203.     because the source code for Lstartup.asm either opens its own window 
  204.     or uses an existing CLI window (Open("*",....)), so that it has some 
  205.     guaranteed place to put the output.   Astartup.obj does not do this.
  206.     *********************************************************************
  207.  
  208. Hope this helps.
  209.  
  210.  
  211. robp.
  212. */
  213.  
  214.