home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxrsync.zip / rsyncts2.cmd < prev    next >
OS/2 REXX Batch file  |  1999-11-15  |  3KB  |  97 lines

  1. /* 10 November 1999. Daniel Hellerstein (danielh@crosslink.net)
  2.     RsyncTst: example of how to use the RxRSYNC procedures 
  3.     This version uses macrospace, and use REXXLIB procedures.
  4.    See RxRSYNC.DOC for the details
  5. */
  6.  
  7.  
  8. /* load the various DLL and macrospace libraries */
  9. a=load_libs()
  10. if a<>0 then do
  11.    say a                /* an error message */
  12.    exit   /* 0 means "okay" */
  13. end
  14.  
  15. synopfile='synop.rsy'    /* name to use for synopsis file */
  16. difffile='diff.rsy'     /* name to use for difference file */
  17. quiet=0                /* set to 1 suppress some output */
  18.  
  19. parse arg oldfile newfile outfile .
  20.  
  21. say "Test of the RxRSYNC procedures (macrospace version) "
  22. if oldfile='' | oldfile='?' | newfile='' then do
  23.    say "Call using: "
  24.    say "   RSYNCtst oldfile newfile outfile "
  25.    say " where: "
  26.    say "     oldfile: the old version  of a file"
  27.    say "     newfile: the new version of a file "
  28.    say "     outfile: name to use for the the duplicate of the newfile"
  29.    say " In addition, 'synopfile' and 'difffile ' will be created "
  30.    exit
  31. end /* do */
  32.  
  33. if outfile='' then outfile='RSYNCTST.OUT'
  34.  
  35. say " "
  36. say "Step1: create the synopsis file ("synopfile
  37. status=rsync_client(oldfile,synopfile,'This is a test of rsync',quiet)
  38. say "rsync client status: " status
  39. if abbrev(status,'OK')<>1 then exit
  40.  
  41. say ' '
  42. say "Step 2: create the difference file ("difffile
  43. status=rsync_server(synopfile,newfile,difffile,quiet)
  44. say "rsync server status: "status
  45. if abbrev(status,'OK')<>1 then exit
  46.  
  47. say ' '
  48. say "Step 3: duplicate the new file ("outfile
  49. status=rsync_undiff(oldfile,difffile,outfile,quiet)
  50. say "rsync undiff status: "status
  51.  
  52. exit
  53.  
  54.  
  55. /****************************************************************/
  56. /* read in some useful procedures */
  57. load_libs:procedure
  58.  
  59. if rxfuncquery('rx_rsync32')=1  then do
  60.   call RXFuncAdd 'RXRsyncLoad', 'RXRSYNC', 'RxRsyncLoad'
  61.   call RxRsyncLoad
  62. end
  63. if rxfuncquery('rx_md4')=1  then do
  64.   return "ERROR could not load  RxRsync.DLL"
  65. end
  66.  
  67. /* Load up advanced REXX functions */
  68. foo=rxfuncquery('sysloadfuncs')
  69. if foo=1 then do
  70.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  71.   call SysLoadFuncs
  72. end
  73. if rxfuncquery('sysfiledelete')=1  then do
  74.   return "ERROR could not load  REXXUTIL.DLL"
  75. end
  76.  
  77. foo=rxfuncquery('rexxlibregister')
  78. if foo=1 then do
  79.  call rxfuncadd 'rexxlibregister','rexxlib', 'rexxlibregister'
  80.  call rexxlibregister
  81. end
  82. foo=rxfuncquery('rexxlibregister')
  83. if foo=1 then do
  84.   return "ERROR could not load  REXXLIB.DLL"
  85. end
  86.  
  87. if macroquery('RSYNC_CLIENT')='' then do
  88.    foo=macroload('rxrsync.rxl')
  89.    if foo=0 then return "ERROR could not load RxRSYNC.RXL"
  90. end /* do */
  91.  
  92. return 0
  93.  
  94.  
  95.  
  96.  
  97.