use "io.eh" use "zip/ZipEntry.eh" use "zip/ZipIStream.eh" def iZo(zis: ZipIStream, out: OStream) { var buf = new [Byte](8192); var count = 0; do { out.writearray(buf, 0, count); count = zis.readarray(buf, 0, count); } while (count != -1); } def main(args: [String]) { var zis: ZipIStream = new ZipIStream(fopen_r(args[0])); var out = args[1]; var entry: ZipEntry; var entry_name = ""; while((entry = zis.getNextEntry()) != null) { entry_name = entry.get_name(); if (entry.isdir()) { mkdir(out+entry_name); } else { fcreate(out+entry_name); var os = fopen_w(out+entry_name); iZo(zis, os); } } }