@@ -14,19 +14,19 @@ local function patch(p)
1414 for m in o :lines ()do b :write (m .. ' \n ' )end o :close ()b :close ()
1515 o ,e = io.open (f ," w" )if not o then return abort ()end
1616 b ,e = io.open (f .. " .orig" )if not b then return abort ()end
17- if of then of :close ()end if bf then bf :close ()end of = o bf = b return true end
18- local function writeRemainder ()if of then local rest = bf :read (" *l" )while rest do of :write (rest .. ' \n ' )rest = bf :read (" *l" )end of :close ()end bf :close ()end
17+ if of then of :close ()end if bf then bf :close ()end of , ol , bf , bl , h = o , 0 , b , 0 , nil return true end
18+ local function writeRemainder ()if of then local rest = bf :read (" *l" )while rest do of :write (rest .. ' \n ' )rest = bf :read (" *l" )end of :close ()of , ol = nil , 0 end bf :close ()bf , bl , h = nil , 0 , nil end
1919 local n = pf :read (" *l" )while n do
2020 local l ,ls = n n = pf :read (" *l" )ls = l :sub (1 ,1 )
2121 if ls == ' +' then
22- if l :sub (2 ,4 )== " ++ " then -- ignore
23- else if of then local nl = n and n :match (" ^\\ No newline at end of file" )of :write (l :sub (2 ).. (nl and " " or ' \n ' ))ol = ol + 1 end end
22+ if l :sub (2 ,4 )== " ++ " then -- ignore
23+ else if of then local nl = n and n :match (" ^\\ No newline at end of file" )of :write (l :sub (2 ).. (nl and " " or ' \n ' ))ol = ol + 1 end end
2424 elseif ls == ' -' then
2525 if l :sub (2 ,4 )== " -- " then local filename = parseFileName (l )if bf then writeRemainder ()end
2626 if setPatchFile (filename )then cp = filename print (" \n '" .. cp .. " ':" )end
27- else local cmp = bf :read (" *l" )bl = bl + 1 if cmp ~= l :sub (2 )then print (M )os.exit (1 )end end
27+ else local cmp = bf :read (" *l" )bl = bl + 1 if cmp ~= l :sub (2 )then print (M )os.exit (1 )end end
2828 elseif ls == ' ' then
29- if bf then local cmp ,line = bf :read (" *l" ),l :sub (2 )bl = bl + 1 if cmp == line then if of then of :write (line .. ' \n ' )ol = ol + 1 end else print (M )os.exit (1 )end end
29+ if bf then local cmp ,line = bf :read (" *l" ),l :sub (2 )bl = bl + 1 if cmp == line then if of then of :write (line .. ' \n ' )ol = ol + 1 end else print (M )os.exit (1 )end end
3030 elseif ls == ' @' then if l :sub (2 ,3 )== " @ " then
3131 local function parseHunkHeader ()
3232 local function split (i ,d )local r = {}for m in (i .. d ):gmatch (" (.-)" .. d )do table.insert (r ,m )end return r end
0 commit comments