From f882e132cfad2579cfc700af9df85dea11469f1c Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 31 Oct 2016 10:51:58 +0100 Subject: [PATCH] added gen-zstd-manual.sh --- contrib/gen_html/gen-zstd-manual.sh | 9 +++++++++ contrib/gen_html/gen_html.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100755 contrib/gen_html/gen-zstd-manual.sh diff --git a/contrib/gen_html/gen-zstd-manual.sh b/contrib/gen_html/gen-zstd-manual.sh new file mode 100755 index 00000000..57a8b6ea --- /dev/null +++ b/contrib/gen_html/gen-zstd-manual.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +LIBVER_MAJOR_SCRIPT=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/zstd.h` +LIBVER_MINOR_SCRIPT=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/zstd.h` +LIBVER_PATCH_SCRIPT=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ../../lib/zstd.h` +LIBVER_SCRIPT=$LIBVER_MAJOR_SCRIPT.$LIBVER_MINOR_SCRIPT.$LIBVER_PATCH_SCRIPT + +echo ZSTD_VERSION=$LIBVER_SCRIPT +./gen_html $LIBVER_SCRIPT ../../lib/zstd.h ./zstd_manual.html diff --git a/contrib/gen_html/gen_html.cpp b/contrib/gen_html/gen_html.cpp index 2157829f..d3ab265a 100644 --- a/contrib/gen_html/gen_html.cpp +++ b/contrib/gen_html/gen_html.cpp @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { if (argc < 4) { cout << "usage: " << argv[0] << " [zstd_version] [input_file] [output_html]" << endl; - exit(0); + return 1; } version = "zstd " + string(argv[1]) + " Manual"; @@ -98,14 +98,14 @@ int main(int argc, char *argv[]) { istream.open(argv[2], ifstream::in); if (!istream.is_open()) { cout << "Error opening file " << argv[2] << endl; - exit(0); + return 1; } ostream.open(argv[3], ifstream::out); if (!ostream.is_open()) { cout << "Error opening file " << argv[3] << endl; - exit(0); - } + return 1; + } while (getline(istream, line)) { input.push_back(line);