diff options
author | Chris Robinson <[email protected]> | 2020-04-04 08:58:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-04 08:58:06 -0700 |
commit | 9b11029af9274fc99414f4f007613f7073159fe5 (patch) | |
tree | 059d0dcb5fe9f7a8986f0a70014637bf9a0c22d7 | |
parent | 431d01cc7f271c6bcf4aaf931a4df760bae2847e (diff) |
Remove the now-unused native tools
-rw-r--r-- | native-tools/CMakeLists.txt | 18 | ||||
-rw-r--r-- | native-tools/bin2h.c | 100 |
2 files changed, 0 insertions, 118 deletions
diff --git a/native-tools/CMakeLists.txt b/native-tools/CMakeLists.txt deleted file mode 100644 index 994378b3..00000000 --- a/native-tools/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2) - -project(native-tools C) - -include(CheckLibraryExists) - -set(CPP_DEFS ) -if(WIN32) - set(CPP_DEFS ${CPP_DEFS} _WIN32) -endif(WIN32) - -add_executable(bin2h bin2h.c) -# Enforce no dressing for executable names, so the main script can find it -set_target_properties(bin2h PROPERTIES OUTPUT_NAME bin2h) -# Avoid configuration-dependent subdirectories while building with Visual Studio -set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}") -set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}") -target_compile_definitions(bin2h PRIVATE ${CPP_DEFS}) diff --git a/native-tools/bin2h.c b/native-tools/bin2h.c deleted file mode 100644 index 92f2b8a5..00000000 --- a/native-tools/bin2h.c +++ /dev/null @@ -1,100 +0,0 @@ - -#ifdef _MSC_VER -#define _CRT_SECURE_NO_WARNINGS -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -int main (int argc, char *argv[]) -{ - char* input_name; - FILE* input_file; - - char* output_name; - FILE* output_file; - - char* variable_name; - - if (4 != argc) - { - puts("Usage: bin2h [input] [output] [variable]"); - return EXIT_FAILURE; - } - - input_name = argv[1]; - output_name = argv[2]; - variable_name = argv[3]; - - input_file = fopen(input_name, "rb"); - - if (NULL == input_file) - { - printf("Could not open input file '%s': %s\n", input_name, strerror(errno)); - return EXIT_FAILURE; - } - - output_file = fopen(output_name, "w"); - - if (NULL == output_file) - { - printf("Could not open output file '%s': %s\n", output_name, strerror(errno)); - return EXIT_FAILURE; - } - - if (fprintf(output_file, "static const unsigned char %s[] = {", variable_name) < 0) - { - printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); - return EXIT_FAILURE; - } - - while (0 == feof(input_file)) - { - unsigned char buffer[4096]; - size_t i, count = fread(buffer, 1, sizeof(buffer), input_file); - - if (sizeof(buffer) != count) - { - if (0 == feof(input_file) || 0 != ferror(input_file)) - { - printf("Could not read from input file '%s': %s\n", input_name, strerror(ferror(input_file))); - return EXIT_FAILURE; - } - } - - for (i = 0; i < count; ++i) - { - if ((i & 15) == 0) - { - if (fprintf(output_file, "\n ") < 0) - { - printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); - return EXIT_FAILURE; - } - } - - if (fprintf(output_file, "0x%2.2x, ", buffer[i]) < 0) - { - printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); - return EXIT_FAILURE; - } - - } - } - - if (fprintf(output_file, "\n};\n") < 0) - { - printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); - return EXIT_FAILURE; - } - - if (fclose(output_file) < 0) - { - printf("Could not close output file '%s': %s\n", output_name, strerror(ferror(output_file))); - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} |