Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/stand/boot Pull more fixes from OpenBSD/lun...
details: https://anonhg.NetBSD.org/src/rev/fc89105796a8
branches: trunk
changeset: 325680:fc89105796a8
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri Jan 03 06:37:13 2014 +0000
description:
Pull more fixes from OpenBSD/luna88k:
- Bring getline() - a.k.a libsa gets() with a prompt prefix - in par with libsa
gets(), featurewise; this means support for ^u to clear the input.
- constify
diffstat:
sys/arch/luna68k/stand/boot/getline.c | 44 +++++++++++++++++++++-----------
sys/arch/luna68k/stand/boot/init_main.c | 4 +-
sys/arch/luna68k/stand/boot/samachdep.h | 4 +-
3 files changed, 33 insertions(+), 19 deletions(-)
diffs (114 lines):
diff -r 613e39943f80 -r fc89105796a8 sys/arch/luna68k/stand/boot/getline.c
--- a/sys/arch/luna68k/stand/boot/getline.c Fri Jan 03 06:15:10 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/getline.c Fri Jan 03 06:37:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getline.c,v 1.2 2013/01/20 07:32:45 tsutsui Exp $ */
+/* $NetBSD: getline.c,v 1.3 2014/01/03 06:37:13 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -79,40 +79,54 @@
#include <luna68k/stand/boot/samachdep.h>
int
-getline(char *prompt, char *buff)
+getline(const char *prompt, char *buff)
{
int c;
- char *p = buff;
+ char *p, *lp = buff;
printf("%s", prompt);
- for(;;) {
- c = getchar() & 0x7F;
+ for (;;) {
+ c = getchar() & 0x7f;
switch (c) {
- case 0x0a:
- case 0x0d:
+ case '\n':
+ case '\r':
+ *lp = '\0';
putchar('\n');
- *p = '\0';
goto outloop;
- case 0x08:
+ case '\b':
case 0x7f:
- if (p > buff) {
- putchar(0x08);
+ if (lp > buff) {
+ lp--;
+ putchar('\b');
putchar(' ');
- putchar(0x08);
- p--;
+ putchar('\b');
}
break;
+ case 'r' & 0x1f:
+ putchar('\n');
+ printf("%s", prompt);
+ for (p = buff; p < lp; ++p)
+ putchar(*p);
+ break;
+
+ case 'u' & 0x1f:
+ case 'w' & 0x1f:
+ lp = buff;
+ printf("\n%s", prompt);
+ break;
+
default:
- *p++ = c;
+ *lp++ = c;
putchar(c);
break;
}
}
outloop:
- return(strlen(buff));
+ *lp = '\0';
+ return lp - buff;
}
diff -r 613e39943f80 -r fc89105796a8 sys/arch/luna68k/stand/boot/init_main.c
--- a/sys/arch/luna68k/stand/boot/init_main.c Fri Jan 03 06:15:10 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/init_main.c Fri Jan 03 06:37:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */
+/* $NetBSD: init_main.c,v 1.7 2014/01/03 06:37:13 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -112,7 +112,7 @@
#define BOOT_TIMEOUT 10
int boot_timeout = BOOT_TIMEOUT;
-char prompt[16] = "boot> ";
+static const char prompt[] = "boot> ";
void
main(void)
diff -r 613e39943f80 -r fc89105796a8 sys/arch/luna68k/stand/boot/samachdep.h
--- a/sys/arch/luna68k/stand/boot/samachdep.h Fri Jan 03 06:15:10 2014 +0000
+++ b/sys/arch/luna68k/stand/boot/samachdep.h Fri Jan 03 06:37:13 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: samachdep.h,v 1.12 2014/01/03 06:15:10 tsutsui Exp $ */
+/* $NetBSD: samachdep.h,v 1.13 2014/01/03 06:37:13 tsutsui Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@@ -103,7 +103,7 @@
int fsrestore(int, char **);
/* getline.c */
-int getline(char *, char *);
+int getline(const char *, char *);
/* if_le.c */
int leinit(void *);
Home |
Main Index |
Thread Index |
Old Index