/* fat.cmd */

files = 'Object.h'

'@echo off'

if stream('typedstream.h', 'C', 'QUERY EXISTS') == '' then do
  say 'Already done'
  exit
end

do i = 1 to words(files)
  file = word(files, i)
  say 'Patching' file
  'sed -f fat.sed >tmp' file
  if rc \= 0 then do
    say 'sed failed!'
    exit
  end
  'touch -r' file 'tmp'
  'del' file
  'move tmp' file '>nul'
end

say 'Renaming files'
'ren typedstream.h typedstr.h'
'ren NXConstStr.h NXConstS.h'

say 'Done'
