From 16c38b4771f0586c0f2908c07e22d00e54d7b9ef Mon Sep 17 00:00:00 2001 From: jkh Date: Fri, 20 Oct 1995 07:03:40 +0000 Subject: [PATCH] Finally split this off from system.c, as intended. --- release/sysinstall/doc.c | 88 +++++++++++++++++++++++++++++++++++++++ usr.sbin/sysinstall/doc.c | 88 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 release/sysinstall/doc.c create mode 100644 usr.sbin/sysinstall/doc.c diff --git a/release/sysinstall/doc.c b/release/sysinstall/doc.c new file mode 100644 index 00000000000..a173c6bc161 --- /dev/null +++ b/release/sysinstall/doc.c @@ -0,0 +1,88 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id$ + * + * Jordan Hubbard + * + * My contributions are in the public domain. + * + * Parts of this file are also blatently stolen from Poul-Henning Kamp's + * previous version of sysinstall, and as such fall under his "BEERWARE license" + * so buy him a beer if you like it! Buy him a beer for me, too! + * Heck, get him completely drunk and send me pictures! :-) + */ + +#include "sysinstall.h" + +/* + * This is called from the main menu. Try to find a copy of Lynx from somewhere + * and fire it up on the first copy of the handbook we can find. + */ +int +docBrowser(char *junk) +{ + char *browser = variable_get(BROWSER_PACKAGE); + + /* Make sure we were started at a reasonable time */ + if (!variable_get(SYSTEM_INSTALLED)) { + msgConfirm("Sorry, it's not possible to invoke the browser until the system\n" + "is installed completely enough to support a copy of %s.", browser); + return RET_FAIL; + } + + if (!mediaVerify()) + return RET_FAIL; + + /* First, make sure we have whatever browser we've chosen is here */ + if (package_extract(mediaDevice, browser) != RET_SUCCESS) { + msgConfirm("Unable to install the %s HTML browser package. You may\n" + "wish to verify that your media is configured correctly and\n" + "try again.", browser); + return RET_FAIL; + } + if (!file_executable(variable_get(BROWSER_BINARY))) { + if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n" + "find its binary in %s! You may wish to try a different\n" + "location to load the package from (go to Media menu) and see if that\n" + "makes a difference.\n\n" + "I suggest that we remove the version that was extracted since it does\n" + "not appear to be correct. Would you like me to do that now?")) + vsystem("pkg_delete %s %s", !strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "high") ? "-v" : "", browser); + return RET_FAIL; + } + + /* Run browser on the appropriate doc */ + dmenuOpenSimple(&MenuHTMLDoc); + return RET_SUCCESS; +} + +/* Try to show one of the documents requested from the HTML doc menu */ +int +docShowDocument(char *str) +{ + char *browser = variable_get(BROWSER_BINARY); + + if (!file_executable(browser)) { + msgConfirm("Can't find the browser in %s! Please ensure that it's\n" + "properly set in the Options editor.", browser); + return RET_FAIL; + } + if (!strcmp(str, "Home")) + vsystem("%s http://www.freebsd.org", browser); + else if (!strcmp(str, "Other")) { + } + else { + char target[512]; + + sprintf(target, "/usr/share/doc/%s/%s.html", str, str); + if (file_readable(target)) + vsystem("%s file:%s", browser, target); + else + vsystem("%s http://www.freebsd.org/%s"); + } + return RET_SUCCESS; +} diff --git a/usr.sbin/sysinstall/doc.c b/usr.sbin/sysinstall/doc.c new file mode 100644 index 00000000000..a173c6bc161 --- /dev/null +++ b/usr.sbin/sysinstall/doc.c @@ -0,0 +1,88 @@ +/* + * The new sysinstall program. + * + * This is probably the last program in the `sysinstall' line - the next + * generation being essentially a complete rewrite. + * + * $Id$ + * + * Jordan Hubbard + * + * My contributions are in the public domain. + * + * Parts of this file are also blatently stolen from Poul-Henning Kamp's + * previous version of sysinstall, and as such fall under his "BEERWARE license" + * so buy him a beer if you like it! Buy him a beer for me, too! + * Heck, get him completely drunk and send me pictures! :-) + */ + +#include "sysinstall.h" + +/* + * This is called from the main menu. Try to find a copy of Lynx from somewhere + * and fire it up on the first copy of the handbook we can find. + */ +int +docBrowser(char *junk) +{ + char *browser = variable_get(BROWSER_PACKAGE); + + /* Make sure we were started at a reasonable time */ + if (!variable_get(SYSTEM_INSTALLED)) { + msgConfirm("Sorry, it's not possible to invoke the browser until the system\n" + "is installed completely enough to support a copy of %s.", browser); + return RET_FAIL; + } + + if (!mediaVerify()) + return RET_FAIL; + + /* First, make sure we have whatever browser we've chosen is here */ + if (package_extract(mediaDevice, browser) != RET_SUCCESS) { + msgConfirm("Unable to install the %s HTML browser package. You may\n" + "wish to verify that your media is configured correctly and\n" + "try again.", browser); + return RET_FAIL; + } + if (!file_executable(variable_get(BROWSER_BINARY))) { + if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n" + "find its binary in %s! You may wish to try a different\n" + "location to load the package from (go to Media menu) and see if that\n" + "makes a difference.\n\n" + "I suggest that we remove the version that was extracted since it does\n" + "not appear to be correct. Would you like me to do that now?")) + vsystem("pkg_delete %s %s", !strcmp(variable_get(CPIO_VERBOSITY_LEVEL), "high") ? "-v" : "", browser); + return RET_FAIL; + } + + /* Run browser on the appropriate doc */ + dmenuOpenSimple(&MenuHTMLDoc); + return RET_SUCCESS; +} + +/* Try to show one of the documents requested from the HTML doc menu */ +int +docShowDocument(char *str) +{ + char *browser = variable_get(BROWSER_BINARY); + + if (!file_executable(browser)) { + msgConfirm("Can't find the browser in %s! Please ensure that it's\n" + "properly set in the Options editor.", browser); + return RET_FAIL; + } + if (!strcmp(str, "Home")) + vsystem("%s http://www.freebsd.org", browser); + else if (!strcmp(str, "Other")) { + } + else { + char target[512]; + + sprintf(target, "/usr/share/doc/%s/%s.html", str, str); + if (file_readable(target)) + vsystem("%s file:%s", browser, target); + else + vsystem("%s http://www.freebsd.org/%s"); + } + return RET_SUCCESS; +} -- 2.45.2