add -x argument to create individual files without zip file

This commit is contained in:
Martins Mozeiko
2017-10-30 23:25:56 -07:00
parent cb2a4e0c3f
commit 68e7dc8051
6 changed files with 265 additions and 93 deletions
+6 -4
View File
@@ -1,8 +1,6 @@
#if defined(__MINGW32__) && !defined(__x86_64__)
# define _USE_32BIT_TIME_T
# define __CRT__NO_INLINE
#elif defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
#endif
#include "pkg2zip_zip.h"
@@ -102,7 +100,7 @@ void zip_create(zip* z, const char* name)
void zip_add_folder(zip* z, const char* name)
{
size_t name_length = strlen(name);
size_t name_length = strlen(name) + 1;
if (name_length > ZIP_MAX_FILENAME)
{
fatal("ERROR: dirname too long\n");
@@ -131,7 +129,11 @@ void zip_add_folder(zip* z, const char* name)
z->total += sizeof(header);
sys_write(z->file, z->total, name, (uint16_t)name_length);
z->total += name_length;
z->total += name_length - 1;
char slash = '/';
sys_write(z->file, z->total, &slash, 1);
z->total += 1;
}
void zip_begin_file(zip* z, const char* name)