Skip to content

Commit 1bb28c6

Browse files
committed
Renamed function WriteRemaining(WR) to EndPatchFile(EPF) to more accurately describe the entire scope of the function.
1 parent 01ce00e commit 1bb28c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

xtra/PATCH.LUA

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local function patch(pf)
1111
local function RW(x)x:seek("set",0)end
1212
local function CF(a,b)local l,t,s=0,a:seek("end")RW(a)s=a:read("*l")repeat b:write(s..(l+#s<t and"\n"or""))l=l+#s s=a:read("*l")until not s end
1313
local function W(s)wl=wl+1 return wf:write(s)end
14-
local function WR()if h then if(h.o.l>0 and h.o.s>0)and(h.o.l~=rl-(h.o.s-1)or h.n.l~=wl-(h.n.s-1))then print(M)os.exit(1)else print(P)end end
14+
local function EPF()if h then if(h.o.l>0 and h.o.s>0)and(h.o.l~=rl-(h.o.s-1)or h.n.l~=wl-(h.n.s-1))then print(M)os.exit(1)else print(P)end end
1515
if rf and wf then local r,f,l=R()while r do W(r..'\n')r=R()end
1616
local function B()local n=cp:match("(.*)%.[^%.]*")..".bak"f=io.open(n,"a+")
1717
local function C()RW(f)RW(rf)repeat r,l=R(),rf:read("*l")if r~=l then return 1 end until not r or not l end
@@ -21,7 +21,7 @@ local function patch(pf)
2121
local n=pf:read("*l")while n do local l,f=n n=pf:read("*l")f=l:sub(1,1)if f=='+'then
2222
if l:sub(2,4)~="++ "then W(l:sub(2)..(n and n:match("^\\ No newline at end of file")and""or'\n'))end
2323
elseif f=='-'then
24-
if l:sub(2,4)=="-- "then local fn=PFN(l)if rf then WR()end if SPF(fn)then print("\t"..fn..":")cp=fn end
24+
if l:sub(2,4)=="-- "then local fn=PFN(l)if rf then EPF()end if SPF(fn)then print("\t"..fn..":")cp=fn end
2525
elseif R()~=l:sub(2)then print(M)os.exit(1)end
2626
elseif f==' 'then
2727
if rf then local c,i=R(),l:sub(2)if c==i then if wf then W(i..'\n')end else print(M)os.exit(1)end end
@@ -35,7 +35,7 @@ local function patch(pf)
3535
for _=1,s do
3636
local r=R()if not r then print(M)os.exit(1)end
3737
if wf then W(r.."\n")end end end end end end
38-
if rf then WR()end end
38+
if rf then EPF()end end
3939
if #arg<1 then print(arg[-1].." "..arg[0]..[[ diff...
4040
4141
Patch unified difference file(s)]])os.exit(1)end

0 commit comments

Comments
 (0)