include	doszip/doszip.inc
ifdef __ARC__
include	io.inc
include	iost.inc
include	string.inc
include	conio.inc
ifdef __ZIP__
include	unzip.inc
endif
	public	cmmkzip
	public	cp_mkzip

_DATA	SEGMENT

cp_mkzip    db 'Create archive',0
default_zip db 'default.zip',0

_DATA	ENDS

_DZIP	SEGMENT

cmmkzip	proc dist pascal uses si di
local	path[WMAXPATH]:byte
	lea di,path
	call cpanel_state
	.if !ZERO?
	    invoke strcpy, ss::di, addr default_zip
	    .if func(tgetline, addr cp_mkzip, dx::ax, 40, WMAXPATH or 8000h)
	    	.if [di] != ah
		    invoke ogetouth, ss::di
		    mov si,ax
		    .if ax && ax != -1
		      ifdef __ZIP__
			mov bx,cpanel
			mov bx,[bx]
			mov ax,[bx]
			mov [bx.wp_arch],0
			and ax,not _W_ARCHIVE
			or  ax,_W_ARCHZIP
			mov [bx],ax
			add bx,wp_file
			invoke strcpy, ss::bx, addr path
		      endif
			mov bx,di
			push ss
			pop es
			cld
			mov ax,ZIPHEADERID
			stosw
			mov ax,ZIPENDSENTRID
			stosw
			mov cx,9
			xor ax,ax
			rep stosw
			invoke oswrite, si, ss::bx, SIZE S_ZEND
			invoke close, si
			call ret_update_AB
		    .endif
		.endif
	    .endif
	.endif
	ret
cmmkzip	endp

_DZIP	ENDS
endif
	END
