Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ksh ksh: Upgrade to C99 <stdbool.h>
details: https://anonhg.NetBSD.org/src/rev/cfff2c8e5eed
branches: trunk
changeset: 354805:cfff2c8e5eed
user: kamil <kamil%NetBSD.org@localhost>
date: Fri Jun 30 04:41:19 2017 +0000
description:
ksh: Upgrade to C99 <stdbool.h>
This shell already used C99 functions.
diffstat:
bin/ksh/c_ksh.c | 12 ++++----
bin/ksh/c_sh.c | 16 +++++-----
bin/ksh/c_test.c | 8 ++--
bin/ksh/edit.c | 27 +++++++++---------
bin/ksh/edit.h | 8 +++--
bin/ksh/emacs.c | 47 ++++++++++++++++----------------
bin/ksh/eval.c | 16 +++++-----
bin/ksh/exec.c | 73 ++++++++++++++++++++++++++-------------------------
bin/ksh/expr.c | 26 +++++++++---------
bin/ksh/history.c | 26 +++++++++---------
bin/ksh/io.c | 12 ++++----
bin/ksh/jobs.c | 32 +++++++++++-----------
bin/ksh/lex.c | 8 ++--
bin/ksh/mail.c | 6 ++--
bin/ksh/main.c | 12 ++++----
bin/ksh/misc.c | 10 +++---
bin/ksh/proto.h | 8 +++--
bin/ksh/sh.h | 8 +----
bin/ksh/syn.c | 78 +++++++++++++++++++++++++++---------------------------
bin/ksh/trap.c | 6 ++--
bin/ksh/tty.c | 12 ++++----
bin/ksh/var.c | 31 +++++++++++----------
bin/ksh/vi.c | 6 ++--
23 files changed, 246 insertions(+), 242 deletions(-)
diffs (truncated from 1847 to 300 lines):
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/c_ksh.c
--- a/bin/ksh/c_ksh.c Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/c_ksh.c Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $ */
+/* $NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $ */
/*
* built-in Korn commands: c_*
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $");
#endif
#include <sys/stat.h>
@@ -717,7 +717,7 @@
for (i = builtin_opt.optind; wp[i]; i++) {
if (func) {
f = findfunc(wp[i], hash(wp[i]),
- (fset&UCASEV_AL) ? TRUE : FALSE);
+ (fset&UCASEV_AL) ? true : false);
if (!f) {
/* at&t ksh does ++rval: bogus */
rval = 1;
@@ -1173,7 +1173,7 @@
/* assume old style options if -digits or -UPPERCASE */
if ((p = wp[1]) && *p == '-'
&& (digit(p[1]) || isupper((unsigned char)p[1]))) {
- if (!(t = gettrap(p + 1, TRUE))) {
+ if (!(t = gettrap(p + 1, true))) {
bi_errorf("bad signal `%s'", p + 1);
return 1;
}
@@ -1187,7 +1187,7 @@
lflag = 1;
break;
case 's':
- if (!(t = gettrap(builtin_opt.optarg, TRUE))) {
+ if (!(t = gettrap(builtin_opt.optarg, true))) {
bi_errorf("bad signal `%s'",
builtin_opt.optarg);
return 1;
@@ -1311,7 +1311,7 @@
bi_errorf("missing name argument");
return 1;
}
- if (!*var || *skip_varname(var, TRUE)) {
+ if (!*var || *skip_varname(var, true)) {
bi_errorf("%s: is not an identifier", var);
return 1;
}
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/c_sh.c
--- a/bin/ksh/c_sh.c Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/c_sh.c Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $ */
+/* $NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $ */
/*
* built-in Bourne commands
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $");
#endif
#include <sys/stat.h>
@@ -464,7 +464,7 @@
exstat = subst_exstat;
}
- rv = shell(s, FALSE);
+ rv = shell(s, false);
afree(s, ATEMP);
return rv;
}
@@ -515,13 +515,13 @@
* command 'exit' isn't confused with the pseudo-signal
* 'EXIT'.
*/
- s = (gettrap(*wp, FALSE) == NULL) ? *wp++ : NULL; /* get command */
+ s = (gettrap(*wp, false) == NULL) ? *wp++ : NULL; /* get command */
if (s != NULL && s[0] == '-' && s[1] == '\0')
s = NULL;
/* set/clear traps */
while (*wp != NULL) {
- p = gettrap(*wp++, TRUE);
+ p = gettrap(*wp++, true);
if (p == NULL) {
bi_errorf("bad signal %s", wp[-1]);
return 1;
@@ -546,7 +546,7 @@
if (arg) {
if (!getn(arg, &n)) {
exstat = 1;
- warningf(TRUE, "%s: bad number", arg);
+ warningf(true, "%s: bad number", arg);
} else
exstat = n;
}
@@ -612,7 +612,7 @@
* scripts, but don't generate an error (ie, keep going).
*/
if (n == quit) {
- warningf(TRUE, "%s: cannot %s", wp[0], wp[0]);
+ warningf(true, "%s: cannot %s", wp[0], wp[0]);
return 0;
}
/* POSIX says if n is too big, the last enclosing loop
@@ -621,7 +621,7 @@
*/
if (last_ep)
last_ep->flags &= ~EF_BRKCONT_PASS;
- warningf(TRUE, "%s: can only %s %d level(s)",
+ warningf(true, "%s: can only %s %d level(s)",
wp[0], wp[0], n - quit);
}
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/c_test.c
--- a/bin/ksh/c_test.c Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/c_test.c Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $ */
+/* $NetBSD: c_test.c,v 1.9 2017/06/30 04:41:19 kamil Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@@ -11,7 +11,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.9 2017/06/30 04:41:19 kamil Exp $");
#endif
#include <sys/stat.h>
@@ -352,11 +352,11 @@
*/
case TO_STEQL: /* = */
if (te->flags & TEF_DBRACKET)
- return gmatch(opnd1, opnd2, FALSE);
+ return gmatch(opnd1, opnd2, false);
return strcmp(opnd1, opnd2) == 0;
case TO_STNEQ: /* != */
if (te->flags & TEF_DBRACKET)
- return !gmatch(opnd1, opnd2, FALSE);
+ return !gmatch(opnd1, opnd2, false);
return strcmp(opnd1, opnd2) != 0;
case TO_STLT: /* < */
return strcmp(opnd1, opnd2) < 0;
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/edit.c
--- a/bin/ksh/edit.c Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/edit.c Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.c,v 1.31 2017/06/30 03:56:12 kamil Exp $ */
+/* $NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $ */
/*
* Command line editing - common code
@@ -7,9 +7,10 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.31 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $");
#endif
+#include <stdbool.h>
#include "config.h"
#ifdef EDIT
@@ -131,7 +132,7 @@
{
int i;
- x_mode(TRUE);
+ x_mode(true);
#ifdef EMACS
if (Flag(FEMACS) || Flag(FGMACS))
i = x_emacs(buf, len);
@@ -143,7 +144,7 @@
else
#endif
i = -1; /* internal error */
- x_mode(FALSE);
+ x_mode(false);
#if defined(TIOCGWINSZ)
if (got_sigwinch)
check_sigwinch();
@@ -162,9 +163,9 @@
while ((n = blocking_read(0, &c, 1)) < 0 && errno == EINTR)
if (trap) {
- x_mode(FALSE);
+ x_mode(false);
runtraps(0);
- x_mode(TRUE);
+ x_mode(true);
}
if (n != 1)
return -1;
@@ -192,12 +193,12 @@
shf_putc(*s++, shl_out);
}
-bool_t
+bool
x_mode(onoff)
- bool_t onoff;
+ bool onoff;
{
- static bool_t x_cur_mode;
- bool_t prev;
+ static bool x_cur_mode;
+ bool prev;
if (x_cur_mode == onoff)
return x_cur_mode;
@@ -849,7 +850,7 @@
{
char *toglob;
char *s;
- bool_t saw_slash = FALSE;
+ bool saw_slash = false;
if (slen < 0)
return (char *) 0;
@@ -870,7 +871,7 @@
|| (s[1] == '(' /*)*/ && strchr("*+?@!", *s)))
break;
else if (ISDIRSEP(*s))
- saw_slash = TRUE;
+ saw_slash = true;
}
if (!*s && (*toglob != '~' || saw_slash)) {
toglob[slen] = '*';
@@ -968,7 +969,7 @@
struct tbl *te;
for (twalk(&ts, tp); (te = tnext(&ts)); ) {
- if (gmatch(te->name, pat, FALSE))
+ if (gmatch(te->name, pat, false))
XPput(*wp, str_save(te->name, ATEMP));
}
}
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/edit.h
--- a/bin/ksh/edit.h Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/edit.h Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: edit.h,v 1.3 1999/11/02 22:06:45 jdolecek Exp $ */
+/* $NetBSD: edit.h,v 1.4 2017/06/30 04:41:19 kamil Exp $ */
/* NAME:
* edit.h - globals for edit modes
@@ -10,10 +10,12 @@
*
*
* RCSid:
- * $NetBSD: edit.h,v 1.3 1999/11/02 22:06:45 jdolecek Exp $
+ * $NetBSD: edit.h,v 1.4 2017/06/30 04:41:19 kamil Exp $
*
*/
+#include <stdbool.h>
+
/* some useful #defines */
#ifdef EXTERN
# define I__(i) = i
@@ -48,7 +50,7 @@
void x_flush ARGS((void));
void x_putc ARGS((int c));
void x_puts ARGS((const char *s));
-bool_t x_mode ARGS((bool_t onoff));
+bool x_mode ARGS((bool onoff));
int promptlen ARGS((const char *cp, const char **spp));
int x_do_comment ARGS((char *buf, int bsize, int *lenp));
void x_print_expansions ARGS((int nwords, char *const *words, int is_command));
diff -r 4edb0875dfce -r cfff2c8e5eed bin/ksh/emacs.c
--- a/bin/ksh/emacs.c Fri Jun 30 04:30:26 2017 +0000
+++ b/bin/ksh/emacs.c Fri Jun 30 04:41:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: emacs.c,v 1.36 2017/06/30 03:56:12 kamil Exp $ */
+/* $NetBSD: emacs.c,v 1.37 2017/06/30 04:41:19 kamil Exp $ */
/*
* Emacs-like command line editing and history
@@ -10,7 +10,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: emacs.c,v 1.36 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: emacs.c,v 1.37 2017/06/30 04:41:19 kamil Exp $");
#endif
Home |
Main Index |
Thread Index |
Old Index