From 336913002ed1b7bd6a5719872d7a1b8c8e0e83d9 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 17 Sep 2022 18:37:20 +0200 Subject: [PATCH] Improved "binary" output mode. --- crc64.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crc64.c b/crc64.c index c2748f9..9bfcbac 100644 --- a/crc64.c +++ b/crc64.c @@ -84,6 +84,7 @@ static const int VERSION_PATCH = 2; #define CHAR wchar_t #define MAIN wmain #define STRCASECMP _wcsicmp +#define STRLEN wcslen #define ISSPACE iswspace #define TOLOWER towlower #define PRINTF wprintf @@ -108,6 +109,7 @@ int _dowildcard = -1; #define CHAR char #define MAIN main #define STRCASECMP strcasecmp +#define STRLEN strlen #define ISSPACE isspace #define TOLOWER tolower #define PRINTF printf @@ -350,7 +352,10 @@ static int process_file(const CHAR *const file_name, const int options) } else { + const CHAR *const name_ptr = file_name ? file_name : STR_STDIN; fwrite(&crc, sizeof(uint64_t), 1U, stdout); + fwrite(&total_size, sizeof(uint64_t), 1U, stdout); + fwrite(name_ptr, sizeof(CHAR), STRLEN(name_ptr) + 1U, stdout); } if (!(options & OPT_NOFLSH))