2 * The new sysinstall program.
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated for what's essentially a complete rewrite.
7 * $FreeBSD: src/release/sysinstall/doc.c,v 1.29 2000/02/26 12:35:00 jkh Exp $
8 * $DragonFly: src/release/sysinstall/Attic/doc.c,v 1.2 2003/06/17 04:27:21 dillon Exp $
11 * Jordan Hubbard. All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer,
18 * verbatim and that no modifications are made prior to this
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
24 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #include "sysinstall.h"
42 * This is called from the main menu. Try to find a copy of Lynx from somewhere
43 * and fire it up on the first copy of the handbook we can find.
46 docBrowser(dialogMenuItem *self)
49 char *browser = variable_get(VAR_BROWSER_PACKAGE);
51 if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
52 msgConfirm("This option may only be used after the system is installed, sorry!");
56 /* First, make sure we have whatever browser we've chosen is here */
57 if (!package_exists(browser)) {
58 ret = package_add(browser);
59 if (DITEM_STATUS(ret) != DITEM_SUCCESS) {
60 msgConfirm("Unable to install the %s HTML browser package. You may\n"
61 "wish to verify that your media is configured correctly and\n"
62 "try again.", browser);
67 if (!file_executable(variable_get(VAR_BROWSER_BINARY))) {
68 if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n"
69 "find its binary in %s! You may wish to try a different\n"
70 "location to load the package from (go to Media menu) and see if that\n"
71 "makes a difference.\n\n"
72 "I suggest that we remove the version that was extracted since it does\n"
73 "not appear to be correct. Would you like me to do that now?",
74 browser, variable_get(VAR_BROWSER_BINARY)))
75 vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser);
79 /* Run browser on the appropriate doc */
80 if (dmenuOpenSimple(&MenuHTMLDoc, FALSE))
86 /* Try to show one of the documents requested from the HTML doc menu */
88 docShowDocument(dialogMenuItem *self)
90 char tmp[512], target[512];
91 char *where, *browser = variable_get(VAR_BROWSER_BINARY);
92 char *str = self->prompt;
94 if (!file_executable(browser)) {
95 msgConfirm("Can't find the browser in %s! Please ensure that it's\n"
96 "properly set in the Options editor.", browser);
100 where = strcpy(target, "http://www.freebsd.org");
101 if (strstr(str, "Other")) {
102 where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit.");
104 strcpy(target, where);
106 else if (strstr(str, "FAQ")) {
107 where = strcpy(target, "/usr/share/doc/faq/index.html");
108 if (!file_readable(target))
109 where = strcpy(target, "http://www.freebsd.org/FAQ");
111 else if (strstr(str, "Handbook")) {
112 where = strcpy(target, "/usr/share/doc/handbook/index.html");
113 if (!file_readable(target))
114 where = strcpy(target, "http://www.freebsd.org/handbook");
117 sprintf(tmp, "%s %s", browser, target);
119 return DITEM_SUCCESS;
122 msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n"
123 "Have you loaded the bin distribution? Is your network connected?");
124 return DITEM_FAILURE;