home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 633.lha / PrintFiles_v0.9 / Deutsch / Rexx / prf.rexx < prev    next >
OS/2 REXX Batch file  |  1992-04-15  |  2KB  |  75 lines

  1. /* printfiles Arexx Macro                              */
  2. /* © 1992 by K. Klingbeil                              */
  3. /* fügt Dateinamen mittels pattern-matching in die     */
  4. /* Druckliste ein                                      */
  5. /* Befehl   : rx prf [Einfügepattern] -r[Löschpattern] */
  6. /*                   -f[ArexxMakro]                    */
  7. /* Beispiel : rx prf  #?.c #?.h -rtest#?.c  -rtest.h   */
  8. /*            fügt alle Dateien im aktuellen           */
  9. /*            Verzeichnis, die auf .c oder .h enden in */
  10. /*            die Druckliste und löscht alle dateien   */
  11. /*            die test im Namen mit der Endung .c      */
  12. /*            und die Datei test.h                     */
  13. /* ArexxMakro ist der Name eines Arexx-Programms, das  */
  14. /* dabei ausgeführt werden soll (z.B. für Voreinstell- */
  15. /* ungen)                                              */
  16. /* Anmerkung: von Printfiles generierte Arexx-Programme*/
  17. /* sollten das erste Argument sein, da sie zu Beginn   */
  18. /* einen reset-Befehl beinhalten                       */
  19. /* Beispiel für die richtige Reihenfolge:              */
  20. /* rx prf -fPrintfiles.makro #?.c -rtest.c             */
  21.  
  22. options results
  23. address command 'rx prfstart' /* printfiles starten    */
  24. if result = 5 then exit       /* konnte nicht starten  */
  25.  
  26. parse arg CmdLine
  27. p = words(CmdLine)
  28.  
  29. do i = 1 to p
  30.    pattern = word(CmdLine,i)
  31.    if left(pattern,2) == '-r' then removefile(substr(pattern,3))
  32.     else
  33.      if left(pattern,2) == '-f' then rxfile(substr(pattern,3))
  34.       else insertfile(pattern)
  35. end
  36. exit
  37.  
  38. rxfile: procedure
  39. parse arg template
  40. cmd =  'rx ' template
  41. address command cmd
  42. return 1
  43.  
  44. removefile: procedure
  45. parse arg template
  46. cmd =  'list >pipe:prf' template 'quick'
  47. address command cmd
  48. address printfiles
  49. open('p','pipe:prf','r')
  50.  do while ~eof('p')
  51.   file = readln('p')
  52.   a = subword(file,1,1)
  53.   b = subword(file,2,1)
  54.   if a ~== '' & b == '' then remfile a
  55.  end
  56. close('p')
  57.  
  58. return 1
  59.  
  60. insertfile: procedure
  61. parse arg template
  62. cmd =  'list >pipe:prf' template 'quick'
  63. address command cmd
  64. address printfiles
  65. open('p','pipe:prf','r')
  66.  do while ~eof('p')
  67.   file = readln('p')
  68.   a = subword(file,1,1)
  69.   b = subword(file,2,1)
  70.   if a ~== '' & b == '' then insfile a
  71.  end
  72. close('p')
  73. return  1
  74.  
  75.