home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / debug / Debugger / PowerVisor / S / pv / cmd.pv < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.0 KB  |  54 lines

  1. /*=======================================================*/
  2. /*                                                                            */
  3. /* Execute cli commands from within PowerVisor        V1.1    */
  4. /*                                                                            */
  5. /* © Jorrit Tyberghein  17 Sep 1991    V1.0                        */
  6. /*                                20 Jul 1992 V1.1                        */
  7. /*                                                                            */
  8. /*=======================================================*/
  9.  
  10. options results
  11. parse arg cmd
  12. if cmd=='' then
  13.     do
  14.         'print "Bad argument!\n"'
  15.         exit
  16.     end
  17.  
  18. ti=pragma('Id')
  19.  
  20. parse var cmd cmd rest
  21. address command cmd '>t:cmd'ti rest
  22. if rc~=0 then
  23.     'print "Warning: Command failed with returncode' rc '!\n"'
  24. if ~open(file,'t:cmd'ti,'R') then
  25.     do
  26.         address command 'delete t:cmd'ti' >nil:'
  27.         'print "Error opening file !\n"'
  28.         exit
  29.     end
  30.  
  31. /* Prepare for interruption */
  32. 'assign stop'ti'=0'
  33. "attach 'stop"ti"=1' 51 8 e"        /* ctrl-c */
  34. at = result
  35.  
  36. line=readln(file)
  37. do while ~eof(file)
  38.     'print "·Å'line'Å\0a"'
  39.     line=readln(file)
  40.     'void stop'ti
  41.     if result==1 then
  42.         do
  43.             'print "Break***\n"'
  44.             leave
  45.         end
  46. end
  47.  
  48. 'remvar stop'ti
  49. 'remattach 'at
  50.  
  51. call close file
  52. address command 'delete t:cmd'ti' >nil:'
  53. exit
  54.