Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/zopfli/zopfli.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Author: [email protected] (Jyrki Alakuijala)
extern "C" {
#endif

#define ZOPFLI_VERSION "1.0.1"

/*
Options used throughout the program.
*/
Expand Down
15 changes: 14 additions & 1 deletion src/zopfli/zopfli_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ static char StringsEqual(const char* str1, const char* str2) {
return strcmp(str1, str2) == 0;
}

static void ShowVersion() {
fprintf(stderr, "zopfli version %s\n", ZOPFLI_VERSION);
}

int main(int argc, char* argv[]) {
ZopfliOptions options;
ZopfliFormat output_type = ZOPFLI_FORMAT_GZIP;
Expand Down Expand Up @@ -178,11 +182,20 @@ int main(int argc, char* argv[]) {
" --gzip output to gzip format (default)\n"
" --zlib output to zlib format instead of gzip\n"
" --deflate output to deflate format instead of gzip\n"
" --splitlast ignored, left for backwards compatibility\n");
" --splitlast ignored, left for backwards compatibility\n"
" --version show version and exit\n");
return 0;
}
else if (StringsEqual(arg, "--version")) {
ShowVersion();
return 0;
}
}

if (options.verbose) {
ShowVersion();
}

if (options.numiterations < 1) {
fprintf(stderr, "Error: must have 1 or more iterations\n");
return 0;
Expand Down