home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 274.lha / RunBack_v5.0 / ReadMe < prev    next >
Text File  |  1989-07-24  |  8KB  |  201 lines

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