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.
|
* the rights to redistribute these changes.
|
||||||
*
|
*
|
||||||
* from: Mach, [92/04/03 16:51:14 rvb]
|
* 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)
|
boot(drive)
|
||||||
int drive;
|
int drive;
|
||||||
{
|
{
|
||||||
int loadflags, currname = 0;
|
int loadflags, currname = 0, ret;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n",
|
printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n",
|
||||||
ouraddr,
|
ouraddr,
|
||||||
memsize(0),
|
memsize(0),
|
||||||
memsize(1));
|
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();
|
gateA20();
|
||||||
loadstart:
|
loadstart:
|
||||||
/***************************************************************\
|
/***************************************************************\
|
||||||
@ -90,9 +93,12 @@ int drive;
|
|||||||
loadflags = 0;
|
loadflags = 0;
|
||||||
if (currname == NUMNAMES)
|
if (currname == NUMNAMES)
|
||||||
currname = 0;
|
currname = 0;
|
||||||
|
printf("Boot: ");
|
||||||
getbootdev(&loadflags);
|
getbootdev(&loadflags);
|
||||||
if (openrd()) {
|
ret = openrd();
|
||||||
printf("Can't find %s\n", name);
|
if (ret != 0) {
|
||||||
|
if (ret > 0)
|
||||||
|
printf("Can't find %s\n", name);
|
||||||
goto loadstart;
|
goto loadstart;
|
||||||
}
|
}
|
||||||
/* if (inode.i_mode&IEXEC)
|
/* if (inode.i_mode&IEXEC)
|
||||||
@ -240,11 +246,6 @@ getbootdev(howto)
|
|||||||
int *howto;
|
int *howto;
|
||||||
{
|
{
|
||||||
char c, *ptr = namebuf;
|
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)) {
|
if (gets(namebuf)) {
|
||||||
while (c=*ptr) {
|
while (c=*ptr) {
|
||||||
while (c==' ')
|
while (c==' ')
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* the rights to redistribute these changes.
|
* the rights to redistribute these changes.
|
||||||
*
|
*
|
||||||
* from: Mach, Revision 2.2 92/04/04 11:35:57 rpd
|
* 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>
|
#include <machine/cpufunc.h>
|
||||||
@ -124,15 +124,21 @@ putchar(c)
|
|||||||
putc(c);
|
putc(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
getchar()
|
getchar(in_buf)
|
||||||
|
int in_buf;
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
loop:
|
||||||
if ((c=getc()) == '\r')
|
if ((c=getc()) == '\r')
|
||||||
c = '\n';
|
c = '\n';
|
||||||
if (c == '\b') {
|
if (c == '\b') {
|
||||||
putchar('\b');
|
if (in_buf != 0) {
|
||||||
putchar(' ');
|
putchar('\b');
|
||||||
|
putchar(' ');
|
||||||
|
} else {
|
||||||
|
goto loop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
putchar(c);
|
putchar(c);
|
||||||
return(c);
|
return(c);
|
||||||
@ -169,7 +175,7 @@ char *buf;
|
|||||||
#endif
|
#endif
|
||||||
if (ischar())
|
if (ischar())
|
||||||
for (;;)
|
for (;;)
|
||||||
switch(*ptr = getchar() & 0xff) {
|
switch(*ptr = getchar(ptr - buf) & 0xff) {
|
||||||
case '\n':
|
case '\n':
|
||||||
case '\r':
|
case '\r':
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
* the rights to redistribute these changes.
|
* the rights to redistribute these changes.
|
||||||
*
|
*
|
||||||
* from: Mach, Revision 2.2 92/04/04 11:36:34 rpd
|
* 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"
|
#include "boot.h"
|
||||||
@ -97,6 +97,10 @@ find(path)
|
|||||||
char *rest, ch;
|
char *rest, ch;
|
||||||
int block, off, loc, ino = ROOTINO;
|
int block, off, loc, ino = ROOTINO;
|
||||||
struct direct *dp;
|
struct direct *dp;
|
||||||
|
int list_only = 0;
|
||||||
|
|
||||||
|
if (strcmp("?", path) == 0)
|
||||||
|
list_only = 1;
|
||||||
loop: iodest = iobuf;
|
loop: iodest = iobuf;
|
||||||
cnt = fs->fs_bsize;
|
cnt = fs->fs_bsize;
|
||||||
bnum = fsbtodb(fs,ino_to_fsba(fs,ino)) + boff;
|
bnum = fsbtodb(fs,ino_to_fsba(fs,ino)) + boff;
|
||||||
@ -114,8 +118,14 @@ loop: iodest = iobuf;
|
|||||||
*rest = 0;
|
*rest = 0;
|
||||||
loc = 0;
|
loc = 0;
|
||||||
do {
|
do {
|
||||||
if (loc >= inode.i_size)
|
if (loc >= inode.i_size) {
|
||||||
return 0;
|
if (list_only) {
|
||||||
|
printf("\n");
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!(off = blkoff(fs, loc))) {
|
if (!(off = blkoff(fs, loc))) {
|
||||||
block = lblkno(fs, loc);
|
block = lblkno(fs, loc);
|
||||||
cnt = blksize(fs, &inode, block);
|
cnt = blksize(fs, &inode, block);
|
||||||
@ -125,6 +135,8 @@ loop: iodest = iobuf;
|
|||||||
}
|
}
|
||||||
dp = (struct direct *)(iodest + off);
|
dp = (struct direct *)(iodest + off);
|
||||||
loc += dp->d_reclen;
|
loc += dp->d_reclen;
|
||||||
|
if (dp->d_ino && list_only)
|
||||||
|
printf("%s ", dp->d_name);
|
||||||
} while (!dp->d_ino || strcmp(path, dp->d_name));
|
} while (!dp->d_ino || strcmp(path, dp->d_name));
|
||||||
ino = dp->d_ino;
|
ino = dp->d_ino;
|
||||||
*(path = rest) = ch;
|
*(path = rest) = ch;
|
||||||
@ -151,6 +163,7 @@ block_map(file_block)
|
|||||||
openrd()
|
openrd()
|
||||||
{
|
{
|
||||||
char **devp, *cp = name;
|
char **devp, *cp = name;
|
||||||
|
int ret;
|
||||||
/*******************************************************\
|
/*******************************************************\
|
||||||
* If bracket given look for preceding device name *
|
* If bracket given look for preceding device name *
|
||||||
\*******************************************************/
|
\*******************************************************/
|
||||||
@ -232,10 +245,9 @@ openrd()
|
|||||||
/***********************************************\
|
/***********************************************\
|
||||||
* Find the actual FILE on the mounted device *
|
* Find the actual FILE on the mounted device *
|
||||||
\***********************************************/
|
\***********************************************/
|
||||||
if (!find(cp))
|
ret = find(cp);
|
||||||
{
|
if (ret <= 0)
|
||||||
return 1;
|
return (ret == 0) ? 1 : -1;
|
||||||
}
|
|
||||||
poff = 0;
|
poff = 0;
|
||||||
name = cp;
|
name = cp;
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user