* use only macros for ctype stuff any more
XXX one of these uses a gcc extension, ok for now tho * don't include <ctype.h> any more at all * don't try nl_langinfo in small mode, just check locale saves 171 .text, 4 .data, 256 .bss, 1 import
This commit is contained in:
parent
35b30679c7
commit
feb7dddd44
22
Build.sh
22
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.74 2006/11/09 23:09:05 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.75 2006/11/10 07:18:56 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Environment: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS, NROFF
|
# Environment: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS, NROFF
|
||||||
|
|
||||||
@ -18,8 +18,6 @@ ac_testn()
|
|||||||
{
|
{
|
||||||
f=$1
|
f=$1
|
||||||
fu=`upper $f`
|
fu=`upper $f`
|
||||||
test 0 = "$HAVE_$fu" && return
|
|
||||||
test 1 = "$HAVE_$fu" && return
|
|
||||||
if test x"$2" = x""; then
|
if test x"$2" = x""; then
|
||||||
ft=1
|
ft=1
|
||||||
else
|
else
|
||||||
@ -28,9 +26,21 @@ ac_testn()
|
|||||||
fi
|
fi
|
||||||
fd=$3
|
fd=$3
|
||||||
test x"$fd" = x"" && fd=$f
|
test x"$fd" = x"" && fd=$f
|
||||||
|
eval fv=\$HAVE_$fu
|
||||||
|
if test 0 = "$fv"; then
|
||||||
|
$e "==> $fd... no (cached)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if test 1 = "$fv"; then
|
||||||
|
$e "==> $fd... yes (cached)"
|
||||||
|
return
|
||||||
|
fi
|
||||||
if test 0 = "$ft"; then
|
if test 0 = "$ft"; then
|
||||||
eval HAVE_$fu=$2
|
fv=$2
|
||||||
$e "==> $fd... not checked ($2)"
|
eval HAVE_$fu=$fv
|
||||||
|
test 0 = "$fv" && fv=no
|
||||||
|
test 1 = "$fv" && fv=yes
|
||||||
|
$e "==> $fd... $fv (implied)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
$e ... $fd
|
$e ... $fd
|
||||||
@ -190,6 +200,8 @@ if test 0 = $HAVE_MKSH_FULL; then
|
|||||||
int main(void) { return (0); }
|
int main(void) { return (0); }
|
||||||
EOF
|
EOF
|
||||||
test 1 = $HAVE_CAN_FNOINLINE || CFLAGS=$save_CFLAGS
|
test 1 = $HAVE_CAN_FNOINLINE || CFLAGS=$save_CFLAGS
|
||||||
|
|
||||||
|
HAVE_LANGINFO_CODESET=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
save_CFLAGS=$CFLAGS
|
save_CFLAGS=$CFLAGS
|
||||||
|
63
edit.c
63
edit.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.70 2006/11/10 06:53:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.71 2006/11/10 07:18:56 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -497,7 +497,7 @@ x_locate_word(const char *buf, int buflen, int pos, int *startp,
|
|||||||
int iscmd;
|
int iscmd;
|
||||||
|
|
||||||
/* Figure out if this is a command */
|
/* Figure out if this is a command */
|
||||||
for (p = start - 1; p >= 0 && isspace((unsigned char)buf[p]);
|
for (p = start - 1; p >= 0 && ksh_isspace(buf[p]);
|
||||||
p--)
|
p--)
|
||||||
;
|
;
|
||||||
iscmd = p < 0 || strchr(";|&()`", buf[p]);
|
iscmd = p < 0 || strchr(";|&()`", buf[p]);
|
||||||
@ -1049,8 +1049,9 @@ struct x_defbindings {
|
|||||||
|
|
||||||
/* Separator for completion */
|
/* Separator for completion */
|
||||||
#define is_cfs(c) ((c) == ' ' || (c) == '\t' || (c) == '"' || (c) == '\'')
|
#define is_cfs(c) ((c) == ' ' || (c) == '\t' || (c) == '"' || (c) == '\'')
|
||||||
#define is_mfs(c) (!(isalnum((unsigned char)(c)) || (c) == '_' || \
|
/* Separator for motion */
|
||||||
(c) == '$')) /* Separator for motion */
|
#define is_mfs(c) (!(ksh_isdigit(c) || ksh_islower(c) || \
|
||||||
|
ksh_isupper(c) || (c) == '_' || (c) == '$'))
|
||||||
|
|
||||||
#define CHARMASK 0xFF /* 8-bit character mask */
|
#define CHARMASK 0xFF /* 8-bit character mask */
|
||||||
#define X_NTABS 3 /* normal, meta1, meta2 */
|
#define X_NTABS 3 /* normal, meta1, meta2 */
|
||||||
@ -3209,9 +3210,9 @@ x_fold_case(int c)
|
|||||||
*/
|
*/
|
||||||
if (cp != xep) {
|
if (cp != xep) {
|
||||||
if (c == 'L') /* lowercase */
|
if (c == 'L') /* lowercase */
|
||||||
*cp = _tolower((unsigned char)*cp);
|
*cp = ksh_tolower(*cp);
|
||||||
else /* uppercase, capitalise */
|
else /* uppercase, capitalise */
|
||||||
*cp = _toupper((unsigned char)*cp);
|
*cp = ksh_toupper(*cp);
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -3219,9 +3220,9 @@ x_fold_case(int c)
|
|||||||
*/
|
*/
|
||||||
while (cp != xep && !is_mfs(*cp)) {
|
while (cp != xep && !is_mfs(*cp)) {
|
||||||
if (c == 'U') /* uppercase */
|
if (c == 'U') /* uppercase */
|
||||||
*cp = _toupper((unsigned char)*cp);
|
*cp = ksh_toupper(*cp);
|
||||||
else /* lowercase, capitalise */
|
else /* lowercase, capitalise */
|
||||||
*cp = _tolower((unsigned char)*cp);
|
*cp = ksh_tolower(*cp);
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3744,9 +3745,9 @@ vi_hook(int ch)
|
|||||||
int i;
|
int i;
|
||||||
int n = srchlen;
|
int n = srchlen;
|
||||||
|
|
||||||
while (n > 0 && isspace((unsigned char)locpat[n - 1]))
|
while (n > 0 && ksh_isspace(locpat[n - 1]))
|
||||||
n--;
|
n--;
|
||||||
while (n > 0 && !isspace((unsigned char)locpat[n - 1]))
|
while (n > 0 && !ksh_isspace(locpat[n - 1]))
|
||||||
n--;
|
n--;
|
||||||
for (i = srchlen; --i >= n; )
|
for (i = srchlen; --i >= n; )
|
||||||
es->linelen -= char_len((unsigned char)locpat[i]);
|
es->linelen -= char_len((unsigned char)locpat[i]);
|
||||||
@ -4116,8 +4117,8 @@ vi_cmd(int argcnt, const char *cmd)
|
|||||||
return -1;
|
return -1;
|
||||||
if (*cmd == 'c' &&
|
if (*cmd == 'c' &&
|
||||||
(cmd[1] == 'w' || cmd[1] == 'W') &&
|
(cmd[1] == 'w' || cmd[1] == 'W') &&
|
||||||
!isspace((unsigned char)(es->cbuf[es->cursor]))) {
|
!ksh_isspace(es->cbuf[es->cursor])) {
|
||||||
while (isspace((unsigned char)(es->cbuf[--ncursor])))
|
while (ksh_isspace(es->cbuf[--ncursor]))
|
||||||
;
|
;
|
||||||
ncursor++;
|
ncursor++;
|
||||||
}
|
}
|
||||||
@ -4368,7 +4369,7 @@ vi_cmd(int argcnt, const char *cmd)
|
|||||||
if (histnum(-1) < 0)
|
if (histnum(-1) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
p = *histpos();
|
p = *histpos();
|
||||||
#define issp(c) (isspace((unsigned char)(c)) || (c) == '\n')
|
#define issp(c) (ksh_isspace(c) || (c) == '\n')
|
||||||
if (argcnt) {
|
if (argcnt) {
|
||||||
while (*p && issp(*p))
|
while (*p && issp(*p))
|
||||||
p++;
|
p++;
|
||||||
@ -4425,14 +4426,14 @@ vi_cmd(int argcnt, const char *cmd)
|
|||||||
return -1;
|
return -1;
|
||||||
for (i = 0; i < argcnt; i++) {
|
for (i = 0; i < argcnt; i++) {
|
||||||
p = &es->cbuf[es->cursor];
|
p = &es->cbuf[es->cursor];
|
||||||
if (ksh_islower((unsigned char)*p)) {
|
if (ksh_islower(*p)) {
|
||||||
modified = 1;
|
modified = 1;
|
||||||
hnum = hlast;
|
hnum = hlast;
|
||||||
*p = _toupper((unsigned char)*p);
|
*p = ksh_toupper(*p);
|
||||||
} else if (ksh_isupper((unsigned char)*p)) {
|
} else if (ksh_isupper(*p)) {
|
||||||
modified = 1;
|
modified = 1;
|
||||||
hnum = hlast;
|
hnum = hlast;
|
||||||
*p = _tolower((unsigned char)*p);
|
*p = ksh_tolower(*p);
|
||||||
}
|
}
|
||||||
if (es->cursor < es->linelen - 1)
|
if (es->cursor < es->linelen - 1)
|
||||||
es->cursor++;
|
es->cursor++;
|
||||||
@ -4577,7 +4578,7 @@ domove(int argcnt, const char *cmd, int sub)
|
|||||||
case '^':
|
case '^':
|
||||||
ncursor = 0;
|
ncursor = 0;
|
||||||
while (ncursor < es->linelen - 1 &&
|
while (ncursor < es->linelen - 1 &&
|
||||||
isspace((unsigned char)(es->cbuf[ncursor])))
|
ksh_isspace(es->cbuf[ncursor]))
|
||||||
ncursor++;
|
ncursor++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4844,12 +4845,12 @@ forwword(int argcnt)
|
|||||||
while (is_wordch(es->cbuf[ncursor]) &&
|
while (is_wordch(es->cbuf[ncursor]) &&
|
||||||
ncursor < es->linelen)
|
ncursor < es->linelen)
|
||||||
ncursor++;
|
ncursor++;
|
||||||
else if (!isspace((unsigned char)(es->cbuf[ncursor])))
|
else if (!ksh_isspace(es->cbuf[ncursor]))
|
||||||
while (!is_wordch(es->cbuf[ncursor]) &&
|
while (!is_wordch(es->cbuf[ncursor]) &&
|
||||||
!isspace((unsigned char)(es->cbuf[ncursor])) &&
|
!ksh_isspace(es->cbuf[ncursor]) &&
|
||||||
ncursor < es->linelen)
|
ncursor < es->linelen)
|
||||||
ncursor++;
|
ncursor++;
|
||||||
while (isspace((unsigned char)(es->cbuf[ncursor])) &&
|
while (ksh_isspace(es->cbuf[ncursor]) &&
|
||||||
ncursor < es->linelen)
|
ncursor < es->linelen)
|
||||||
ncursor++;
|
ncursor++;
|
||||||
}
|
}
|
||||||
@ -4863,7 +4864,7 @@ backword(int argcnt)
|
|||||||
|
|
||||||
ncursor = es->cursor;
|
ncursor = es->cursor;
|
||||||
while (ncursor > 0 && argcnt--) {
|
while (ncursor > 0 && argcnt--) {
|
||||||
while (--ncursor > 0 && isspace((unsigned char)(es->cbuf[ncursor])))
|
while (--ncursor > 0 && ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
if (ncursor > 0) {
|
if (ncursor > 0) {
|
||||||
if (is_wordch(es->cbuf[ncursor]))
|
if (is_wordch(es->cbuf[ncursor]))
|
||||||
@ -4873,7 +4874,7 @@ backword(int argcnt)
|
|||||||
else
|
else
|
||||||
while (--ncursor >= 0 &&
|
while (--ncursor >= 0 &&
|
||||||
!is_wordch(es->cbuf[ncursor]) &&
|
!is_wordch(es->cbuf[ncursor]) &&
|
||||||
!isspace((unsigned char)(es->cbuf[ncursor])))
|
!ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
ncursor++;
|
ncursor++;
|
||||||
}
|
}
|
||||||
@ -4889,7 +4890,7 @@ endword(int argcnt)
|
|||||||
ncursor = es->cursor;
|
ncursor = es->cursor;
|
||||||
while (ncursor < es->linelen && argcnt--) {
|
while (ncursor < es->linelen && argcnt--) {
|
||||||
while (++ncursor < es->linelen - 1 &&
|
while (++ncursor < es->linelen - 1 &&
|
||||||
isspace((unsigned char)(es->cbuf[ncursor])))
|
ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
if (ncursor < es->linelen - 1) {
|
if (ncursor < es->linelen - 1) {
|
||||||
if (is_wordch(es->cbuf[ncursor]))
|
if (is_wordch(es->cbuf[ncursor]))
|
||||||
@ -4899,7 +4900,7 @@ endword(int argcnt)
|
|||||||
else
|
else
|
||||||
while (++ncursor < es->linelen &&
|
while (++ncursor < es->linelen &&
|
||||||
!is_wordch(es->cbuf[ncursor]) &&
|
!is_wordch(es->cbuf[ncursor]) &&
|
||||||
!isspace((unsigned char)(es->cbuf[ncursor])))
|
!ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
ncursor--;
|
ncursor--;
|
||||||
}
|
}
|
||||||
@ -4914,10 +4915,10 @@ Forwword(int argcnt)
|
|||||||
|
|
||||||
ncursor = es->cursor;
|
ncursor = es->cursor;
|
||||||
while (ncursor < es->linelen && argcnt--) {
|
while (ncursor < es->linelen && argcnt--) {
|
||||||
while (!isspace((unsigned char)(es->cbuf[ncursor])) &&
|
while (!ksh_isspace(es->cbuf[ncursor]) &&
|
||||||
ncursor < es->linelen)
|
ncursor < es->linelen)
|
||||||
ncursor++;
|
ncursor++;
|
||||||
while (isspace((unsigned char)(es->cbuf[ncursor])) &&
|
while (ksh_isspace(es->cbuf[ncursor]) &&
|
||||||
ncursor < es->linelen)
|
ncursor < es->linelen)
|
||||||
ncursor++;
|
ncursor++;
|
||||||
}
|
}
|
||||||
@ -4932,10 +4933,10 @@ Backword(int argcnt)
|
|||||||
ncursor = es->cursor;
|
ncursor = es->cursor;
|
||||||
while (ncursor > 0 && argcnt--) {
|
while (ncursor > 0 && argcnt--) {
|
||||||
while (--ncursor >= 0 &&
|
while (--ncursor >= 0 &&
|
||||||
isspace((unsigned char)(es->cbuf[ncursor])))
|
ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
while (ncursor >= 0 &&
|
while (ncursor >= 0 &&
|
||||||
!isspace((unsigned char)(es->cbuf[ncursor])))
|
!ksh_isspace(es->cbuf[ncursor]))
|
||||||
ncursor--;
|
ncursor--;
|
||||||
ncursor++;
|
ncursor++;
|
||||||
}
|
}
|
||||||
@ -4950,11 +4951,11 @@ Endword(int argcnt)
|
|||||||
ncursor = es->cursor;
|
ncursor = es->cursor;
|
||||||
while (ncursor < es->linelen - 1 && argcnt--) {
|
while (ncursor < es->linelen - 1 && argcnt--) {
|
||||||
while (++ncursor < es->linelen - 1 &&
|
while (++ncursor < es->linelen - 1 &&
|
||||||
isspace((unsigned char)(es->cbuf[ncursor])))
|
ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
if (ncursor < es->linelen - 1) {
|
if (ncursor < es->linelen - 1) {
|
||||||
while (++ncursor < es->linelen &&
|
while (++ncursor < es->linelen &&
|
||||||
!isspace((unsigned char)(es->cbuf[ncursor])))
|
!ksh_isspace(es->cbuf[ncursor]))
|
||||||
;
|
;
|
||||||
ncursor--;
|
ncursor--;
|
||||||
}
|
}
|
||||||
|
4
expr.c
4
expr.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.4 2006/05/10 18:54:10 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.5 2006/11/10 07:18:57 tg Exp $");
|
||||||
|
|
||||||
/* The order of these enums is constrained by the order of opinfo[] */
|
/* The order of these enums is constrained by the order of opinfo[] */
|
||||||
enum token {
|
enum token {
|
||||||
@ -448,7 +448,7 @@ token(Expr_state *es)
|
|||||||
char *tvar;
|
char *tvar;
|
||||||
|
|
||||||
/* skip white space */
|
/* skip white space */
|
||||||
for (cp = es->tokp; (c = *cp), isspace(c); cp++)
|
for (cp = es->tokp; (c = *cp), ksh_isspace(c); cp++)
|
||||||
;
|
;
|
||||||
es->tokp = cp;
|
es->tokp = cp;
|
||||||
|
|
||||||
|
4
lex.c
4
lex.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.22 2006/11/05 15:31:36 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.23 2006/11/10 07:18:57 tg Exp $");
|
||||||
|
|
||||||
/* Structure to keep track of the lexing state and the various pieces of info
|
/* Structure to keep track of the lexing state and the various pieces of info
|
||||||
* needed for each particular state. */
|
* needed for each particular state. */
|
||||||
@ -899,7 +899,7 @@ getsc__(void)
|
|||||||
source->flags |= s->flags & SF_ALIAS;
|
source->flags |= s->flags & SF_ALIAS;
|
||||||
s = source;
|
s = source;
|
||||||
} else if (*s->u.tblp->val.s &&
|
} else if (*s->u.tblp->val.s &&
|
||||||
isspace((unsigned char)strchr(s->u.tblp->val.s, 0)[-1])) {
|
ksh_isspace(strchr(s->u.tblp->val.s, 0)[-1])) {
|
||||||
source = s = s->next; /* pop source stack */
|
source = s = s->next; /* pop source stack */
|
||||||
/* Note that this alias ended with a space,
|
/* Note that this alias ended with a space,
|
||||||
* enabling alias expansion on the following
|
* enabling alias expansion on the following
|
||||||
|
4
misc.c
4
misc.c
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.36 2006/11/10 06:53:27 tg Exp $\t"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.37 2006/11/10 07:18:57 tg Exp $\t"
|
||||||
MKSH_SH_H_ID);
|
MKSH_SH_H_ID);
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
@ -429,7 +429,7 @@ getn(const char *s, int *ai)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
c = *s++;
|
c = *s++;
|
||||||
} while (isspace(c));
|
} while (ksh_isspace(c));
|
||||||
if (c == '-') {
|
if (c == '-') {
|
||||||
neg = true;
|
neg = true;
|
||||||
c = *s++;
|
c = *s++;
|
||||||
|
10
sh.h
10
sh.h
@ -8,7 +8,7 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.78 2006/11/10 06:53:27 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.79 2006/11/10 07:18:57 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2006/11/10"
|
#define MKSH_VERSION "R29 2006/11/10"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
@ -40,7 +40,6 @@
|
|||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -105,6 +104,13 @@
|
|||||||
#define ksh_tolower(c) (((c) >= 'A') && ((c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
#define ksh_tolower(c) (((c) >= 'A') && ((c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
||||||
#define ksh_toupper(c) (((c) >= 'a') && ((c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
#define ksh_toupper(c) (((c) >= 'a') && ((c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
||||||
|
|
||||||
|
/* this macro must not evaluate its arguments several times */
|
||||||
|
#define ksh_isspace(c) __extension__({ \
|
||||||
|
unsigned char ksh_isspace_c = (c); \
|
||||||
|
(ksh_isspace_c >= 0x09 && ksh_isspace_c <= 0x0D) || \
|
||||||
|
(ksh_isspace_c == 0x20); \
|
||||||
|
})
|
||||||
|
|
||||||
#ifndef S_ISTXT
|
#ifndef S_ISTXT
|
||||||
#define S_ISTXT 0001000
|
#define S_ISTXT 0001000
|
||||||
#endif
|
#endif
|
||||||
|
10
var.c
10
var.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.29 2006/11/10 06:53:27 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.30 2006/11/10 07:18:58 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -505,7 +505,7 @@ formatstr(struct tbl *vp, const char *s)
|
|||||||
if (vp->flag & RJUST) {
|
if (vp->flag & RJUST) {
|
||||||
const char *qq = s + olen;
|
const char *qq = s + olen;
|
||||||
/* strip trailing spaces (at&t uses qq[-1] == ' ') */
|
/* strip trailing spaces (at&t uses qq[-1] == ' ') */
|
||||||
while (qq > s && isspace((unsigned char)qq[-1]))
|
while (qq > s && ksh_isspace(qq[-1]))
|
||||||
--qq;
|
--qq;
|
||||||
slen = qq - s;
|
slen = qq - s;
|
||||||
if (slen > vp->u2.field) {
|
if (slen > vp->u2.field) {
|
||||||
@ -520,7 +520,7 @@ formatstr(struct tbl *vp, const char *s)
|
|||||||
"%.*s", slen, s);
|
"%.*s", slen, s);
|
||||||
} else {
|
} else {
|
||||||
/* strip leading spaces/zeros */
|
/* strip leading spaces/zeros */
|
||||||
while (isspace((unsigned char)*s))
|
while (ksh_isspace(*s))
|
||||||
s++;
|
s++;
|
||||||
if (vp->flag & ZEROFIL)
|
if (vp->flag & ZEROFIL)
|
||||||
while (*s == '0')
|
while (*s == '0')
|
||||||
@ -533,10 +533,10 @@ formatstr(struct tbl *vp, const char *s)
|
|||||||
|
|
||||||
if (vp->flag & UCASEV_AL) {
|
if (vp->flag & UCASEV_AL) {
|
||||||
for (q = p; *q; q++)
|
for (q = p; *q; q++)
|
||||||
*q = _toupper((unsigned char)*q);
|
*q = ksh_toupper(*q);
|
||||||
} else if (vp->flag & LCASEV) {
|
} else if (vp->flag & LCASEV) {
|
||||||
for (q = p; *q; q++)
|
for (q = p; *q; q++)
|
||||||
*q = _tolower((unsigned char)*q);
|
*q = ksh_tolower(*q);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user