]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
remove convert and read config tool
authorBastian Dehn <hhaalo@arcor.de>
Sat, 9 Mar 2024 09:34:21 +0000 (10:34 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 9 Mar 2024 09:34:21 +0000 (10:34 +0100)
CMakeLists.txt
tools/CMakeLists.txt [deleted file]
tools/convert.c [deleted file]
tools/read_config.c [deleted file]

index e2c20af1d4922f6f484f1b881a18fab7354e1c48..5e09393b068b7acb28aaf5d30fb4ebbcc2c9ae1c 100644 (file)
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.25.1)
 project("kds_s2000w_net" VERSION "0.0.1")
 
 add_subdirectory(src)
-add_subdirectory(tools)
 
 set(RUN_TESTS OFF CACHE BOOL "build and run tests")
 
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
deleted file mode 100644 (file)
index d31d605..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-cmake_minimum_required(VERSION 3.25.1)
-
-add_executable("convert" "convert.c")
-add_dependencies("convert" sane-kds_s2000w_net)
-target_link_libraries("convert" sane-kds_s2000w_net)
-
-add_executable("read_config" "read_config.c")
-add_dependencies("read_config" sane-kds_s2000w_net)
-target_link_libraries("read_config" sane-kds_s2000w_net)
\ No newline at end of file
diff --git a/tools/convert.c b/tools/convert.c
deleted file mode 100644 (file)
index 073a946..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "../src/kds_s2000w_image_converter.h"
-
-void read_file(const char* filename, blobdata* input)
-{
-       FILE* fptr = fopen(filename, "r");
-       if (fptr == NULL) {
-               printf("file %s not found\n", filename);
-               exit(1);
-       }
-
-       input->data = malloc(sizeof(char));
-       while(fread(input->data, sizeof(char), 1, fptr)) {
-               input->size++;
-       }
-       fseek(fptr, 0L, SEEK_SET);
-       printf("file size of %s: %i bytes\n", filename, input->size);
-
-       input->data = malloc(sizeof(char) * input->size);
-       fread(input->data, input->size, 1, fptr);
-       fclose(fptr);
-       fptr = NULL;
-}
-
-void write_file(blobdata* output)
-{
-       FILE* fptr = fopen("output.pnm", "w");
-       fwrite(output->data, output->size, 1, fptr);
-       printf("file size of output.pnm: %i bytes\n", output->size);
-       fclose(fptr);
-       fptr = NULL;
-}
-
-void printf_header_bytes(const char* data)
-{
-       const int header_spaces = 3;
-       const char space = 0x0a;
-       int space_count = 0;
-       int byte_count = 0;
-
-       while(space_count < header_spaces && byte_count < 50) {
-               printf("%02hhx ", data[byte_count]);
-               if (data[byte_count] == space) {
-                       space_count++;
-               }
-
-               byte_count++;
-       }
-
-       char* header = malloc(sizeof(char) * byte_count);
-       snprintf(header, byte_count, "%s", data);
-       printf("\nheader:\n%s\n", header);
-       printf("header has %i bytes\n", byte_count);
-       free(header);
-       header = NULL;
-}
-
-int main(int argc, char* argv[])
-{
-       blobdata input;
-       input.size = 0;
-       input.data = NULL;
-       blobdata output;
-       output.size = 0;
-       output.data = NULL;
-
-       read_file(argv[1], &input);
-
-       kds_s2000w_convert_init();
-       kds_s2000w_convert_jpg_to_pnm_with_depth(&input, &output, 8);
-       kds_s2000w_convert_terminate();
-
-       printf_header_bytes((const char*) output.data);
-       write_file(&output);
-
-       free(input.data);
-       input.data = NULL;
-       free(output.data);
-       output.data = NULL;
-       return 0;
-}
\ No newline at end of file
diff --git a/tools/read_config.c b/tools/read_config.c
deleted file mode 100644 (file)
index 849cbed..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "../src/kds_s2000w_config.h"
-
-int main(int argc, char** argv)
-{
-       program_config* config = malloc(sizeof(program_config));
-
-       printf("config file %s\n", argv[1]);
-       char* config_stream = read_config_file(argv[1]);
-       load_config(config, config_stream);
-
-       printf("scanner_url: %s\n", config->scanner_url);
-       printf("username: %s\n", config->username);
-
-       free(config_stream);
-       config_stream = NULL;
-       free(config->scanner_url);
-       config->scanner_url = NULL;
-       free(config->username);
-       config->username = NULL;
-       free(config);
-       config = NULL;
-
-       return 0;
-}
\ No newline at end of file