home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / nopm01.zip / tn_patch.cmd < prev    next >
OS/2 REXX Batch file  |  2002-02-21  |  1KB  |  51 lines

  1. /*
  2.  * original cmd by Jugulator. thanks to nikl ;)
  3.  ---
  4.  this is patcher for telnetd.exe
  5.  ---
  6. */
  7.  
  8. Parse Arg filename;
  9.  
  10. Say '-----------------------------------------------';
  11. Say ' patcher for telnetd.exe IBM for textmode env. ';
  12. Say '-----------------------------------------------';
  13. Say '';
  14. if filename = '' then
  15. Do
  16.    Say 'Usage: tn_patch PATH\telnetd.exe';
  17. End
  18. Else
  19. Do
  20.    Say 'Trying to fix "'||filename||'"';
  21.    '@unlock '||filename||'>nul';
  22.    If Rc <> 0 then
  23.    Do
  24.       Say 'Cannot find or unlock file!';
  25.    End
  26.    Else
  27.    Do
  28.      rc = Stream(filename, 'c', 'open');
  29.      if rc = 'READY:' then
  30.      Do
  31.         sz = Chars(filename);
  32.         t = Pos( X2C('3200C706'), CharIn(filename,1,sz) );
  33.         If t > 0 Then
  34.         Do
  35.            Call CharOut filename, X2C('1E'), t;
  36.            Say 'Fix done!';
  37.         End
  38.         Else
  39.         Do
  40.            Say 'Failure!';
  41.            Say "Maybe telnetd.exe is already patched.";
  42.         End;
  43.         Call Stream exe, 'c', 'close';
  44.      End
  45.      Else
  46.      Do
  47.         Say 'File open error!';
  48.      End;
  49.    End;
  50. End;   
  51.