* document ^char and \ escape sequences

* when parsing ^char control chars, check the correct char when determining
  validity (previously, ^char was a NOP interpreted as the literal string
  because of this bug)
This commit is contained in:
lukem 1997-01-11 09:57:06 +00:00
parent aed485cdf2
commit 5785f63611
2 changed files with 49 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: editrc.5,v 1.2 1997/01/11 06:47:52 lukem Exp $
.\" $NetBSD: editrc.5,v 1.3 1997/01/11 09:57:06 lukem Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -115,7 +115,7 @@ to
Options include:
.Bl -tag -width 4n
.It Fl e
Bind all keys to the standard GNU Emacss-like bindings.
Bind all keys to the standard GNU Emacs-like bindings.
.It Fl v
Bind all keys to the standard
.Xr vi 1 -like
@ -146,6 +146,50 @@ Bound keys in
are themselves reinterpreted, and this continues for ten levels of
interpretation.
.El
.Pp
.Ar key
and
.Ar command
can contain control characters of the form
.Sm off
.Sq No ^ Ar character
.Sm on
.Po
e.g.
.Sq ^A
.Pc ,
and the following backslashed escape sequences:
.Pp
.Bl -tag -compact -offset indent -width 4n
.It Ic \ea
Bell
.It Ic \eb
Backspace
.It Ic \ee
Escape
.It Ic \ef
Formfeed
.It Ic \en
Newline
.It Ic \er
Carriage return
.It Ic \et
Horizontal tab
.It Ic \ev
Vertical tab
.Sm off
.It Sy \e Ar nnn
.Sm on
The ASCII character corresponding to the octal number
.Ar nnn .
.El
.Pp
.Sq \e
nullifies the special meaning of the following character,
if it has any, notably
.Sq \e
and
.Sq ^ .
.It Ic echotc Xo
.Op Fl sv
.Ar arg

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.4 1997/01/11 06:48:02 lukem Exp $ */
/* $NetBSD: parse.c,v 1.5 1997/01/11 09:57:08 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: parse.c,v 1.4 1997/01/11 06:48:02 lukem Exp $";
static char rcsid[] = "$NetBSD: parse.c,v 1.5 1997/01/11 09:57:08 lukem Exp $";
#endif
#endif /* not lint && not SCCSID */
@ -198,7 +198,7 @@ parse__escape(ptr)
break;
}
}
else if (*p == '^' && isalpha((unsigned char) *p)) {
else if (*p == '^' && isalpha((unsigned char) p[1])) {
p++;
c = (*p == '?') ? '\177' : (*p & 0237);
}