1995-10-20 07:03:40 +00:00
|
|
|
/*
|
|
|
|
* The new sysinstall program.
|
|
|
|
*
|
1996-04-13 13:32:15 +00:00
|
|
|
* This is probably the last attempt in the `sysinstall' line, the next
|
|
|
|
* generation being slated for what's essentially a complete rewrite.
|
1995-10-20 07:03:40 +00:00
|
|
|
*
|
1997-02-15 13:18:19 +00:00
|
|
|
* $Id: doc.c,v 1.22 1997/02/07 04:25:53 jkh Exp $
|
1995-10-20 07:03:40 +00:00
|
|
|
*
|
1996-04-13 13:32:15 +00:00
|
|
|
* Copyright (c) 1995
|
|
|
|
* Jordan Hubbard. All rights reserved.
|
1995-10-20 07:03:40 +00:00
|
|
|
*
|
1996-04-13 13:32:15 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer,
|
|
|
|
* verbatim and that no modifications are made prior to this
|
|
|
|
* point in the file.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
1995-10-20 07:03:40 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
1996-04-07 03:52:36 +00:00
|
|
|
docBrowser(dialogMenuItem *self)
|
1995-10-20 07:03:40 +00:00
|
|
|
{
|
1996-04-28 03:27:26 +00:00
|
|
|
int ret;
|
1995-10-22 01:33:02 +00:00
|
|
|
char *browser = variable_get(VAR_BROWSER_PACKAGE);
|
1995-11-04 08:47:33 +00:00
|
|
|
|
1995-11-06 12:49:27 +00:00
|
|
|
if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) {
|
1995-11-04 08:47:33 +00:00
|
|
|
msgConfirm("This option may only be used after the system is installed, sorry!");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-11-04 08:47:33 +00:00
|
|
|
}
|
|
|
|
|
1995-10-20 07:03:40 +00:00
|
|
|
/* First, make sure we have whatever browser we've chosen is here */
|
1996-05-16 11:47:46 +00:00
|
|
|
if (!package_exists(browser)) {
|
|
|
|
ret = package_add(browser);
|
|
|
|
if (DITEM_STATUS(ret) != DITEM_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;
|
|
|
|
}
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|
1996-04-28 03:27:26 +00:00
|
|
|
|
1995-10-22 01:33:02 +00:00
|
|
|
if (!file_executable(variable_get(VAR_BROWSER_BINARY))) {
|
1995-10-20 07:03:40 +00:00
|
|
|
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"
|
1997-02-15 13:18:19 +00:00
|
|
|
"not appear to be correct. Would you like me to do that now?",
|
|
|
|
browser, variable_get(VAR_BROWSER_BINARY)))
|
1995-10-22 01:33:02 +00:00
|
|
|
vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser);
|
1996-04-28 03:27:26 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Run browser on the appropriate doc */
|
1996-07-02 01:03:55 +00:00
|
|
|
if (dmenuOpenSimple(&MenuHTMLDoc, FALSE))
|
1997-01-17 08:47:13 +00:00
|
|
|
return DITEM_SUCCESS | DITEM_RESTORE;
|
1996-04-07 03:52:36 +00:00
|
|
|
else
|
1997-01-17 08:47:13 +00:00
|
|
|
return DITEM_FAILURE | DITEM_RESTORE;
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to show one of the documents requested from the HTML doc menu */
|
|
|
|
int
|
1996-04-07 03:52:36 +00:00
|
|
|
docShowDocument(dialogMenuItem *self)
|
1995-10-20 07:03:40 +00:00
|
|
|
{
|
1995-10-26 08:56:18 +00:00
|
|
|
char tmp[512], target[512];
|
|
|
|
char *where = NULL;
|
1995-10-22 01:33:02 +00:00
|
|
|
char *browser = variable_get(VAR_BROWSER_BINARY);
|
1996-04-07 03:52:36 +00:00
|
|
|
char *str = self->prompt;
|
1995-10-20 07:03:40 +00:00
|
|
|
|
|
|
|
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);
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|
|
|
|
if (!strcmp(str, "Home"))
|
1995-10-26 08:56:18 +00:00
|
|
|
where = "http://www.freebsd.org";
|
|
|
|
else if (!strcmp(str, "Other"))
|
|
|
|
where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit.");
|
1995-10-27 01:22:58 +00:00
|
|
|
else if (!strcmp(str, "FAQ")) {
|
1996-10-23 22:28:56 +00:00
|
|
|
strcpy(target, "/usr/share/doc/FAQ/FAQ.html");
|
1995-10-26 08:56:18 +00:00
|
|
|
if (!file_readable(target))
|
1995-10-27 01:22:58 +00:00
|
|
|
strcpy(target, "http://www.freebsd.org/FAQ");
|
1995-10-26 08:56:18 +00:00
|
|
|
where = target;
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|
1995-10-27 01:22:58 +00:00
|
|
|
else if (!strcmp(str, "Handbook")) {
|
|
|
|
strcpy(target, "/usr/share/doc/handbook/handbook.html");
|
|
|
|
if (!file_readable(target))
|
|
|
|
strcpy(target, "http://www.freebsd.org/handbook");
|
|
|
|
where = target;
|
|
|
|
}
|
|
|
|
if (where) {
|
|
|
|
sprintf(tmp, "%s %s", browser, where);
|
1996-04-23 01:29:35 +00:00
|
|
|
dialog_clear();
|
1995-10-27 01:22:58 +00:00
|
|
|
systemExecute(tmp);
|
1996-04-23 01:29:35 +00:00
|
|
|
return DITEM_SUCCESS | DITEM_RESTORE;
|
1995-10-27 01:22:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n"
|
|
|
|
"Have you loaded the bin distribution? Is your network connected?");
|
1996-04-13 13:32:15 +00:00
|
|
|
return DITEM_FAILURE;
|
1995-10-27 01:22:58 +00:00
|
|
|
}
|
1995-10-20 07:03:40 +00:00
|
|
|
}
|