diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-15 23:55:42 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-16 14:26:14 +0100 |
commit | a8fbceac17784d67779cee97c556395e43af359e (patch) | |
tree | 1ae0663e703721499362279ce39d06e975879d94 /core | |
parent | f2911f64ba241b3ec583cdf7da94f72b46eb8ea2 (diff) | |
download | subsurface-a8fbceac17784d67779cee97c556395e43af359e.tar.gz |
subsurface-startup: expose print_version() in the header
The Windows auto-verbose + log file creation if starting
from a non-terminal has the problem that the print_version()
call is never made becase 'verbose' is updated programatically
in windows.c and not by the user (by passing -v).
To work around the issue:
- move the windows console creation call before *everything* else
- then immediatelly install the message handler
- then see if 'verbose' is set and explicitly call print_version()
print_version() now also has a flag (version_printed), to avoid
printing the version multiple times, if the user decided to add
an extra -v to the Desktop shortcut.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/subsurfacestartup.c | 6 | ||||
-rw-r--r-- | core/subsurfacestartup.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c index 4a82aeff4..61bff87fa 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.c @@ -148,14 +148,18 @@ const char *monthname(int mon) */ bool imported = false; -static void print_version() +bool version_printed = false; +void print_version() { + if (version_printed) + return; printf("Subsurface v%s,\n", subsurface_git_version()); printf("built with libdivecomputer v%s\n", dc_version(NULL)); print_qt_versions(); int git_maj, git_min, git_rev; git_libgit2_version(&git_maj, &git_min, &git_rev); printf("built with libgit2 %d.%d.%d\n", git_maj, git_min, git_rev); + version_printed = true; } void print_files() diff --git a/core/subsurfacestartup.h b/core/subsurfacestartup.h index fcabb4f6c..b26c99025 100644 --- a/core/subsurfacestartup.h +++ b/core/subsurfacestartup.h @@ -19,6 +19,7 @@ void parse_argument(const char *arg); void free_prefs(void); void copy_prefs(struct preferences *src, struct preferences *dest); void print_files(void); +void print_version(void); extern char *settings_suffix; |