summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fwflash/plugins/transport/common/sd.c18
-rw-r--r--usr/src/man/man3c/byteorder.3c4
-rw-r--r--usr/src/man/man3c/memset_s.3c2
-rw-r--r--usr/src/man/man3head/endian.h.3head2
-rw-r--r--usr/src/man/man3lib/libproc.3lib2
-rw-r--r--usr/src/man/man3proc/Pgrab_error.3proc2
-rw-r--r--usr/src/man/man3proc/Psignal.3proc2
-rw-r--r--usr/src/man/man5/Makefile4
-rw-r--r--usr/src/man/man5/pam_timestamp.52
-rw-r--r--usr/src/man/man7d/usba.7d2
-rw-r--r--usr/src/man/man7i/uscsi.7i2
-rw-r--r--usr/src/man/man9e/usba_hcdi.9e6
-rw-r--r--usr/src/man/man9f/Makefile2
-rw-r--r--usr/src/man/man9f/usba_hubdi_bind_root_hub.9f2
-rw-r--r--usr/src/man/man9s/qinit.9s4
-rw-r--r--usr/src/pkg/manifests/system-boot-loader.mf2
-rw-r--r--usr/src/pkg/manifests/system-kernel.man9f.inc2
-rw-r--r--usr/src/tools/scripts/wsdiff.py80
-rw-r--r--usr/src/uts/i86pc/boot/boot_keyboard.c36
19 files changed, 106 insertions, 70 deletions
diff --git a/usr/src/cmd/fwflash/plugins/transport/common/sd.c b/usr/src/cmd/fwflash/plugins/transport/common/sd.c
index 6dcff9d0f1..6ebbdaeee1 100644
--- a/usr/src/cmd/fwflash/plugins/transport/common/sd.c
+++ b/usr/src/cmd/fwflash/plugins/transport/common/sd.c
@@ -232,7 +232,7 @@ sdfw_read_descriptor(struct devicelist *flashdev, libscsi_hdl_t *hdl,
if (nwritten != sizeof (descbuf)) {
logmsg(MSG_ERROR, gettext("%s: received a short read from the "
- "SCSI READ BUFFER command, expected %u bytes, read %u\n"),
+ "SCSI READ BUFFER command, expected %u bytes, read %zu\n"),
flashdev->drvname, sizeof (descbuf), nwritten);
return (FWFLASH_FAILURE);
}
@@ -258,7 +258,7 @@ sdfw_write(struct devicelist *flashdev, libscsi_hdl_t *handle,
libscsi_action_t *action = NULL;
spc3_write_buffer_cdb_t *wb_cdb;
- logmsg(MSG_INFO, "%s: writing %u bytes of image %s at offset %u from "
+ logmsg(MSG_INFO, "%s: writing %u bytes of image %s at offset %zu from "
"address %p\n", flashdev->drvname, len, verifier->imgfile, off,
buf);
logmsg(MSG_INFO, "%s: writing to buffer id %u\n",
@@ -322,9 +322,9 @@ sdfw_write(struct devicelist *flashdev, libscsi_hdl_t *handle,
keystr = libscsi_sense_key_name(key);
logmsg(MSG_ERROR, gettext("%s: failed to write firmware: "
- "received sense key %llu (%s) additional sense code "
- "0x%llx/0x%llx (%s)\n"), flashdev->drvname, key,
- keystr != NULL ? keystr : "<unknown>",
+ "received sense key %" PRIu64 " (%s) additional sense code "
+ "0x%" PRIx64 "/0x%" PRIx64 " (%s)\n"), flashdev->drvname,
+ key, keystr != NULL ? keystr : "<unknown>",
asc, ascq, code != NULL ? code : "<unknown>");
goto err;
} else if (samstatus != SAM4_STATUS_GOOD) {
@@ -413,12 +413,12 @@ fw_writefw(struct devicelist *flashdev)
* fits in the maximum transfer size.
*/
if (maxxfer < verifier->imgsize) {
- logmsg(MSG_INFO, "%s: Maximum transfer is %u, required "
- "alignment is 2^%d\n", flashdev->drvname, maxxfer, align);
+ logmsg(MSG_INFO, "%s: Maximum transfer is %zu, required "
+ "alignment is 2^%u\n", flashdev->drvname, maxxfer, align);
if (FW_SD_PARTIAL_WRITE_SIZE > maxxfer) {
logmsg(MSG_ERROR, gettext("%s: cannot write firmware "
"image: HBA enforces a maximum transfer size of "
- "%u bytes, but the default partial transfer size "
+ "%zu bytes, but the default partial transfer size "
"is %u bytes\n"), flashdev->drvname, maxxfer,
FW_SD_PARTIAL_WRITE_SIZE);
goto err;
@@ -432,7 +432,7 @@ fw_writefw(struct devicelist *flashdev)
goto err;
}
- logmsg(MSG_INFO, "%s: final transfer block size is %u\n",
+ logmsg(MSG_INFO, "%s: final transfer block size is %zu\n",
flashdev->drvname, maxxfer);
}
diff --git a/usr/src/man/man3c/byteorder.3c b/usr/src/man/man3c/byteorder.3c
index 16de6b983e..86207a01ce 100644
--- a/usr/src/man/man3c/byteorder.3c
+++ b/usr/src/man/man3c/byteorder.3c
@@ -75,12 +75,12 @@ These functions are most often used in conjunction with Internet addresses and
ports as returned by
.Xr gethostent 3NSL
and
-.Xr getservent 3NSL .
+.Xr getservent 3SOCKET .
.Sh MT-LEVEL
.Sy Safe
.Sh SEE ALSO
.Xr inet.h 3HEAD ,
.Xr gethostent 3NSL ,
-.Xr getservent 3NSL ,
+.Xr getservent 3SOCKET ,
.Xr attributes 5 ,
.Xr byteorder 5
diff --git a/usr/src/man/man3c/memset_s.3c b/usr/src/man/man3c/memset_s.3c
index 9da92ff927..8eb2bb5292 100644
--- a/usr/src/man/man3c/memset_s.3c
+++ b/usr/src/man/man3c/memset_s.3c
@@ -96,7 +96,7 @@ Otherwise, a non-zero value is returned.
.Sy Safe
.Sh SEE ALSO
.Xr memset 3C ,
-.Xr set_constraint_handler 3C
+.Xr set_constraint_handler_s 3C
.Sh STANDARDS
The
.Fn memset_s
diff --git a/usr/src/man/man3head/endian.h.3head b/usr/src/man/man3head/endian.h.3head
index 82a195c9bd..87138c2bed 100644
--- a/usr/src/man/man3head/endian.h.3head
+++ b/usr/src/man/man3head/endian.h.3head
@@ -27,7 +27,7 @@ the host machines native byte order and big or little-endian values.
While the manual page details the macros defined by
.In endian.h ,
the functions are documented separately in
-.Xr endian 3C.
+.Xr endian 3C .
More information on endianness and a general background on the topic can
be found in
.Xr byteorder 5 .
diff --git a/usr/src/man/man3lib/libproc.3lib b/usr/src/man/man3lib/libproc.3lib
index 4d64cd17d6..15b69e52d4 100644
--- a/usr/src/man/man3lib/libproc.3lib
+++ b/usr/src/man/man3lib/libproc.3lib
@@ -114,7 +114,7 @@ sections.
Many of the operations in the library rely on debug information being
present in a process and its associated libraries.
The library leverages symbol table information, CTF data
-.Pq Xr CTF 4
+.Pq Xr ctf 4
sections, and frame unwinding information based on the use of an ABI
defined frame pointer, e\&.g\&.
.Sy %ebp
diff --git a/usr/src/man/man3proc/Pgrab_error.3proc b/usr/src/man/man3proc/Pgrab_error.3proc
index 0c22aaaaf3..b9d6921f33 100644
--- a/usr/src/man/man3proc/Pgrab_error.3proc
+++ b/usr/src/man/man3proc/Pgrab_error.3proc
@@ -34,7 +34,7 @@ This function only knows how to translate errors that are stored in
.Fa perr
during a failed call to
.Xr Pgrab 3PROC ,
-.Xr Pfgrab_core 3PROC,
+.Xr Pfgrab_core 3PROC ,
.Xr Pgrab_core 3PROC ,
or
.Xr Pgrab_file 3PROC .
diff --git a/usr/src/man/man3proc/Psignal.3proc b/usr/src/man/man3proc/Psignal.3proc
index b4f1fe0b20..5ef567cdd2 100644
--- a/usr/src/man/man3proc/Psignal.3proc
+++ b/usr/src/man/man3proc/Psignal.3proc
@@ -48,7 +48,7 @@ then it disables tracing for the signal
The signal constants, representing valid values for
.Fa which ,
can be found in
-.Xr signal.h 3HEAD.
+.Xr signal.h 3HEAD .
The signal
.Dv SIGKILL
may not be stopped.
diff --git a/usr/src/man/man5/Makefile b/usr/src/man/man5/Makefile
index 8e582ade35..18d2d6606f 100644
--- a/usr/src/man/man5/Makefile
+++ b/usr/src/man/man5/Makefile
@@ -16,6 +16,7 @@
# Copyright 2014 Garrett D'Amore <garrett@damore.org>
# Copyright 2016, Joyent, Inc.
# Copyright 2018 Gary Mills
+# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
include $(SRC)/Makefile.master
@@ -138,7 +139,8 @@ _MANFILES= Intro.5 \
sparc_MANFILES=
-i386_MANFILES= brand.4th.5 \
+i386_MANFILES= beastie.4th.5 \
+ brand.4th.5 \
check-password.4th.5 \
color.4th.5 \
delay.4th.5 \
diff --git a/usr/src/man/man5/pam_timestamp.5 b/usr/src/man/man5/pam_timestamp.5
index cb6d2b766b..aae2aba27f 100644
--- a/usr/src/man/man5/pam_timestamp.5
+++ b/usr/src/man/man5/pam_timestamp.5
@@ -54,7 +54,7 @@ be stacked above
.Bl -tag -width Ds
.It Dv debug
Provides
-.Xr syslog 3
+.Xr syslog 3C
debugging information at the
.Sy LOG_AUTH | LOG_DEBUG
level.
diff --git a/usr/src/man/man7d/usba.7d b/usr/src/man/man7d/usba.7d
index 57ffa4c8d6..3b87e86dff 100644
--- a/usr/src/man/man7d/usba.7d
+++ b/usr/src/man/man7d/usba.7d
@@ -136,7 +136,7 @@ Driver is incompatible with USBA framework.
.Xr virtualkm 7D ,
.Xr xhci 7D ,
.Xr Intro 9F ,
-.Xr Intro 9S)
+.Xr Intro 9S
.Pp
.Rs
.%T Writing Device Drivers
diff --git a/usr/src/man/man7i/uscsi.7i b/usr/src/man/man7i/uscsi.7i
index f246590ca4..c64fe9f9c9 100644
--- a/usr/src/man/man7i/uscsi.7i
+++ b/usr/src/man/man7i/uscsi.7i
@@ -416,7 +416,7 @@ An error occurred during the execution of the command.
.ad
.RS 10n
A process without root credentials tried to execute the \fBUSCSICMD\fR or
-\fRUSCSIMAXXFER\fR ioctl.
+\fBUSCSIMAXXFER\fR ioctl.
.RE
.sp
diff --git a/usr/src/man/man9e/usba_hcdi.9e b/usr/src/man/man9e/usba_hcdi.9e
index f1216181e7..c26a69e74f 100644
--- a/usr/src/man/man9e/usba_hcdi.9e
+++ b/usr/src/man/man9e/usba_hcdi.9e
@@ -228,10 +228,10 @@ will be called at this point.
.Ss Binding the Root Hub
Once this is set up, the hcdi driver must initialize its root hub by
calling
-Xr usba_hcdi_bind_root_hub 9F .
+.Xr usba_hubdi_bind_root_hub 9F .
To bind the root hub, the device driver is responsible for providing a
device descriptor that represents the hardware.
- Depending on the hardware, this descriptor may be either static or dynamic.
+Depending on the hardware, this descriptor may be either static or dynamic.
.Pp
This device descriptor should be a packed descriptor that is the same
that would be read off of the device.
@@ -276,7 +276,7 @@ As such, driver writers need to ensure that all initialization is done prior to
loading the root hub.
Once successfully loaded, driver writers should assume that they'll get other
calls into the driver's operation vector before the call to
-.Xr usba_hubdi_bind_root_hub 9F.
+.Xr usba_hubdi_bind_root_hub 9F .
.Pp
If the call to
.Xr usba_hubdi_bind_root_hub 9F
diff --git a/usr/src/man/man9f/Makefile b/usr/src/man/man9f/Makefile
index 3d02d6e075..6681cd036e 100644
--- a/usr/src/man/man9f/Makefile
+++ b/usr/src/man/man9f/Makefile
@@ -1199,6 +1199,7 @@ MANLINKS= AVL_NEXT.9f \
scsi_hba_iportmap_iport_add.9f \
scsi_hba_iportmap_iport_remove.9f \
scsi_hba_pkt_free.9f \
+ scsi_hba_tgtmap_destroy.9f \
scsi_hba_tgtmap_set_begin.9f \
scsi_hba_tgtmap_set_add.9f \
scsi_hba_tgtmap_set_end.9f \
@@ -2098,6 +2099,7 @@ scsi_hba_iport_find.9f := LINKSRC = scsi_hba_iport_exist.9f
scsi_hba_pkt_free.9f := LINKSRC = scsi_hba_pkt_alloc.9f
+scsi_hba_tgtmap_destroy.9f := LINKSRC = scsi_hba_tgtmap_create.9f
scsi_hba_tgtmap_set_begin.9f := LINKSRC = scsi_hba_tgtmap_create.9f
scsi_hba_tgtmap_set_add.9f := LINKSRC = scsi_hba_tgtmap_create.9f
scsi_hba_tgtmap_set_end.9f := LINKSRC = scsi_hba_tgtmap_create.9f
diff --git a/usr/src/man/man9f/usba_hubdi_bind_root_hub.9f b/usr/src/man/man9f/usba_hubdi_bind_root_hub.9f
index b9106cbb41..065bc8b98c 100644
--- a/usr/src/man/man9f/usba_hubdi_bind_root_hub.9f
+++ b/usr/src/man/man9f/usba_hubdi_bind_root_hub.9f
@@ -135,4 +135,4 @@ to indicate that they could not proceed.
.Xr usba_hcdi 9E ,
.Xr usba_hcdi_register 9F ,
.Xr usba_hcdi_unregister 9F ,
-.Xr usb_dev_Descr 9S
+.Xr usb_dev_descr 9S
diff --git a/usr/src/man/man9s/qinit.9s b/usr/src/man/man9s/qinit.9s
index 925267adb6..86e65f83c8 100644
--- a/usr/src/man/man9s/qinit.9s
+++ b/usr/src/man/man9s/qinit.9s
@@ -64,8 +64,8 @@ struct qinit {
.Xr queue 9S ,
.Xr streamtab 9S
.Pp
-.Xr Writing Device Drivers
+.%T Writing Device Drivers
.Pp
-.Xr STREAMS Programming Guide
+.%T STREAMS Programming Guide
.Sh NOTES
This release includes no support for module statistics.
diff --git a/usr/src/pkg/manifests/system-boot-loader.mf b/usr/src/pkg/manifests/system-boot-loader.mf
index 4b69fa9098..16e886195a 100644
--- a/usr/src/pkg/manifests/system-boot-loader.mf
+++ b/usr/src/pkg/manifests/system-boot-loader.mf
@@ -21,6 +21,7 @@
#
# Copyright 2016, Toomas Soome <tsoome@me.com>
+# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
#
@@ -81,6 +82,7 @@ $(i386_ONLY)file path=boot/loader64.efi group=sys mode=0555
$(i386_ONLY)file path=boot/pmbr group=sys mode=0444
$(i386_ONLY)file path=boot/pxeboot group=sys mode=0444
$(i386_ONLY)file path=usr/share/man/man4/loader.conf.4
+$(i386_ONLY)file path=usr/share/man/man5/beastie.4th.5
$(i386_ONLY)file path=usr/share/man/man5/brand.4th.5
$(i386_ONLY)file path=usr/share/man/man5/check-password.4th.5
$(i386_ONLY)file path=usr/share/man/man5/color.4th.5
diff --git a/usr/src/pkg/manifests/system-kernel.man9f.inc b/usr/src/pkg/manifests/system-kernel.man9f.inc
index 15e2395d6f..e209013182 100644
--- a/usr/src/pkg/manifests/system-kernel.man9f.inc
+++ b/usr/src/pkg/manifests/system-kernel.man9f.inc
@@ -1308,6 +1308,8 @@ link path=usr/share/man/man9f/scsi_hba_iportmap_iport_remove.9f \
target=scsi_hba_iportmap_create.9f
link path=usr/share/man/man9f/scsi_hba_pkt_free.9f \
target=scsi_hba_pkt_alloc.9f
+link path=usr/share/man/man9f/scsi_hba_tgtmap_destroy.9f \
+ target=scsi_hba_tgtmap_create.9f
link path=usr/share/man/man9f/scsi_hba_tgtmap_set_add.9f \
target=scsi_hba_tgtmap_create.9f
link path=usr/share/man/man9f/scsi_hba_tgtmap_set_begin.9f \
diff --git a/usr/src/tools/scripts/wsdiff.py b/usr/src/tools/scripts/wsdiff.py
index 86b805b30f..78347ea3b5 100644
--- a/usr/src/tools/scripts/wsdiff.py
+++ b/usr/src/tools/scripts/wsdiff.py
@@ -71,10 +71,11 @@
# -i Tell wsdiff which objects to compare via an input file list
from __future__ import print_function
-import datetime, fnmatch, getopt, os, profile, subprocess
+import datetime, fnmatch, getopt, os, profile, io, subprocess
import re, resource, select, shutil, signal, string, struct, sys, tempfile
import time, threading
from stat import *
+from subprocess import Popen, PIPE
# Human readable diffs truncated by default if longer than this
# Specifying -v on the command line will override
@@ -114,6 +115,11 @@ wsdiff_exceptions = [
"usr/perl5/5.6.1/lib/i86pc-solaris-64int/CORE/libperl.so.1"
]
+def getoutput(cmd):
+ p = Popen(cmd, shell=True, stdout=PIPE)
+ output, x = p.communicate()
+ return (p.returncode, output.decode(errors='replace'))
+
#####
# Logging routines
#
@@ -240,8 +246,7 @@ def diffFileData(tmpf1, tmpf2) :
tmpf2 = tmp_od2
try:
- data = subprocess.check_output(
- diff_cmd + " " + tmpf1 + " " + tmpf2)
+ rc, data = getoutput(diff_cmd + " " + tmpf1 + " " + tmpf2)
# Remove the temp files as we no longer need them.
if binaries :
try:
@@ -272,13 +277,13 @@ def diffData(base, ptch, d1, d2) :
tmpFile2 = tmpDir2 + os.path.basename(ptch) + t.getName()
try:
- fd1 = open(tmpFile1, "w")
+ fd1 = io.open(tmpFile1, mode='w', errors='ignore')
except:
error("failed to open: " + tmpFile1)
cleanup(1)
try:
- fd2 = open(tmpFile2, "w")
+ fd2 = io.open(tmpFile2, mode='w', errors='ignore')
except:
error("failed to open: " + tmpFile2)
cleanup(1)
@@ -448,18 +453,16 @@ def getTheFileType(f) :
#
# Return non-zero if "f" is an ELF file
#
-elfmagic = '\177ELF'
+elfmagic = b'\177ELF'
def isELF(f) :
try:
- fd = open(f)
- except:
- error("failed to open: " + f)
- return 0
- magic = fd.read(len(elfmagic))
- fd.close()
+ with io.open(f, mode='rb') as fd:
+ magic = fd.read(len(elfmagic))
- if magic == elfmagic :
- return 1
+ if magic == elfmagic :
+ return 1
+ except:
+ pass
return 0
#
@@ -468,17 +471,14 @@ def isELF(f) :
#
def isBinary(f) :
try:
- fd = open(f)
- except:
- error("failed to open: " + f)
- return 0
- s = fd.read()
- fd.close()
+ with io.open(f, mode='rb') as fd:
+ s = fd.read()
- if s.find('\0') == -1 :
- return 0
- else :
- return 1
+ if s.find(b'\0') == -1 :
+ return 0
+ except:
+ pass
+ return 1
#####
# Directory traversal and file finding
@@ -678,7 +678,7 @@ def get_elfheader(f) :
header = {}
- hstring = subprocess.check_output(elfdump_cmd + " -c " + f)
+ rc, hstring = getoutput(elfdump_cmd + " -c " + f)
if len(hstring) == 0 :
error("Failed to dump ELF header for " + f)
@@ -707,7 +707,7 @@ def get_elfheader(f) :
#
def extract_elf_section(f, section) :
- data = subprocess.check_output(dump_cmd + " -sn " + section + " " + f)
+ rc, data = getoutput(dump_cmd + " -sn " + section + " " + f)
if len(data) == 0 :
error(dump_cmd + "yielded no data on section " + section +
@@ -834,13 +834,13 @@ def compareElfs(base, ptch, quiet) :
base_header = get_elfheader(base)
except:
return
- sections = base_header.keys()
+ sections = list(base_header.keys())
try:
ptch_header = get_elfheader(ptch)
except:
return
- e2_only_sections = ptch_header.keys()
+ e2_only_sections = list(ptch_header.keys())
e1_only_sections = []
@@ -982,22 +982,20 @@ def compareArchives(base, ptch, fileType) :
# copy over the objects to the temp areas, and
# unpack them
baseCmd = "cp -fp " + base + " " + ArchTmpDir1
- try:
- output = subprocess.check_output(baseCmd)
- except CalledProcessError:
+ rc, output = getoutput(baseCmd)
+ if rc != 0:
error(baseCmd + " failed: " + output)
clearTmpDirs(ArchTmpDir1, ArchTmpDir2)
return -1
ptchCmd = "cp -fp " + ptch + " " + ArchTmpDir2
- try:
- output = subprocess.check_output(ptchCmd)
- except CalledProcessError:
+ rc, output = getoutput(ptchCmd)
+ if rc != 0:
error(ptchCmd + " failed: " + output)
clearTmpDirs(ArchTmpDir1, ArchTmpDir2)
return -1
- bname = string.split(fileName, '/')[-1]
+ bname = fileName.split('/')[-1]
if fileType == "Java Archive" :
baseCmd = ("cd " + ArchTmpDir1 + "; " + "jar xf " + bname +
"; rm -f " + bname + " META-INF/MANIFEST.MF")
@@ -1072,12 +1070,12 @@ def compareBasic(base, ptch, quiet, fileType) :
return 1
try:
- baseFile = open(base)
+ baseFile = io.open(base, errors='replace')
except:
error("could not open " + base)
return -1
try:
- ptchFile = open(ptch)
+ ptchFile = io.open(ptch, errors='replace')
except:
error("could not open " + ptch)
return -1
@@ -1095,10 +1093,9 @@ def compareBasic(base, ptch, quiet, fileType) :
toSnipEndStr = "-->\n"
if needToSnip :
- toSnipBegin = string.find(baseData, toSnipBeginStr)
+ toSnipBegin = baseData.find(toSnipBeginStr)
if toSnipBegin != -1 :
- toSnipEnd = (string.find(baseData[toSnipBegin:],
- toSnipEndStr) +
+ toSnipEnd = (baseData[toSnipBegin:].find(toSnipEndStr) +
len(toSnipEndStr))
baseData = (baseData[:toSnipBegin] +
baseData[toSnipBegin + toSnipEnd:])
@@ -1364,7 +1361,8 @@ def main() :
# Try to look for tools in $SRC/tools if the "-t" option
# was specified
#
- arch = subprocess.check_output("uname -p")
+ rc, arch = getoutput("uname -p")
+ arch = arch.rstrip()
if localTools :
try:
src = os.environ['SRC']
diff --git a/usr/src/uts/i86pc/boot/boot_keyboard.c b/usr/src/uts/i86pc/boot/boot_keyboard.c
index 220e254f47..3bf27243aa 100644
--- a/usr/src/uts/i86pc/boot/boot_keyboard.c
+++ b/usr/src/uts/i86pc/boot/boot_keyboard.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Miniature keyboard driver for bootstrap. This allows keyboard
* support to continue after we take over interrupts and disable
@@ -144,6 +142,10 @@ static struct {
-1, /* pending */
};
+#define KTAB_STRLEN 3
+static char keystringtab[KTAB_STRLEN] = {'\033', '[', ' '};
+static int keystring = -1;
+
static int kb_translate(unsigned char code);
static void kb_send(unsigned char cmd);
static void kb_update_leds(void);
@@ -157,6 +159,15 @@ kb_getchar(void)
while (!kb_ischar())
/* LOOP */;
+ if (keystring >= 0) {
+ ret = keystringtab[keystring++];
+ if (keystring == KTAB_STRLEN) {
+ keystring = -1;
+ kb.pending = -1;
+ }
+ return (ret);
+ }
+
/*
* kb_ischar() doesn't succeed without leaving kb.pending
* set.
@@ -164,8 +175,27 @@ kb_getchar(void)
ASSERT(kb.pending >= 0);
if (kb.pending & 0x100) {
- ret = 0;
kb.pending &= 0xff;
+ switch (kb.pending) {
+ case 'H': /* Up */
+ keystringtab[2] = 'A';
+ keystring = 0;
+ return (kb_getchar());
+ case 'P': /* Down */
+ keystringtab[2] = 'B';
+ keystring = 0;
+ return (kb_getchar());
+ case 'M': /* Right */
+ keystringtab[2] = 'C';
+ keystring = 0;
+ return (kb_getchar());
+ case 'K': /* Left */
+ keystringtab[2] = 'D';
+ keystring = 0;
+ return (kb_getchar());
+ default:
+ ret = 0;
+ }
} else {
ret = kb.pending;
kb.pending = -1;