summaryrefslogtreecommitdiff
path: root/textscreen
diff options
context:
space:
mode:
Diffstat (limited to 'textscreen')
-rw-r--r--textscreen/txt_window.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/textscreen/txt_window.c b/textscreen/txt_window.c
index 41b8c8ef..48d01f79 100644
--- a/textscreen/txt_window.c
+++ b/textscreen/txt_window.c
@@ -513,6 +513,15 @@ void TXT_SetWindowHelpURL(txt_window_t *window, char *help_url)
window->help_url = help_url;
}
+#ifdef _WIN32
+
+void TXT_OpenURL(char *url)
+{
+ ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
+}
+
+#else
+
void TXT_OpenURL(char *url)
{
char *cmd;
@@ -523,7 +532,7 @@ void TXT_OpenURL(char *url)
#if defined(__MACOSX__)
TXT_snprintf(cmd, cmd_len, "open \"%s\"", url);
-#elif !defined(_WIN32)
+#else
// The Unix situation sucks as usual, but the closest thing to a
// standard that exists is the xdg-utils package.
if (system("xdg-open --version 2>/dev/null") != 0)
@@ -536,14 +545,12 @@ void TXT_OpenURL(char *url)
TXT_snprintf(cmd, cmd_len, "xdg-open \"%s\"", url);
#endif
-#if defined(_WIN32)
- ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOWNORMAL);
-#else
system(cmd);
-#endif
free(cmd);
}
+#endif /* #ifndef _WIN32 */
+
void TXT_OpenWindowHelpURL(txt_window_t *window)
{
if (window->help_url != NULL)