OPTIONS "C_CALL LABELCHECK WINFUNC NOSOURCE"
NUMERIC DIGITS 10
LIBRARY rexxgui
DO
zipprint = '32u, void, 32u'
zipcomment = 'void, void'
zippassword = '32, void, 32, void, void'
zipfuncs = "func ZIPPRINT, func ZIPCOMMENT, func ZIPPASSWORD, void"
FUNCDEF("ZpInit", "32, struct ZIPFUNCS", "zip32")
zipopts = "void, str *, void, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 32u, 8u"
FUNCDEF("ZpSetOptions", "32u, struct ZIPOPTS", "zip32")
zipnames = "str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *, str *"
FUNCDEF("ZpArchive", "32, 32u, str, struct ZIPNAMES", "zip32")
CATCH FAILURE
CONDITION("M")
RETURN
END
zipnames = ''
err = guifile('ZipNames', 'EXISTING|MULTIPLE', 'Pick out files to zip')
IF err = '' THEN DO
zipfuncs.1 = 'ZipPrint'
zipfuncs.2 = 'ZipComment'
zipfuncs.3 = 'ZipPassword'
zipfuncs.4 = 0
IF zpinit(zipfuncs) == 0 THEN DO
guisay("ZpInit failure!")
RETURN
END
DO i = 1 TO 32
zipopts.i = 0
END
zipopts.2 = DIRECTORY()
zpsetoptions(zipopts)
IF zipnames.0 > 16 THEN zipnames.0 = 16
zipname = SEARCHPATH('%TEMP%') || "test.zip"
DELETEFILE(zipname)
IF zparchive(zipnames.0, zipname, zipnames) \== 0 THEN guisay("ZpArchive error!")
END
RETURN
zippassword:
RETURN 1
zipprint:
IF ARG(2) > 0 THEN DO
def = 'char[' || ARG(2) || ']'
IF CONVERTDATA(ARG(1), 'text', def) \== "" THEN SAY text
END
RETURN ARG(2)
zipcomment:
text = ""
CONVERTDATA(ARG(1), 'text', 'str', 'FROM')
RETURN ARG(1) |
|