From 2f7eec765d8da34c90c001ff907b34a39b36694f Mon Sep 17 00:00:00 2001
From: tg <tg@mirbsd.org>
Date: Sun, 5 Jan 2014 19:11:46 +0000
Subject: [PATCH] =?UTF-8?q?merge=20oksh=E2=80=99s=20=E2=80=9Cctype=20clean?=
 =?UTF-8?q?ups=E2=80=9D=20commit?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(not much of it applies since we don’t use the OS’ table-based lookup)
---
 edit.c  | 10 +++++-----
 expr.c  |  4 ++--
 funcs.c |  4 ++--
 lex.c   |  4 ++--
 main.c  |  4 ++--
 var.c   | 12 ++++++------
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/edit.c b/edit.c
index 97c4988..a025d0f 100644
--- a/edit.c
+++ b/edit.c
@@ -1,7 +1,7 @@
-/*	$OpenBSD: edit.c,v 1.38 2013/06/03 15:41:59 tedu Exp $	*/
+/*	$OpenBSD: edit.c,v 1.39 2013/12/17 16:37:05 deraadt Exp $	*/
 /*	$OpenBSD: edit.h,v 1.9 2011/05/30 17:14:35 martynas Exp $	*/
-/*	$OpenBSD: emacs.c,v 1.47 2013/11/28 10:33:37 sobrado Exp $	*/
-/*	$OpenBSD: vi.c,v 1.26 2009/06/29 22:50:19 martynas Exp $	*/
+/*	$OpenBSD: emacs.c,v 1.48 2013/12/17 16:37:05 deraadt Exp $	*/
+/*	$OpenBSD: vi.c,v 1.28 2013/12/18 16:45:46 deraadt Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@@ -28,7 +28,7 @@
 
 #ifndef MKSH_NO_CMDLINE_EDITING
 
-__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.273 2013/11/30 17:33:48 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.274 2014/01/05 19:11:43 tg Exp $");
 
 /*
  * in later versions we might use libtermcap for this, but since external
@@ -3547,7 +3547,7 @@ x_vi(char *buf)
 	x_flush();
 	while (/* CONSTCOND */ 1) {
 		if (macro.p) {
-			c = *macro.p++;
+			c = (unsigned char)*macro.p++;
 			/* end of current macro? */
 			if (!c) {
 				/* more macros left to finish? */
diff --git a/expr.c b/expr.c
index ce0915a..f404610 100644
--- a/expr.c
+++ b/expr.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: expr.c,v 1.22 2013/03/28 08:39:28 nicm Exp $	*/
+/*	$OpenBSD: expr.c,v 1.23 2013/12/17 16:37:06 deraadt Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@@ -23,7 +23,7 @@
 
 #include "sh.h"
 
-__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.73 2013/11/30 23:20:03 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.74 2014/01/05 19:11:44 tg Exp $");
 
 /* the order of these enums is constrained by the order of opinfo[] */
 enum token {
diff --git a/funcs.c b/funcs.c
index b9444d3..a62d46b 100644
--- a/funcs.c
+++ b/funcs.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: c_ksh.c,v 1.33 2009/02/07 14:03:24 kili Exp $	*/
+/*	$OpenBSD: c_ksh.c,v 1.34 2013/12/17 16:37:05 deraadt Exp $	*/
 /*	$OpenBSD: c_sh.c,v 1.44 2013/09/04 15:49:18 millert Exp $	*/
 /*	$OpenBSD: c_test.c,v 1.18 2009/03/01 20:11:06 otto Exp $	*/
 /*	$OpenBSD: c_ulimit.c,v 1.19 2013/11/28 10:33:37 sobrado Exp $	*/
@@ -38,7 +38,7 @@
 #endif
 #endif
 
-__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.252 2013/11/30 17:41:34 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.253 2014/01/05 19:11:44 tg Exp $");
 
 #if HAVE_KILLPG
 /*
diff --git a/lex.c b/lex.c
index 23ca350..919fc99 100644
--- a/lex.c
+++ b/lex.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: lex.c,v 1.48 2013/11/12 04:36:02 deraadt Exp $	*/
+/*	$OpenBSD: lex.c,v 1.49 2013/12/17 16:37:06 deraadt Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@@ -23,7 +23,7 @@
 
 #include "sh.h"
 
-__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.190 2013/11/17 22:19:42 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.191 2014/01/05 19:11:45 tg Exp $");
 
 /*
  * states while lexing word
diff --git a/main.c b/main.c
index 94e93f5..8103dd9 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,6 @@
 /*	$OpenBSD: main.c,v 1.54 2013/11/28 10:33:37 sobrado Exp $	*/
 /*	$OpenBSD: tty.c,v 1.9 2006/03/14 22:08:01 deraadt Exp $	*/
-/*	$OpenBSD: io.c,v 1.22 2006/03/17 16:30:13 millert Exp $	*/
+/*	$OpenBSD: io.c,v 1.23 2013/12/17 16:37:06 deraadt Exp $	*/
 /*	$OpenBSD: table.c,v 1.15 2012/02/19 07:52:30 otto Exp $	*/
 
 /*-
@@ -34,7 +34,7 @@
 #include <locale.h>
 #endif
 
-__RCSID("$MirOS: src/bin/mksh/main.c,v 1.273 2013/11/30 17:33:50 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/main.c,v 1.274 2014/01/05 19:11:45 tg Exp $");
 
 extern char **environ;
 
diff --git a/var.c b/var.c
index ba8fd82..d273d64 100644
--- a/var.c
+++ b/var.c
@@ -1,8 +1,8 @@
-/*	$OpenBSD: var.c,v 1.35 2013/04/05 01:31:30 tedu Exp $	*/
+/*	$OpenBSD: var.c,v 1.36 2013/12/17 16:37:06 deraadt Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- *		 2011, 2012, 2013
+ *		 2011, 2012, 2013, 2014
  *	Thorsten Glaser <tg@mirbsd.org>
  *
  * Provided that these terms and disclaimer and all copyright notices
@@ -27,7 +27,7 @@
 #include <sys/sysctl.h>
 #endif
 
-__RCSID("$MirOS: src/bin/mksh/var.c,v 1.173 2013/05/31 22:47:14 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/var.c,v 1.174 2014/01/05 19:11:46 tg Exp $");
 
 /*-
  * Variables
@@ -228,7 +228,7 @@ global(const char *n)
 	/* Check to see if this is an array */
 	n = array_index_calc(n, &array, &val);
 	h = hash(n);
-	c = n[0];
+	c = (unsigned char)n[0];
 	if (!ksh_isalphx(c)) {
 		if (array)
 			errorf("bad substitution");
@@ -239,7 +239,7 @@ global(const char *n)
 		*vp->name = c;
 		if (ksh_isdigit(c)) {
 			for (c = 0; ksh_isdigit(*n); n++)
-				c = c*10 + *n-'0';
+				c = (c * 10) + (*n - '0');
 			if (c <= l->argc)
 				/* setstr can't fail here */
 				setstr(vp, l->argv[c], KSH_RETURN_ERROR);
@@ -500,7 +500,7 @@ getint(struct tbl *vp, mksh_ari_u *nump, bool arith)
 		base = 8;
 		have_base = true;
 	}
-	while ((c = *s++)) {
+	while ((c = (unsigned char)*s++)) {
 		if (c == '-') {
 			neg = true;
 			continue;