Skip to content

Commit

Permalink
Improved version information
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent77 committed Jul 7, 2015
1 parent 7054601 commit e1e7e3c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tileconv/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions tileconv/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
6 changes: 6 additions & 0 deletions tileconv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_

0 comments on commit e1e7e3c

Please sign in to comment.