2 Copyright (C) 2012 Modelon AB
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the BSD style license.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 FMILIB_License.txt file for more details.
12 You should have received a copy of the FMILIB_License.txt file
13 along with this program. If not, contact Modelon AB <http://www.modelon.com>.
18 #include <JM/jm_types.h>
19 #include <JM/jm_callbacks.h>
20 #include <FMI/fmi_zip_zip.h>
22 static void importlogger(jm_callbacks* c, jm_string module, jm_log_level_enu_t log_level, jm_string message)
24 printf("module = %s, log level = %d: %s\n", module, log_level, message);
27 int main(int argc, char *argv[])
29 jm_status_enu_t status;
30 jm_callbacks callbacks;
32 const char** files_to_zip;
33 int i, n_files_to_zip;
35 callbacks.malloc = malloc;
36 callbacks.calloc = calloc;
37 callbacks.realloc = realloc;
38 callbacks.free = free;
39 callbacks.logger = importlogger;
40 callbacks.log_level = jm_log_level_warning;
42 callbacks.context = 0;
45 printf("Not enought input arguments\n");
49 output_name = argv[1];
50 files_to_zip = (const char**)&argv[2];
51 n_files_to_zip = argc - 2;
53 printf("Will compress following files: \n");
54 for (i = 0; i < n_files_to_zip; i++) {
55 printf( "\t%s\n", files_to_zip[i]);
57 status = fmi_zip_zip(output_name, n_files_to_zip, files_to_zip, &callbacks);
59 if (status == jm_status_error) {
60 printf("Failed to compress the file\n");
63 printf("Succesfully compressed the file\n");