diff --git a/tileconv/options.cpp b/tileconv/options.cpp index 2bb7ed9..7880d1c 100644 --- a/tileconv/options.cpp +++ b/tileconv/options.cpp @@ -166,7 +166,15 @@ bool Options::init(int argc, char *argv[]) noexcept setShowInfo(true); break; case 'V': - std::printf("%s %d.%d.%d by %s\n", prog_name, vers_major, vers_minor, vers_patch, author); + if (std::strlen(vers_suffix)) { + std::printf("%s %d.%d.%d (%s) by %s\n", prog_name, vers_major, vers_minor, vers_patch, vers_suffix, author); + } else { + if (vers_patch != 0) { + std::printf("%s %d.%d.%d by %s\n", prog_name, vers_major, vers_minor, vers_patch, author); + } else { + std::printf("%s %d.%d by %s\n", prog_name, vers_major, vers_minor, author); + } + } return false; default: std::printf("Unrecognized parameter \"-%c\"\n", optopt); diff --git a/tileconv/version.cpp b/tileconv/version.cpp index 9556123..e492c9b 100644 --- a/tileconv/version.cpp +++ b/tileconv/version.cpp @@ -19,8 +19,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "version.h" + int vers_major = 0; int vers_minor = 5; int vers_patch = 1; +char vers_suffix[] = ""; char prog_name[] = "tileconv"; char author[] = "Argent77"; diff --git a/tileconv/version.h b/tileconv/version.h index fa1341b..594fdf8 100644 --- a/tileconv/version.h +++ b/tileconv/version.h @@ -19,8 +19,14 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _VERSION_H_ +#define _VERSION_H_ + extern int vers_major; extern int vers_minor; extern int vers_patch; +extern char vers_suffix[]; extern char prog_name[]; extern char author[]; + +#endif // _VERSION_H_