]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add print header for convert
authorBastian Dehn <hhaalo@arcor.de>
Sat, 10 Feb 2024 14:05:47 +0000 (15:05 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 10 Feb 2024 14:05:47 +0000 (15:05 +0100)
tools/convert.c

index 82fc05eb7424d367c9ec319b5b65c3c5e6849e4d..a6f0d3ee7f2c37126a456e74ad627cfb08989ce0 100644 (file)
@@ -15,7 +15,7 @@ void read_file(const char* filename, blobdata* input)
                input->size++;
        }
        fseek(fptr, 0L, SEEK_SET);
-       printf("file size of %s: %i byts\n", filename, input->size);
+       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);
@@ -48,7 +48,12 @@ void printf_header_bytes(const char* data)
                byte_count++;
        }
 
-       printf("\nheader has %i bytes\n", 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[])