mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
Improved the user interface:
1) Added file list capability via '?'. 2) Arranged usage info to be more unix-like. 3) Fixed backspace over prompt annoyance.
This commit is contained in:
parent
1bf7dce363
commit
3dea9c24ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4237
@ -24,7 +24,7 @@
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* from: Mach, [92/04/03 16:51:14 rvb]
|
||||
* $Id: boot.c,v 1.20 1994/10/26 20:46:05 jkh Exp $
|
||||
* $Id: boot.c,v 1.21 1994/10/31 18:00:06 jkh Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -69,14 +69,17 @@ extern int end;
|
||||
boot(drive)
|
||||
int drive;
|
||||
{
|
||||
int loadflags, currname = 0;
|
||||
int loadflags, currname = 0, ret;
|
||||
char *t;
|
||||
|
||||
printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n",
|
||||
ouraddr,
|
||||
memsize(0),
|
||||
memsize(1));
|
||||
printf("use hd(1,a)/kernel to boot sd0 when wd0 is also installed\n");
|
||||
printf("Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n");
|
||||
printf("Usage: [[[%s(0,a)]%s][-s][-r][-a][-c][-d][-b]]\nUse ? for file list.\n\n"
|
||||
, devs[(drive & 0x80) ? 0 : 2]
|
||||
, names[0]);
|
||||
gateA20();
|
||||
loadstart:
|
||||
/***************************************************************\
|
||||
@ -90,9 +93,12 @@ int drive;
|
||||
loadflags = 0;
|
||||
if (currname == NUMNAMES)
|
||||
currname = 0;
|
||||
printf("Boot: ");
|
||||
getbootdev(&loadflags);
|
||||
if (openrd()) {
|
||||
printf("Can't find %s\n", name);
|
||||
ret = openrd();
|
||||
if (ret != 0) {
|
||||
if (ret > 0)
|
||||
printf("Can't find %s\n", name);
|
||||
goto loadstart;
|
||||
}
|
||||
/* if (inode.i_mode&IEXEC)
|
||||
@ -240,11 +246,6 @@ getbootdev(howto)
|
||||
int *howto;
|
||||
{
|
||||
char c, *ptr = namebuf;
|
||||
printf("Boot: [[[%s(%d,%c)]%s][-s][-r][-a][-c][-d][-b]] :- "
|
||||
, devs[maj]
|
||||
, unit
|
||||
, 'a'+part
|
||||
, name);
|
||||
if (gets(namebuf)) {
|
||||
while (c=*ptr) {
|
||||
while (c==' ')
|
||||
|
@ -25,7 +25,7 @@
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
|
||||
* $Id: io.c,v 1.8 1994/09/18 07:39:55 swallace Exp $
|
||||
* $Id: io.c,v 1.9 1994/09/20 22:24:59 adam Exp $
|
||||
*/
|
||||
|
||||
#include <machine/cpufunc.h>
|
||||
@ -124,15 +124,21 @@ putchar(c)
|
||||
putc(c);
|
||||
}
|
||||
|
||||
getchar()
|
||||
getchar(in_buf)
|
||||
int in_buf;
|
||||
{
|
||||
int c;
|
||||
|
||||
loop:
|
||||
if ((c=getc()) == '\r')
|
||||
c = '\n';
|
||||
if (c == '\b') {
|
||||
putchar('\b');
|
||||
putchar(' ');
|
||||
if (in_buf != 0) {
|
||||
putchar('\b');
|
||||
putchar(' ');
|
||||
} else {
|
||||
goto loop;
|
||||
}
|
||||
}
|
||||
putchar(c);
|
||||
return(c);
|
||||
@ -169,7 +175,7 @@ char *buf;
|
||||
#endif
|
||||
if (ischar())
|
||||
for (;;)
|
||||
switch(*ptr = getchar() & 0xff) {
|
||||
switch(*ptr = getchar(ptr - buf) & 0xff) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
*ptr = '\0';
|
||||
|
@ -24,7 +24,7 @@
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
|
||||
* $Id: sys.c,v 1.4 1994/08/21 17:47:26 paul Exp $
|
||||
* $Id: sys.c,v 1.5 1994/09/20 22:25:00 adam Exp $
|
||||
*/
|
||||
|
||||
#include "boot.h"
|
||||
@ -97,6 +97,10 @@ find(path)
|
||||
char *rest, ch;
|
||||
int block, off, loc, ino = ROOTINO;
|
||||
struct direct *dp;
|
||||
int list_only = 0;
|
||||
|
||||
if (strcmp("?", path) == 0)
|
||||
list_only = 1;
|
||||
loop: iodest = iobuf;
|
||||
cnt = fs->fs_bsize;
|
||||
bnum = fsbtodb(fs,ino_to_fsba(fs,ino)) + boff;
|
||||
@ -114,8 +118,14 @@ loop: iodest = iobuf;
|
||||
*rest = 0;
|
||||
loc = 0;
|
||||
do {
|
||||
if (loc >= inode.i_size)
|
||||
return 0;
|
||||
if (loc >= inode.i_size) {
|
||||
if (list_only) {
|
||||
printf("\n");
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!(off = blkoff(fs, loc))) {
|
||||
block = lblkno(fs, loc);
|
||||
cnt = blksize(fs, &inode, block);
|
||||
@ -125,6 +135,8 @@ loop: iodest = iobuf;
|
||||
}
|
||||
dp = (struct direct *)(iodest + off);
|
||||
loc += dp->d_reclen;
|
||||
if (dp->d_ino && list_only)
|
||||
printf("%s ", dp->d_name);
|
||||
} while (!dp->d_ino || strcmp(path, dp->d_name));
|
||||
ino = dp->d_ino;
|
||||
*(path = rest) = ch;
|
||||
@ -151,6 +163,7 @@ block_map(file_block)
|
||||
openrd()
|
||||
{
|
||||
char **devp, *cp = name;
|
||||
int ret;
|
||||
/*******************************************************\
|
||||
* If bracket given look for preceding device name *
|
||||
\*******************************************************/
|
||||
@ -232,10 +245,9 @@ openrd()
|
||||
/***********************************************\
|
||||
* Find the actual FILE on the mounted device *
|
||||
\***********************************************/
|
||||
if (!find(cp))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
ret = find(cp);
|
||||
if (ret <= 0)
|
||||
return (ret == 0) ? 1 : -1;
|
||||
poff = 0;
|
||||
name = cp;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user