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