From 919bb8ce56406c6059ec9d3221d1bc96ad388d1c Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 3 Mar 2012 14:04:07 +0100 Subject: [PATCH] Make system open command configurable A new volatile string option -openCommand has been added, which defaults to "xdg-open". It is intended for use in the master settings file for distributions that need another command for this. --- args.h | 1 + common.h | 1 + xboard.c | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/args.h b/args.h index 713e2ab..b29daa7 100644 --- a/args.h +++ b/args.h @@ -713,6 +713,7 @@ ArgDescriptor argDescriptors[] = { { "keepLineBreaksICS", ArgBoolean, (void *) &appData.noJoin, TRUE, INVALID }, { "wrapContinuationSequence", ArgString, (void *) &appData.wrapContSeq, FALSE, INVALID }, { "useInternalWrap", ArgTrue, (void *) &appData.useInternalWrap, FALSE, INVALID }, /* noJoin usurps this if set */ + { "openCommand", ArgString, (void *) &appData.sysOpen, FALSE, "xdg-open" }, // [HGM] placement: put all window layouts last in ini file, but man X,Y before all others { "minX", ArgZ, (void *) &minX, FALSE, INVALID }, // [HGM] placement: to make sure auxiliary windows can be placed diff --git a/common.h b/common.h index b433e68..d412462 100644 --- a/common.h +++ b/common.h @@ -654,6 +654,7 @@ typedef struct { char *fenOverride[ENGINES]; char *features[ENGINES]; char *featureDefaults; + char *sysOpen; Boolean keepAlive; /* [HGM] alive */ Boolean forceIllegal;/*[HGM] illegal */ Boolean noJoin; /* [HGM] join */ diff --git a/xboard.c b/xboard.c index 3dd9f65..80db398 100644 --- a/xboard.c +++ b/xboard.c @@ -6672,25 +6672,33 @@ BookProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) void BugReportProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { - system("xdg-open mailto:bug-xboard@gnu.org"); + char buf[MSG_SIZ]; + snprintf(buf, MSG_SIZ, "%s mailto:bug-xboard@gnu.org", appData.sysOpen); + system(buf); } void GuideProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { - system("xdg-open http://www.gnu.org/software/xboard/user_guide/UserGuide.html"); + char buf[MSG_SIZ]; + snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/user_guide/UserGuide.html", appData.sysOpen); + system(buf); } void HomePageProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { - system("xdg-open http://www.gnu.org/software/xboard/"); + char buf[MSG_SIZ]; + snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/", appData.sysOpen); + system(buf); } void NewsPageProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { - system("xdg-open http://www.gnu.org/software/xboard/whats_new/portal.html"); + char buf[MSG_SIZ]; + snprintf(buf, MSG_SIZ, "%s http://www.gnu.org/software/xboard/whats_new/portal.html", appData.sysOpen); + system(buf); } void -- 1.7.0.4