Skip to content

Commit

Permalink
Merge branch 'upstream/7.0' into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Oct 14, 2021
2 parents 20e1ae7 + 76b22e5 commit 2574183
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 11 deletions.
19 changes: 13 additions & 6 deletions emacs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: emacs.c,v 1.87 2020/05/08 14:30:42 jca Exp $ */
/* $OpenBSD: emacs.c,v 1.88 2021/06/27 15:53:33 schwarze Exp $ */

/*
* Emacs-like command line editing and history
Expand Down Expand Up @@ -1851,11 +1851,17 @@ x_e_getu8(char *buf, int off)
return -1;
buf[off++] = c;

if (c == 0xf4)
/*
* In the following, comments refer to violations of
* the inequality tests at the ends of the lines.
* See the utf8(7) manual page for details.
*/

if ((c & 0xf8) == 0xf0 && c < 0xf5) /* beyond Unicode */
len = 4;
else if ((c & 0xf0) == 0xe0)
len = 3;
else if ((c & 0xe0) == 0xc0 && c > 0xc1)
else if ((c & 0xe0) == 0xc0 && c > 0xc1) /* use single byte */
len = 2;
else
len = 1;
Expand All @@ -1865,9 +1871,10 @@ x_e_getu8(char *buf, int off)
if (cc == -1)
break;
if (isu8cont(cc) == 0 ||
(c == 0xe0 && len == 3 && cc < 0xa0) ||
(c == 0xed && len == 3 && cc & 0x20) ||
(c == 0xf4 && len == 4 && cc & 0x30)) {
(c == 0xe0 && len == 3 && cc < 0xa0) || /* use 2 bytes */
(c == 0xed && len == 3 && cc > 0x9f) || /* surrogates */
(c == 0xf0 && len == 4 && cc < 0x90) || /* use 3 bytes */
(c == 0xf4 && len == 4 && cc > 0x8f)) { /* beyond Uni. */
x_e_ungetc(cc);
break;
}
Expand Down
23 changes: 21 additions & 2 deletions ksh.1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.\" $OpenBSD: ksh.1,v 1.214 2021/03/11 07:04:12 jmc Exp $
.\" $OpenBSD: ksh.1,v 1.215 2021/05/04 21:03:30 naddy Exp $
.\"
.\" Public Domain
.\"
.Dd $Mdocdate: March 11 2021 $
.Dd $Mdocdate: May 4 2021 $
.Dt KSH 1
.Os
.Sh NAME
Expand Down Expand Up @@ -3219,6 +3219,25 @@ resetting
.Ev OPTIND ,
may lead to unexpected results.
.Pp
The following code fragment shows how one might process the arguments
for a command that can take the option
.Fl a
and the option
.Fl o ,
which requires an argument.
.Bd -literal -offset indent
while getopts ao: name
do
case $name in
a) flag=1 ;;
o) oarg=$OPTARG ;;
?) echo "Usage: ..."; exit 2 ;;
esac
done
shift $(($OPTIND - 1))
echo "Non-option arguments: " "$@"
.Ed
.Pp
.It Xo
.Ic hash
.Op Fl r
Expand Down
23 changes: 21 additions & 2 deletions sh.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" $OpenBSD: sh.1,v 1.152 2019/05/22 15:23:23 schwarze Exp $
.\" $OpenBSD: sh.1,v 1.153 2021/05/04 21:03:31 naddy Exp $
.\"
.\" Copyright (c) 2015 Jason McIntyre <[email protected]>
.\"
Expand All @@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 22 2019 $
.Dd $Mdocdate: May 4 2021 $
.Dt SH 1
.Os
.Sh NAME
Expand Down Expand Up @@ -508,6 +508,25 @@ is a colon,
.Ev OPTARG
is set to the unsupported option,
otherwise an error message is displayed.
.Pp
The following code fragment shows how one might process the arguments
for a command that can take the option
.Fl a
and the option
.Fl o ,
which requires an argument.
.Bd -literal -offset indent
while getopts ao: name
do
case $name in
a) flag=1 ;;
o) oarg=$OPTARG ;;
?) echo "Usage: ..."; exit 2 ;;
esac
done
shift $(($OPTIND - 1))
echo "Non-option arguments: " "$@"
.Ed
.It Ic hash Op Fl r | Ar utility
Add
.Ar utility
Expand Down
4 changes: 3 additions & 1 deletion syn.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: syn.c,v 1.39 2018/04/24 08:25:16 kn Exp $ */
/* $OpenBSD: syn.c,v 1.40 2021/07/05 13:41:46 millert Exp $ */

/*
* shell parser (C version)
Expand Down Expand Up @@ -331,6 +331,8 @@ get_command(int cf)
nesting_push(&old_nesting, c);
t = newtp((c == WHILE) ? TWHILE : TUNTIL);
t->left = c_list(true);
if (t->left == NULL)
syntaxerr(NULL);
t->right = dogroup();
nesting_pop(&old_nesting);
break;
Expand Down

0 comments on commit 2574183

Please sign in to comment.