From 342be865629c3d818530a03b3a63b1cc1e9e7792 Mon Sep 17 00:00:00 2001 From: jkh Date: Sun, 20 Feb 2000 23:50:01 +0000 Subject: [PATCH] Make the doc menu work again by checking the right variables. --- release/sysinstall/doc.c | 32 ++++++++++++++++---------------- usr.sbin/sysinstall/doc.c | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/release/sysinstall/doc.c b/release/sysinstall/doc.c index 19cd4a8b2e8d..9e7459fe41e1 100644 --- a/release/sysinstall/doc.c +++ b/release/sysinstall/doc.c @@ -86,9 +86,8 @@ docBrowser(dialogMenuItem *self) int docShowDocument(dialogMenuItem *self) { - char tmp[512], target[512]; - char *where = NULL; - char *browser = variable_get(VAR_BROWSER_BINARY); + char *tmp[512], target[512]; + char *where, *browser = variable_get(VAR_BROWSER_BINARY); char *str = self->prompt; if (!file_executable(browser)) { @@ -96,24 +95,25 @@ docShowDocument(dialogMenuItem *self) "properly set in the Options editor.", browser); return DITEM_FAILURE; } - if (!strstr(str, "Home")) - where = "http://www.freebsd.org"; - else if (!strstr(str, "Other")) + /* Default to Home */ + where = strcpy(target, "http://www.freebsd.org"); + if (strstr(str, "Other")) { where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit."); - else if (!strstr(str, "FAQ")) { - strcpy(target, "/usr/share/doc/faq/index.html"); - if (!file_readable(target)) - strcpy(target, "http://www.freebsd.org/FAQ"); - where = target; + if (where) + strcpy(target, where); } - else if (!strstr(str, "Handbook")) { - strcpy(target, "/usr/share/doc/handbook/index.html"); + else if (strstr(str, "FAQ")) { + where = strcpy(target, "/usr/share/doc/faq/index.html"); if (!file_readable(target)) - strcpy(target, "http://www.freebsd.org/handbook"); - where = target; + where = strcpy(target, "http://www.freebsd.org/FAQ"); + } + else if (strstr(str, "Handbook")) { + where = strcpy(target, "/usr/share/doc/handbook/index.html"); + if (!file_readable(target)) + where = strcpy(target, "http://www.freebsd.org/handbook"); } if (where) { - sprintf(tmp, "%s %s", browser, where); + sprintf(tmp, "%s %s", browser, target); systemExecute(tmp); return DITEM_SUCCESS; } diff --git a/usr.sbin/sysinstall/doc.c b/usr.sbin/sysinstall/doc.c index 19cd4a8b2e8d..9e7459fe41e1 100644 --- a/usr.sbin/sysinstall/doc.c +++ b/usr.sbin/sysinstall/doc.c @@ -86,9 +86,8 @@ docBrowser(dialogMenuItem *self) int docShowDocument(dialogMenuItem *self) { - char tmp[512], target[512]; - char *where = NULL; - char *browser = variable_get(VAR_BROWSER_BINARY); + char *tmp[512], target[512]; + char *where, *browser = variable_get(VAR_BROWSER_BINARY); char *str = self->prompt; if (!file_executable(browser)) { @@ -96,24 +95,25 @@ docShowDocument(dialogMenuItem *self) "properly set in the Options editor.", browser); return DITEM_FAILURE; } - if (!strstr(str, "Home")) - where = "http://www.freebsd.org"; - else if (!strstr(str, "Other")) + /* Default to Home */ + where = strcpy(target, "http://www.freebsd.org"); + if (strstr(str, "Other")) { where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit."); - else if (!strstr(str, "FAQ")) { - strcpy(target, "/usr/share/doc/faq/index.html"); - if (!file_readable(target)) - strcpy(target, "http://www.freebsd.org/FAQ"); - where = target; + if (where) + strcpy(target, where); } - else if (!strstr(str, "Handbook")) { - strcpy(target, "/usr/share/doc/handbook/index.html"); + else if (strstr(str, "FAQ")) { + where = strcpy(target, "/usr/share/doc/faq/index.html"); if (!file_readable(target)) - strcpy(target, "http://www.freebsd.org/handbook"); - where = target; + where = strcpy(target, "http://www.freebsd.org/FAQ"); + } + else if (strstr(str, "Handbook")) { + where = strcpy(target, "/usr/share/doc/handbook/index.html"); + if (!file_readable(target)) + where = strcpy(target, "http://www.freebsd.org/handbook"); } if (where) { - sprintf(tmp, "%s %s", browser, where); + sprintf(tmp, "%s %s", browser, target); systemExecute(tmp); return DITEM_SUCCESS; }