int → bool
This commit is contained in:
parent
c11d35312a
commit
befbed2859
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.384 2010/07/21 11:31:13 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.385 2010/07/24 17:08:28 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -25,7 +25,7 @@
|
|||||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R39 2010/07/21
|
@(#)MIRBSD KSH R39 2010/07/24
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
30
histrap.c
30
histrap.c
@ -26,7 +26,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.97 2010/07/17 22:09:35 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.98 2010/07/24 17:08:29 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* MirOS: This is the default mapping type, and need not be specified.
|
* MirOS: This is the default mapping type, and need not be specified.
|
||||||
@ -50,7 +50,7 @@ static int sprinkle(int);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int hist_execute(char *);
|
static int hist_execute(char *);
|
||||||
static int hist_replace(char **, const char *, const char *, int);
|
static int hist_replace(char **, const char *, const char *, bool);
|
||||||
static char **hist_get(const char *, bool, bool);
|
static char **hist_get(const char *, bool, bool);
|
||||||
static char **hist_get_oldest(void);
|
static char **hist_get_oldest(void);
|
||||||
static void histbackup(void);
|
static void histbackup(void);
|
||||||
@ -72,7 +72,8 @@ c_fc(const char **wp)
|
|||||||
struct temp *tf;
|
struct temp *tf;
|
||||||
const char *p;
|
const char *p;
|
||||||
char *editor = NULL;
|
char *editor = NULL;
|
||||||
int gflag = 0, lflag = 0, nflag = 0, sflag = 0, rflag = 0;
|
bool gflag = false, lflag = false, nflag = false, rflag = false,
|
||||||
|
sflag = false;
|
||||||
int optc;
|
int optc;
|
||||||
const char *first = NULL, *last = NULL;
|
const char *first = NULL, *last = NULL;
|
||||||
char **hfirst, **hlast, **hp;
|
char **hfirst, **hlast, **hp;
|
||||||
@ -88,7 +89,7 @@ c_fc(const char **wp)
|
|||||||
case 'e':
|
case 'e':
|
||||||
p = builtin_opt.optarg;
|
p = builtin_opt.optarg;
|
||||||
if (ksh_isdash(p))
|
if (ksh_isdash(p))
|
||||||
sflag++;
|
sflag = true;
|
||||||
else {
|
else {
|
||||||
size_t len = strlen(p);
|
size_t len = strlen(p);
|
||||||
editor = alloc(len + 4, ATEMP);
|
editor = alloc(len + 4, ATEMP);
|
||||||
@ -97,19 +98,19 @@ c_fc(const char **wp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'g': /* non-AT&T ksh */
|
case 'g': /* non-AT&T ksh */
|
||||||
gflag++;
|
gflag = true;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
lflag++;
|
lflag = true;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
nflag++;
|
nflag = true;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
rflag++;
|
rflag = true;
|
||||||
break;
|
break;
|
||||||
case 's': /* POSIX version of -e - */
|
case 's': /* POSIX version of -e - */
|
||||||
sflag++;
|
sflag = true;
|
||||||
break;
|
break;
|
||||||
/* kludge city - accept -num as -- -num (kind of) */
|
/* kludge city - accept -num as -- -num (kind of) */
|
||||||
case '0': case '1': case '2': case '3': case '4':
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
@ -186,11 +187,10 @@ c_fc(const char **wp)
|
|||||||
* when range is specified; AT&T ksh and pdksh allow out of
|
* when range is specified; AT&T ksh and pdksh allow out of
|
||||||
* bounds for -l as well.
|
* bounds for -l as well.
|
||||||
*/
|
*/
|
||||||
hfirst = hist_get(first, (lflag || last) ? true : false,
|
hfirst = hist_get(first, (lflag || last) ? true : false, lflag);
|
||||||
lflag ? true : false);
|
|
||||||
if (!hfirst)
|
if (!hfirst)
|
||||||
return (1);
|
return (1);
|
||||||
hlast = last ? hist_get(last, true, lflag ? true : false) :
|
hlast = last ? hist_get(last, true, lflag) :
|
||||||
(lflag ? hist_get_newest(false) : hfirst);
|
(lflag ? hist_get_newest(false) : hfirst);
|
||||||
if (!hlast)
|
if (!hlast)
|
||||||
return (1);
|
return (1);
|
||||||
@ -325,7 +325,7 @@ hist_execute(char *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hist_replace(char **hp, const char *pat, const char *rep, int globr)
|
hist_replace(char **hp, const char *pat, const char *rep, bool globr)
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
|
|
||||||
@ -338,12 +338,12 @@ hist_replace(char **hp, const char *pat, const char *rep, int globr)
|
|||||||
int len;
|
int len;
|
||||||
XString xs;
|
XString xs;
|
||||||
char *xp;
|
char *xp;
|
||||||
int any_subst = 0;
|
bool any_subst = false;
|
||||||
|
|
||||||
Xinit(xs, xp, 128, ATEMP);
|
Xinit(xs, xp, 128, ATEMP);
|
||||||
for (s = *hp; (s1 = strstr(s, pat)) && (!any_subst || globr);
|
for (s = *hp; (s1 = strstr(s, pat)) && (!any_subst || globr);
|
||||||
s = s1 + pat_len) {
|
s = s1 + pat_len) {
|
||||||
any_subst = 1;
|
any_subst = true;
|
||||||
len = s1 - s;
|
len = s1 - s;
|
||||||
XcheckN(xs, xp, len + rep_len);
|
XcheckN(xs, xp, len + rep_len);
|
||||||
memcpy(xp, s, len); /* first part */
|
memcpy(xp, s, len); /* first part */
|
||||||
|
4
sh.h
4
sh.h
@ -150,9 +150,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.400 2010/07/21 11:31:16 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.401 2010/07/24 17:08:30 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2010/07/21"
|
#define MKSH_VERSION "R39 2010/07/24"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user