string fileid,filename,tmpfid,extractfile,doextract,cnames
integer returncode
byte curbyte,prebyte,linelen,i
boolean wasdirty,dirtyline
doextract = upper(readline(ppepath()+ppename()+".cnf",1))
extractfile = readline(ppepath()+ppename()+".cnf",2)
cnames = readline(pcbdat(),31)
filename = gettoken()
if (len(filename) < 3) then
filename = readline(cnames,(curconf()*34)+19)+pcbmac("@OPTEXT@")
endif
freshline
rdunet pcbnode()
wrunet pcbnode(),"D",un_name(),un_city(),"FileID Cleaner",""
print "@X07[---(Fatal-ID-Executor v0.1 by cyberkid/food)--------( )---]"
backup 25
if (doextract = "YES") then
print "Extracting Fileid"
if (exist("file_id.diz")) delete "file_id.diz"
shell true,returncode,extractfile,filename+" UPLOAD "+fileinf(filename,9)
backup 17
endif
print "Cleaning FileId "
if (exist("file_id.diz")) then
wasdirty = false
fcreate 5,"file_id.tmp",o_rw,s_dn
fopen 6,"file_id.diz",o_rd,s_dn
while (!(ferr(6))) do
fread 6,curbyte,1
if (curbyte = 10) then
if (prebyte <> 13) then
wasdirty = true
fwrite 5,chr(13),1
endif
endif
fwrite 5,curbyte,1
prebyte = curbyte
endwhile
fclose 6
delete "file_id.diz"
fcreate 6,"file_id.diz",o_wr,s_dn
frewind 5
while (!(ferr(5))) do
dirtyline = true
fget 5,fileid
tmpfid = stripatx(fileid)
linelen = len(tmpfid)
for i = 1 to linelen
if (left(tmpfid,1) <> " ") then
dirtyline = false
wasdirty = true
endif
tmpfid = right(tmpfid,len(tmpfid)-1)
next
if (dirtyline = false) fputln 6,left(stripatx(fileid),45)
endwhile
fclose 5
fclose 6
delete "file_id.tmp"
backup 17
if (wasdirty = true) then
println "Shoot out the house!"
else
println "No nasties here! "
endif
else
backup 17
println "No FileId Found! "
endif
freshline
end