home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / awgt1512.zip / uninstl.cmd < prev   
OS/2 REXX Batch file  |  1999-07-25  |  3KB  |  120 lines

  1. /* REXX deinstallation script for Auto WGet
  2.  * Copyright (C) 1999 by Dmitry A.Steklenev
  3.  *
  4.  * $Revision: 1.5.1.2 $
  5.  */
  6.  
  7. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8. call SysLoadFuncs
  9.  
  10. parse source os what program tail
  11. dll = substr( program, 1, lastpos( "\", program )) || "awget.dll"
  12.  
  13. call RxFuncAdd 'AwLoadFuncs', dll, 'AwLoadFuncs'
  14. call AwLoadFuncs
  15.  
  16. '@echo off'
  17.  
  18. if translate( value( "REXX_TRACE",, "OS2ENVIRONMENT" )) == "YES" then do
  19.    trace intermediate
  20.    trace results
  21. end
  22.  
  23. CfgFile = value( "ETC",, "OS2ENVIRONMENT" )"\awget.cfg"
  24.  
  25. /*------------------------------------------------------------------
  26.  * Initialization
  27.  *------------------------------------------------------------------*/
  28.  
  29. say "Auto WGet Daemon $Revision: 1.5.1.2 $ deinstallation"
  30. say "Copyright (C) 1999 by Dmitry A.Steklenev"
  31. say ""
  32.  
  33. call MsgRead "awget"
  34.  
  35. say msg.msg_warning
  36. say ""
  37.  
  38. if MsgYesNo( "!!! "msg.msg_uninstl ) == 0 then
  39.    exit
  40.  
  41. rc = SysDestroyObject( "<AWG_DAEMON>" )
  42. rc = SysDestroyObject( "<AWG_TODO>"   )
  43.  
  44. say "Done!"
  45. exit
  46.  
  47. /*------------------------------------------------------------------
  48.  * National Messages Procedures
  49.  *------------------------------------------------------------------*/
  50. MsgRead: procedure expose msg.
  51.  
  52.   parse arg msgfile
  53.   parse source OS2 what msgpath
  54.  
  55.   msgfile = filespec( "disk", msgpath ) ||,
  56.             filespec( "path", msgpath ) || msgfile
  57.  
  58.   country = strip( SysIni( "BOTH", "PM_National", "iCountry" ),, '0'x )
  59.   country = right( country, 3, "0" )
  60.  
  61.   if stream( msgfile"."country, "c", "query exists" ) == "" then
  62.      country = "001"
  63.  
  64.   msgfile = msgfile"."country
  65.   rc = stream( msgfile, "C", "OPEN READ" )
  66.  
  67.   if rc \= "READY:" then do
  68.      say "ERROR: Error open message file: "msgfile
  69.      exit
  70.   end
  71.  
  72.   do while lines(msgfile) > 0
  73.      line = linein(msgfile)
  74.  
  75.      if line \= "" then do
  76.         parse value line with id "=" msg
  77.  
  78.         id  = translate(strip(id))
  79.         msg = strip(msg)
  80.  
  81.         i = pos( "\n", msg )
  82.         do while i > 0
  83.            msg = substr( msg, 1, i-1 ) || '0A0D'x || substr( msg, i+2 )
  84.            i = pos( "\n", msg )
  85.         end
  86.  
  87.         msg.id = msg
  88.      end
  89.   end
  90.  
  91.   rc = stream( msgfile, "C", "CLOSE" )
  92.  
  93. return
  94.  
  95. /*------------------------------------------------------------------
  96.  * Get Yes or No
  97.  *------------------------------------------------------------------*/
  98. MsgYesNo: procedure expose msg.
  99.  
  100.    parse arg prompt
  101.    ok = 0
  102.  
  103.    do until ok
  104.       call charout, prompt"? "
  105.       pull reply
  106.       reply = left(reply,1)
  107.  
  108.       ok = (reply == "Y") |,
  109.            (reply == "N") |,
  110.            (pos( reply, msg.msg_yes ) > 0 ) |,
  111.            (pos( reply, msg.msg_no  ) > 0 )
  112.  
  113.       if \ok then do
  114.          say msg.msg_badyn
  115.       end
  116.    end
  117.  
  118. return (reply = "Y") | (pos( reply, msg.msg_yes ) > 0 )
  119.  
  120.