home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
pub
/
tools
/
unjar
< prev
Wrap
Text File
|
2020-01-01
|
794b
|
35 lines
#!/opt/local/bin/kermit +
#
# Break a "jar" (join archive) file apart into its constituent files.
#
if != \v(argc) 2 {
echo " Usage: \fword(\%0,-1) jarfilename"
exit 1
}
fopen /read \%c \%1
if fail exit 1
.lines = 0
.files = 0
while 1 {
fread /line /trim \%c line
if fail {
if files fclose \%o
exit 0 OK
}
increment lines
if == files 0 if not match "\m(line)" "<<< * >>>" continue
if match "\m(line)" "<<< * >>>" {
if files fclose \%o
if fail exit 1 FCLOSE FAILED
echo OK
.name := \fword(\m(line),2,\32,ALL)
fopen /write \%o \m(name)
if fail exit 1 OPEN /WRITE FAILED: \m(name)
increment files
xecho \m(name)...
continue
}
fwrite /line \%o \m(line)
if fail exit 1 FWRITE /LINE FAILED
}