diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2018-09-26 23:48:37 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2018-09-26 23:48:37 +0300 |
commit | 1216b63c7b6864b0faeb2c6fd68a2a0ef5893f0e (patch) | |
tree | d19b992c6efc352eb075024e8fff2903e2da7669 /src/main.c | |
parent | 01a9391be1655617c9bb2f9922b4a51ac5ab4b93 (diff) | |
download | analogcolor-1216b63c7b6864b0faeb2c6fd68a2a0ef5893f0e.tar.gz |
Verbose output added
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -22,12 +22,15 @@ void print_usage(const char* self_name) int main(int argc, char** argv) { - if (argc != 4) + if (argc != 4 && argc != 5) { print_usage(argv[0]); + return 1; + } const char* input_file = argv[2]; const char* output_file = argv[3]; const int encode = *argv[1] == 'e'; + int verbose = 0; int width, height, components, out_components; int line = 0; @@ -37,6 +40,11 @@ int main(int argc, char** argv) unsigned char* input_image = stbi_load(input_file, &width, &height, &components, encode ? STBI_rgb : STBI_grey); + if (argc == 5) + if (*argv[4] == 'v') + verbose = 1; + + if (!input_image) { fprintf(stderr, "Unable to load image\n"); goto exit; @@ -53,6 +61,9 @@ int main(int argc, char** argv) ntsc_ctx* ctx = ntsc_create_context(width, encode); + if (verbose) + ntsc_enable_verbose(stderr, ctx); + if (!ctx) { fprintf(stderr, "Unable to crete ntsc context\n"); goto exit_free_input_image; |