Skip to content

Commit

Permalink
Build the composite help file from the generic and architecture-specific
Browse files Browse the repository at this point in the history
help files, sorting topics and subtopics to allow maximum flexibility.
  • Loading branch information
Mike Smith authored and Mike Smith committed Dec 15, 1998
1 parent 2878b30 commit aa20360
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 4 deletions.
41 changes: 40 additions & 1 deletion sys/boot/common/help.common
Expand Up @@ -105,7 +105,7 @@
The set command is used to set variables.

################################################################################
# Tset Sauotboot_delay DSet the default autoboot delay
# Tset Sautoboot_delay DSet the default autoboot delay

set autoboot_delay=<value>

Expand All @@ -120,6 +120,45 @@
It may be overridden by setting the bootfile variable to a
semicolon-separated list of paths, which will be searched for in turn.

################################################################################
# Tset Sboot_askname DPrompt for root device when kernel is booted

set boot_askname

Instructs the kernel to prompt the user for the name of the root device
when the kernel is booted.

################################################################################
# Tset Sboot_ddb DDrop to the kernel debugger (DDB) when the kernel is loaded

set boot_ddb

Instructs the kernel to start in the DDB debugger, rather than
proceeding to initialise when booted.

################################################################################
# Tset Sboot_gdb DSelect gdb-remote mode for kernel debugger

set boot_gdb

Selects gdb-remote mode for the kernel debugger by default.

################################################################################
# Tset Sboot_single DRequest the kernel start in single-user mode

set boot_single

Prevents the kernel from initiating a multi-user startup, single-user
mode will be entered when the kernel has finished device probes.

################################################################################
# Tset Sboot_verbose DDisplay verbose device probes and debugging information

set boot_verbose

Setting this variable causes extra debugging information to be printed
by the kernel during the boot phase.

################################################################################
# Tset Sconsole DSet the current console

Expand Down
184 changes: 184 additions & 0 deletions sys/boot/common/merge_help.pl
@@ -0,0 +1,184 @@
#!/usr/bin/perl
#
# Copyright (c) 1998 Nick Hibma
# All rights reserved.
#
# 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.
# 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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, 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.
#
#
#
# Reads all the files mentioned on the command line (or stdin) and combines
# them into one.
#
# The files must have the following format:
#
# ######################### (line is ignored)
# # Ttopic Dhello world (short description)
# This is the long description and can span
# multiple lines and empty
#
# ones.
# ########################### (this line is again ignored)
# # Ttopic Ssubtopic Dagain a short description
# a subtopic is a topic that will connected under the subtree of
# topic.

use FileHandle;

# Declaration of constants
#
$SOD = 'D'; # Start of description character
$SLABEL = '_sdescr'; # Short description label
$LLABEL = '_ldescr'; # Long description label

# Global variables
#

# Read the command line parameters
#
while ( $arg = shift @ARGV ) {
if ( $arg eq '-h' ) {
die "$0 [-h] [files ...]\nno filenames or '-' as a filename reads stdin\n";
} else {
push @files, $arg;
}
}

# No files to process? Read STDIN
#
push @files, '-' # no files found? Process STDIN
if $#files == -1;

# Perform processing on each file
#
foreach $filename ( @files ) {
if ( $filename eq '-' ) {
$file = STDIN;
} else {
die "Could not open file $filename, $!"
unless $file = new FileHandle $filename;
}

# Process one file and add it to the hash
#
&add_file($file);
}

# Print the results of our processing
#
&print_topic($topics, '#'x80 . "\n# ");
print '#'x80 . "\n";

#require 'z39.50/PerlieZ/debug.pm';
#debug::Dump($topics, '$topics');

# Make like a tree and leave.
#
exit 0;

sub add_file {
my ($file) = @_;

# process a file and add it to the hash

$line = <$file>;
while ( !eof($file) ) {
if ( $line =~ s/^#\s+// ) {

# the line contains a number of parts (separated by whitespace):
# (Cl+ )+ Dd+
# C is a character not equal to D
# l+ is a word without spaces
# (Cl+ )+ is a list of words preceded by C and separated by spaces
# d+ is a description (can contain spaces)
# D is the character in $SOD
#
# we split it into multiple l+ parts and one d+ part
# after that we insert the d+ part at the right point in the tree
# (after reading also the long descrescription in the next lines)

@ar = ();
while ( $line =~ s/^([^$SOD]\S+)\s+//o ) {
$label = $1;
$label .= ' ' # avoid conflicts with hash labels
if $label eq $SLABEL or $label eq $LLABEL;
push @ar, $label;
}
$sdescr = $line; # short descr. is rest of line

my $ldescr = ''; # read the long description
$line = <$file>;
while ( !eof($file) and $line !~ m/^#/ ) {
$ldescr .= $line;
$line = <$file>;
}

$topics = &add_to_hash($topics, $sdescr, $ldescr, @ar);
} else {
$line = <$file>;
}
}
}

sub add_to_hash {
my ($hash, $sdescr, $ldescr, @ar) = @_;

# bit more complicated than usual, because we want to insert
# value into an existing tree if possible, or otherwise build it.
# Probably could be done with references as well, but this seems neater.

if ( $#ar == -1 ) {
# Create a new leaf (reference to descriptions hash)

return {$SLABEL=>$sdescr, $LLABEL=>$ldescr};
} else {
# Add subtree to node and if node does not exist, create an empty one
# (reference to a hash of subnodes)

$hash = {} # create a new ref to hash on the fly
if !$hash;
my $label = shift @ar; # next label in tree to be used
$hash->{$label} = &add_to_hash($hash->{$label}, $sdescr, $ldescr, @ar);
return $hash;
}
}

sub print_topic {
my ($topic, $preprint) = @_;

# print out a topic and its subtopics recursively
# preprint is the string before the current subtopic hash
# and is the same for all the subtopics in the current hash

if ( $topic->{$SLABEL} or $topic->{$LLABEL} ) {
# leaf found
print $preprint . "$topic->{$SLABEL}$topic->{$LLABEL}";
}

# iterate over all the subtopics
my ($label);
foreach $label ( sort keys %{ $topic } ) {
next
if $label eq $SLABEL or $label eq $LLABEL;
&print_topic($topic->{$label}, $preprint . $label . ' ');
}
}
18 changes: 15 additions & 3 deletions sys/boot/i386/loader/Makefile
@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.18 1998/11/04 03:42:36 msmith Exp $
# $Id: Makefile,v 1.19 1998/11/12 07:40:51 jkh Exp $

BASE= loader
PROG= ${BASE}
Expand Down Expand Up @@ -29,7 +29,7 @@ LIBFICL= ${.CURDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../.. -I.

CLEANFILES+= vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym
CLEANFILES+= vers.c vers.o ${BASE}.list ${BASE}.bin ${BASE}.sym ${BASE}.help

CFLAGS+= -Wall
LDFLAGS= -nostdlib -static -Ttext 0x1000
Expand Down Expand Up @@ -68,14 +68,26 @@ vers.o:
sh ${.CURDIR}/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
${CC} -c vers.c

${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT}
${BASE}: ${BASE}.bin ${BTXLDR} ${BTXKERN} ${BTXCRT} ${BASE}.help
btxld -v -f aout -e 0x100000 -o ${.TARGET} -l ${BTXLDR} -b ${BTXKERN} \
${BASE}.bin

${BASE}.bin: ${BASE}.sym
cp ${.ALLSRC} ${.TARGET}
strip ${.TARGET}

${BASE}.help: help.common help.i386
perl ${.CURDIR}/../../common/merge_help.pl ${.ALLSRC} > ${.TARGET}

beforeinstall:
.if exists(${.OBJDIR}/loader.help)
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.OBJDIR}/${BASE}.help \
${DESTDIR}/boot
.else
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/${BASE}.help \
${DESTDIR}/boot
.endif

# Cannot use ${OBJS} above this line
.include <bsd.prog.mk>

Expand Down
18 changes: 18 additions & 0 deletions sys/boot/i386/loader/help.i386
Expand Up @@ -14,3 +14,21 @@
only.

################################################################################
# Tset Snum_ide_disks DSet the number of IDE disks when booting from a SCSI disk

set num_ide_disks=<value>

When booting from a SCSI disk on a system with one or more IDE disks,
and where the IDE disks are the default boot device, it is necessary
to tell the kernel how many IDE disks there are in order to have it
correctly locate the SCSI disk you are booting from.

################################################################################
# Tset Sboot_userconfig DStart userconfig when the kernel is booted

set boot_userconfig

Indicates that the kernel's interactive device configuration program
should be run when the kernel is booted.

################################################################################

0 comments on commit aa20360

Please sign in to comment.