summaryrefslogtreecommitdiff
path: root/src/base/archive.c~
diff options
context:
space:
mode:
authorTomas Chvatal (scarabeus) <tomas.chvatal@gmail.com>2008-10-22 22:51:24 +0200
committerTomas Chvatal (scarabeus) <tomas.chvatal@gmail.com>2008-10-22 22:51:24 +0200
commit44daf03024fbf7cbffa10349044786f6ab784821 (patch)
treefe311eb22e2d853dfc18fde1a9e55d21815f4f82 /src/base/archive.c~
parente12753d2ec9db83ec08bb9db63902a82fb245cdd (diff)
Revert "X"
This reverts commit e12753d2ec9db83ec08bb9db63902a82fb245cdd.
Diffstat (limited to 'src/base/archive.c~')
-rw-r--r--src/base/archive.c~73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/base/archive.c~ b/src/base/archive.c~
deleted file mode 100644
index ac57721..0000000
--- a/src/base/archive.c~
+++ /dev/null
@@ -1,73 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <zzip/zzip.h>
-
-#include "archive.h"
-
-#define ARCHIVE_BUFFER_SIZE 1024
-#define STR_TMP_FILE_NAME 4096
-
-char *extractFileFromArchive(char *archive, char *filename)
-{
- char buf[ARCHIVE_BUFFER_SIZE];
- char archive_name[STR_TMP_FILE_NAME];
- char name[STR_TMP_FILE_NAME];
-
- ZZIP_FILE *zip_file;
- FILE *file;
- zzip_ssize_t len;
-
- strcpy(archive_name, archive);
- sprintf(strrchr(archive_name, '.'), "/%s", filename);
-
- sprintf(name,"/tmp/tuxanci%d-%s", getpid(), filename);
-
- if( (zip_file = zzip_open(archive_name, O_RDONLY)) == NULL )
- {
- fprintf(stderr, "No do not open %s archive\n", archive_name);
- return NULL;
- }
-
- if( (file = fopen(name, "wb")) == NULL )
- {
- fprintf(stderr, "No do not create temp file %s\n", name);
- return NULL;
- }
-
- do{
- len = zzip_read(zip_file, buf, ARCHIVE_BUFFER_SIZE);
- //printf("len = %d\n", len);
-
- if( len > 0 )
- {
- fwrite(buf, len, 1, file);
- }
- }while( len > 0 );
-
- zzip_close(zip_file);
- fclose(file);
-
- return strdup(name);
-}
-
-void deleteExtractFile(char *s)
-{
- unlink(s);
- free(s);
-}
-
-#if ARCHIVE_TEST
-int main()
-{
- char *name;
-
- name = extractFileFromArchive("hello/a/b/hello");
- printf("name = %s\n", name);
- deleteExtractFile(name);
- return 0;
-}
-#endif
-