doc.c (15091) | doc.c (15242) |
---|---|
1/* 2 * The new sysinstall program. 3 * | 1/* 2 * The new sysinstall program. 3 * |
4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. | 4 * This is probably the last attempt in the `sysinstall' line, the next 5 * generation being slated for what's essentially a complete rewrite. |
6 * | 6 * |
7 * $Id: doc.c,v 1.10 1995/11/06 12:49:23 jkh Exp $ | 7 * $Id: dmenu.c,v 1.15 1996/04/07 03:52:23 jkh Exp $ |
8 * | 8 * |
9 * Jordan Hubbard | 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. |
10 * | 11 * |
11 * My contributions are in the public domain. | 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 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 18 * point in the file. 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. |
12 * | 22 * |
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 33 * SUCH DAMAGE. 34 35 * |
|
13 */ 14 15#include "sysinstall.h" 16 17/* 18 * This is called from the main menu. Try to find a copy of Lynx from somewhere 19 * and fire it up on the first copy of the handbook we can find. 20 */ 21int 22docBrowser(dialogMenuItem *self) 23{ 24 char *browser = variable_get(VAR_BROWSER_PACKAGE); 25 26 if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) { 27 msgConfirm("This option may only be used after the system is installed, sorry!"); | 36 */ 37 38#include "sysinstall.h" 39 40/* 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. 43 */ 44int 45docBrowser(dialogMenuItem *self) 46{ 47 char *browser = variable_get(VAR_BROWSER_PACKAGE); 48 49 if (RunningAsInit && !strstr(variable_get(SYSTEM_STATE), "install")) { 50 msgConfirm("This option may only be used after the system is installed, sorry!"); |
28 return RET_FAIL; | 51 return DITEM_FAILURE; |
29 } 30 31 /* Make sure we have media available */ 32 if (!mediaVerify()) | 52 } 53 54 /* Make sure we have media available */ 55 if (!mediaVerify()) |
33 return RET_FAIL; | 56 return DITEM_FAILURE; |
34 35 /* First, make sure we have whatever browser we've chosen is here */ | 57 58 /* First, make sure we have whatever browser we've chosen is here */ |
36 if (package_add(browser) != RET_SUCCESS) { | 59 if (package_add(browser) != DITEM_SUCCESS) { |
37 dialog_clear(); 38 msgConfirm("Unable to install the %s HTML browser package. You may\n" 39 "wish to verify that your media is configured correctly and\n" 40 "try again.", browser); | 60 dialog_clear(); 61 msgConfirm("Unable to install the %s HTML browser package. You may\n" 62 "wish to verify that your media is configured correctly and\n" 63 "try again.", browser); |
41 return RET_FAIL; | 64 return DITEM_FAILURE; |
42 } 43 if (!file_executable(variable_get(VAR_BROWSER_BINARY))) { 44 dialog_clear(); 45 if (!msgYesNo("Hmmm. The %s package claims to have installed, but I can't\n" 46 "find its binary in %s! You may wish to try a different\n" 47 "location to load the package from (go to Media menu) and see if that\n" 48 "makes a difference.\n\n" 49 "I suggest that we remove the version that was extracted since it does\n" 50 "not appear to be correct. Would you like me to do that now?")) 51 vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser); | 65 } 66 if (!file_executable(variable_get(VAR_BROWSER_BINARY))) { 67 dialog_clear(); 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 vsystem("pkg_delete %s %s", !strcmp(variable_get(VAR_CPIO_VERBOSITY), "high") ? "-v" : "", browser); |
52 return RET_FAIL; | 75 return DITEM_FAILURE; |
53 } 54 55 /* Run browser on the appropriate doc */ 56 if (dmenuOpenSimple(&MenuHTMLDoc)) | 76 } 77 78 /* Run browser on the appropriate doc */ 79 if (dmenuOpenSimple(&MenuHTMLDoc)) |
57 return RET_SUCCESS; | 80 return DITEM_SUCCESS; |
58 else | 81 else |
59 return RET_FAIL; | 82 return DITEM_FAILURE; |
60} 61 62/* Try to show one of the documents requested from the HTML doc menu */ 63int 64docShowDocument(dialogMenuItem *self) 65{ 66 char tmp[512], target[512]; 67 char *where = NULL; 68 char *browser = variable_get(VAR_BROWSER_BINARY); 69 char *str = self->prompt; 70 71 if (!file_executable(browser)) { 72 dialog_clear(); 73 msgConfirm("Can't find the browser in %s! Please ensure that it's\n" 74 "properly set in the Options editor.", browser); | 83} 84 85/* Try to show one of the documents requested from the HTML doc menu */ 86int 87docShowDocument(dialogMenuItem *self) 88{ 89 char tmp[512], target[512]; 90 char *where = NULL; 91 char *browser = variable_get(VAR_BROWSER_BINARY); 92 char *str = self->prompt; 93 94 if (!file_executable(browser)) { 95 dialog_clear(); 96 msgConfirm("Can't find the browser in %s! Please ensure that it's\n" 97 "properly set in the Options editor.", browser); |
75 return RET_FAIL; | 98 return DITEM_FAILURE; |
76 } 77 if (!strcmp(str, "Home")) 78 where = "http://www.freebsd.org"; 79 else if (!strcmp(str, "Other")) 80 where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit."); 81 else if (!strcmp(str, "FAQ")) { 82 strcpy(target, "/usr/share/doc/FAQ/freebsd-faq.html"); 83 if (!file_readable(target)) --- 4 unchanged lines hidden (view full) --- 88 strcpy(target, "/usr/share/doc/handbook/handbook.html"); 89 if (!file_readable(target)) 90 strcpy(target, "http://www.freebsd.org/handbook"); 91 where = target; 92 } 93 if (where) { 94 sprintf(tmp, "%s %s", browser, where); 95 systemExecute(tmp); | 99 } 100 if (!strcmp(str, "Home")) 101 where = "http://www.freebsd.org"; 102 else if (!strcmp(str, "Other")) 103 where = msgGetInput("http://www.freebsd.org", "Please enter the URL of the location you wish to visit."); 104 else if (!strcmp(str, "FAQ")) { 105 strcpy(target, "/usr/share/doc/FAQ/freebsd-faq.html"); 106 if (!file_readable(target)) --- 4 unchanged lines hidden (view full) --- 111 strcpy(target, "/usr/share/doc/handbook/handbook.html"); 112 if (!file_readable(target)) 113 strcpy(target, "http://www.freebsd.org/handbook"); 114 where = target; 115 } 116 if (where) { 117 sprintf(tmp, "%s %s", browser, where); 118 systemExecute(tmp); |
96 return RET_SUCCESS; | 119 return DITEM_SUCCESS; |
97 } 98 else { 99 msgConfirm("Hmmmmm! I can't seem to access the documentation you selected!\n" 100 "Have you loaded the bin distribution? Is your network connected?"); | 120 } 121 else { 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?"); |
101 return RET_FAIL; | 124 return DITEM_FAILURE; |
102 } 103} | 125 } 126} |
127 |
|