2 * Copyright (c) 2003 Guido Draheim <guidod@gmx.de>
3 * Use freely under the restrictions of the ZLIB license.
5 * This file is used as an example to clarify zzip api usage.
6 * (the write-api is work in progress, beware)
9 #define _ZZIP_WRITE_SOURCE
11 #include <zzip/write.h>
14 #include "zzipmake-zip.h"
16 #ifdef ZZIP_HAVE_UNISTD_H
23 int rezzip_make (int argc, char ** argv)
29 dir = zzip_dir_creat(argv[1], 0755);
32 fprintf (stderr, "did not creat %s: \n", argv[1]);
37 fprintf (stderr, "(ignored)\n");
40 for (argn=2; argn < argc; argn++)
42 int input = open (argv[argn], O_RDONLY);
50 char buf[17]; zzip_ssize_t n;
51 ZZIP_FILE* output = zzip_file_creat (dir, argv[argn], 0755);
54 fprintf (stderr, "|did not open %s: \n", argv[argn]);
55 fprintf (stderr, "|%s: %s\n", argv[argn],
56 zzip_strerror_of(dir));
60 while ((n = read (input, buf, 16)))
62 zzip_write (output, buf, n);
75 * c-file-style: "stroustrup"