While mksh R39 builds fine on MirOS #7s8E on my trusty sparc, pgcc 2.95.3
throws out quite some warnings – fix most of them except most emitted via -Wconversion; work around some others; discard bogus warnings. sync clog
This commit is contained in:
15
Build.sh
15
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.419 2009/08/01 21:58:06 tg Stab $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.420 2009/08/08 13:08:48 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||||
# Thorsten Glaser <tg@mirbsd.org>
|
# Thorsten Glaser <tg@mirbsd.org>
|
||||||
@ -1123,7 +1123,7 @@ ac_testn flock_ex '' 'flock and mmap' <<-'EOF'
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
int main(void) { return ((void *)mmap(NULL, (size_t)flock(0, LOCK_EX),
|
int main(void) { return ((void *)mmap(NULL, (size_t)flock(0, LOCK_EX),
|
||||||
PROT_READ, MAP_PRIVATE, 0, 0) == (void *)NULL ? 1 :
|
PROT_READ, MAP_PRIVATE, 0, (off_t)0) == (void *)NULL ? 1 :
|
||||||
munmap(NULL, 0)); }
|
munmap(NULL, 0)); }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -1147,8 +1147,9 @@ ac_test mknod '' 'if to use mknod(), makedev() and friends' <<-'EOF'
|
|||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
int main(int ac, char *av[]) {
|
int main(int ac, char *av[]) {
|
||||||
dev_t dv;
|
dev_t dv;
|
||||||
dv = makedev((unsigned int)ac, 1);
|
dv = makedev((unsigned int)ac, (unsigned int)av[0][0]);
|
||||||
return (mknod(av[0], 0, dv) ? (int)major(dv) : (int)minor(dv));
|
return (mknod(av[0], (mode_t)0, dv) ? (int)major(dv) :
|
||||||
|
(int)minor(dv));
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -1209,7 +1210,8 @@ ac_test setmode mknod 1 <<-'EOF'
|
|||||||
int main(void) { return (thiswillneverbedefinedIhope()); }
|
int main(void) { return (thiswillneverbedefinedIhope()); }
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
int main(int ac, char *av[]) { return (getmode(setmode(av[0]), ac)); }
|
int main(int ac, char *av[]) { return (getmode(setmode(av[0]),
|
||||||
|
(mode_t)ac)); }
|
||||||
#endif
|
#endif
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -1242,7 +1244,8 @@ EOF
|
|||||||
|
|
||||||
ac_test strlcpy <<-'EOF'
|
ac_test strlcpy <<-'EOF'
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
int main(int ac, char *av[]) { return (strlcpy(*av, av[1], ac)); }
|
int main(int ac, char *av[]) { return (strlcpy(*av, av[1],
|
||||||
|
(size_t)ac)); }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
#
|
#
|
||||||
|
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.298 2009/08/01 21:57:52 tg Stab $
|
# $MirOS: src/bin/mksh/check.t,v 1.299 2009/08/08 13:08:48 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 2009/08/01
|
@(#)MIRBSD KSH R39 2009/08/08
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
8
exec.c
8
exec.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.59 2009/06/11 12:42:17 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.60 2009/08/08 13:08:49 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile, volatile int *);
|
int volatile, volatile int *);
|
||||||
@ -537,7 +537,7 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CFUNC: { /* function call */
|
case CFUNC: { /* function call */
|
||||||
volatile char old_xflag;
|
volatile unsigned char old_xflag;
|
||||||
volatile Tflag old_inuse;
|
volatile Tflag old_inuse;
|
||||||
const char *volatile old_kshname;
|
const char *volatile old_kshname;
|
||||||
|
|
||||||
@ -901,7 +901,7 @@ findcom(const char *name, int flags)
|
|||||||
static struct tbl temp;
|
static struct tbl temp;
|
||||||
unsigned int h = hash(name);
|
unsigned int h = hash(name);
|
||||||
struct tbl *tp = NULL, *tbi;
|
struct tbl *tp = NULL, *tbi;
|
||||||
int insert = Flag(FTRACKALL); /* insert if not found */
|
unsigned char insert = Flag(FTRACKALL); /* insert if not found */
|
||||||
char *fpath; /* for function autoloading */
|
char *fpath; /* for function autoloading */
|
||||||
union mksh_cchack npath;
|
union mksh_cchack npath;
|
||||||
|
|
||||||
@ -1401,7 +1401,7 @@ static char *plain_fmt_entry(const void *, int, char *, int);
|
|||||||
static char *
|
static char *
|
||||||
plain_fmt_entry(const void *arg, int i, char *buf, int buflen)
|
plain_fmt_entry(const void *arg, int i, char *buf, int buflen)
|
||||||
{
|
{
|
||||||
shf_snprintf(buf, buflen, "%s", ((char *const *)arg)[i]);
|
shf_snprintf(buf, buflen, "%s", ((const char * const *)arg)[i]);
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
expr.c
6
expr.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.29 2009/06/10 18:12:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.30 2009/08/08 13:08:50 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 {
|
||||||
@ -545,8 +545,8 @@ exprtoken(Expr_state *es)
|
|||||||
int i, n0;
|
int i, n0;
|
||||||
|
|
||||||
for (i = 0; (n0 = opinfo[i].name[0]); i++)
|
for (i = 0; (n0 = opinfo[i].name[0]); i++)
|
||||||
if (c == n0 &&
|
if (c == n0 && strncmp(cp, opinfo[i].name,
|
||||||
strncmp(cp, opinfo[i].name, opinfo[i].len) == 0) {
|
(size_t)opinfo[i].len) == 0) {
|
||||||
es->tok = (enum token)i;
|
es->tok = (enum token)i;
|
||||||
cp += opinfo[i].len;
|
cp += opinfo[i].len;
|
||||||
break;
|
break;
|
||||||
|
22
funcs.c
22
funcs.c
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.119 2009/07/30 19:11:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.120 2009/08/08 13:08:50 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -1629,7 +1629,7 @@ c_umask(const char **wp)
|
|||||||
}
|
}
|
||||||
cp = wp[builtin_opt.optind];
|
cp = wp[builtin_opt.optind];
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
old_umask = umask(0);
|
old_umask = umask((mode_t)0);
|
||||||
umask(old_umask);
|
umask(old_umask);
|
||||||
if (symbolic) {
|
if (symbolic) {
|
||||||
char buf[18], *p;
|
char buf[18], *p;
|
||||||
@ -1664,7 +1664,7 @@ c_umask(const char **wp)
|
|||||||
int positions, new_val;
|
int positions, new_val;
|
||||||
char op;
|
char op;
|
||||||
|
|
||||||
old_umask = umask(0);
|
old_umask = umask((mode_t)0);
|
||||||
umask(old_umask); /* in case of error */
|
umask(old_umask); /* in case of error */
|
||||||
old_umask = ~old_umask;
|
old_umask = ~old_umask;
|
||||||
new_umask = old_umask;
|
new_umask = old_umask;
|
||||||
@ -1978,7 +1978,7 @@ int
|
|||||||
c_eval(const char **wp)
|
c_eval(const char **wp)
|
||||||
{
|
{
|
||||||
struct source *s, *saves = source;
|
struct source *s, *saves = source;
|
||||||
char savef;
|
unsigned char savef;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (ksh_getopt(wp, &builtin_opt, null) == '?')
|
if (ksh_getopt(wp, &builtin_opt, null) == '?')
|
||||||
@ -2402,7 +2402,7 @@ c_mknod(const char **wp)
|
|||||||
bi_errorf("invalid file mode");
|
bi_errorf("invalid file mode");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
mode = getmode(set, DEFFILEMODE);
|
mode = getmode(set, (mode_t)(DEFFILEMODE));
|
||||||
free(set);
|
free(set);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -2420,7 +2420,7 @@ c_mknod(const char **wp)
|
|||||||
goto c_mknod_usage;
|
goto c_mknod_usage;
|
||||||
|
|
||||||
if (set != NULL)
|
if (set != NULL)
|
||||||
oldmode = umask(0);
|
oldmode = umask((mode_t)0);
|
||||||
else
|
else
|
||||||
mode = DEFFILEMODE;
|
mode = DEFFILEMODE;
|
||||||
|
|
||||||
@ -2623,13 +2623,9 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2,
|
|||||||
if ((i = *opnd1 == '!'))
|
if ((i = *opnd1 == '!'))
|
||||||
opnd1++;
|
opnd1++;
|
||||||
if ((k = option(opnd1)) == (size_t)-1)
|
if ((k = option(opnd1)) == (size_t)-1)
|
||||||
k = 0;
|
return (0);
|
||||||
else {
|
s = Flag(k);
|
||||||
k = Flag(k);
|
return (i ? !s : s);
|
||||||
if (i)
|
|
||||||
k = !k;
|
|
||||||
}
|
|
||||||
return (k);
|
|
||||||
case TO_FILRD: /* -r */
|
case TO_FILRD: /* -r */
|
||||||
return (test_eaccess(opnd1, R_OK) == 0);
|
return (test_eaccess(opnd1, R_OK) == 0);
|
||||||
case TO_FILWR: /* -w */
|
case TO_FILWR: /* -w */
|
||||||
|
14
histrap.c
14
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.87 2009/08/01 14:07:42 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.88 2009/08/08 13:08:51 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.
|
||||||
@ -684,7 +684,7 @@ hist_init(Source *s)
|
|||||||
|
|
||||||
(void)flock(histfd, LOCK_EX);
|
(void)flock(histfd, LOCK_EX);
|
||||||
|
|
||||||
hsize = lseek(histfd, 0L, SEEK_END);
|
hsize = lseek(histfd, (off_t)0, SEEK_END);
|
||||||
|
|
||||||
if (hsize == 0) {
|
if (hsize == 0) {
|
||||||
/* add magic */
|
/* add magic */
|
||||||
@ -697,7 +697,7 @@ hist_init(Source *s)
|
|||||||
* we have some data
|
* we have some data
|
||||||
*/
|
*/
|
||||||
base = (void *)mmap(NULL, hsize, PROT_READ,
|
base = (void *)mmap(NULL, hsize, PROT_READ,
|
||||||
MAP_FILE | MAP_PRIVATE, histfd, 0);
|
MAP_FILE | MAP_PRIVATE, histfd, (off_t)0);
|
||||||
/*
|
/*
|
||||||
* check on its validity
|
* check on its validity
|
||||||
*/
|
*/
|
||||||
@ -732,7 +732,7 @@ hist_init(Source *s)
|
|||||||
munmap((caddr_t)base, hsize);
|
munmap((caddr_t)base, hsize);
|
||||||
}
|
}
|
||||||
(void)flock(histfd, LOCK_UN);
|
(void)flock(histfd, LOCK_UN);
|
||||||
hsize = lseek(histfd, 0L, SEEK_END);
|
hsize = lseek(histfd, (off_t)0, SEEK_END);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +932,7 @@ writehistfile(int lno, char *cmd)
|
|||||||
unsigned char hdr[5];
|
unsigned char hdr[5];
|
||||||
|
|
||||||
(void)flock(histfd, LOCK_EX);
|
(void)flock(histfd, LOCK_EX);
|
||||||
sizenow = lseek(histfd, 0L, SEEK_END);
|
sizenow = lseek(histfd, (off_t)0, SEEK_END);
|
||||||
if (sizenow != hsize) {
|
if (sizenow != hsize) {
|
||||||
/*
|
/*
|
||||||
* Things have changed
|
* Things have changed
|
||||||
@ -941,7 +941,7 @@ writehistfile(int lno, char *cmd)
|
|||||||
/* someone has added some lines */
|
/* someone has added some lines */
|
||||||
bytes = sizenow - hsize;
|
bytes = sizenow - hsize;
|
||||||
base = (void *)mmap(NULL, sizenow, PROT_READ,
|
base = (void *)mmap(NULL, sizenow, PROT_READ,
|
||||||
MAP_FILE | MAP_PRIVATE, histfd, 0);
|
MAP_FILE | MAP_PRIVATE, histfd, (off_t)0);
|
||||||
if (base == (unsigned char *)MAP_FAILED)
|
if (base == (unsigned char *)MAP_FAILED)
|
||||||
goto bad;
|
goto bad;
|
||||||
new = base + hsize;
|
new = base + hsize;
|
||||||
@ -974,7 +974,7 @@ writehistfile(int lno, char *cmd)
|
|||||||
if ((write(histfd, hdr, 5) != 5) ||
|
if ((write(histfd, hdr, 5) != 5) ||
|
||||||
(write(histfd, cmd, bytes) != bytes))
|
(write(histfd, cmd, bytes) != bytes))
|
||||||
goto bad;
|
goto bad;
|
||||||
hsize = lseek(histfd, 0L, SEEK_END);
|
hsize = lseek(histfd, (off_t)0, SEEK_END);
|
||||||
(void)flock(histfd, LOCK_UN);
|
(void)flock(histfd, LOCK_UN);
|
||||||
return;
|
return;
|
||||||
bad:
|
bad:
|
||||||
|
30
lalloc.c
30
lalloc.c
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.10 2009/05/16 16:59:37 tg Stab $");
|
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.11 2009/08/08 13:08:51 tg Exp $");
|
||||||
|
|
||||||
/* build with CPPFLAGS+= -DUSE_REALLOC_MALLOC=0 on ancient systems */
|
/* build with CPPFLAGS+= -DUSE_REALLOC_MALLOC=0 on ancient systems */
|
||||||
#if defined(USE_REALLOC_MALLOC) && (USE_REALLOC_MALLOC == 0)
|
#if defined(USE_REALLOC_MALLOC) && (USE_REALLOC_MALLOC == 0)
|
||||||
@ -29,6 +29,8 @@ __RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.10 2009/05/16 16:59:37 tg Stab $");
|
|||||||
#define remalloc(p,n) realloc((p), (n))
|
#define remalloc(p,n) realloc((p), (n))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ALLOC_ISUNALIGNED(p) (((ptrdiff_t)(p)) % ALLOC_SIZE)
|
||||||
|
|
||||||
static ALLOC_ITEM *findptr(ALLOC_ITEM **, char *, Area *);
|
static ALLOC_ITEM *findptr(ALLOC_ITEM **, char *, Area *);
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -41,12 +43,26 @@ ainit(Area *ap)
|
|||||||
static ALLOC_ITEM *
|
static ALLOC_ITEM *
|
||||||
findptr(ALLOC_ITEM **lpp, char *ptr, Area *ap)
|
findptr(ALLOC_ITEM **lpp, char *ptr, Area *ap)
|
||||||
{
|
{
|
||||||
|
void *lp;
|
||||||
|
|
||||||
|
#ifndef MKSH_SMALL
|
||||||
|
if (ALLOC_ISUNALIGNED(ptr))
|
||||||
|
goto fail;
|
||||||
|
#endif
|
||||||
/* get address of ALLOC_ITEM from user item */
|
/* get address of ALLOC_ITEM from user item */
|
||||||
*lpp = (ALLOC_ITEM *)(ptr - ALLOC_SIZE);
|
/*
|
||||||
|
* note: the alignment of "ptr" to ALLOC_SIZE is checked
|
||||||
|
* above; the "void *" gets us rid of a gcc 2.95 warning
|
||||||
|
*/
|
||||||
|
*lpp = (lp = ptr - ALLOC_SIZE);
|
||||||
/* search for allocation item in group list */
|
/* search for allocation item in group list */
|
||||||
while (ap->next != *lpp)
|
while (ap->next != lp)
|
||||||
if ((ap = ap->next) == NULL)
|
if ((ap = ap->next) == NULL) {
|
||||||
|
#ifndef MKSH_SMALL
|
||||||
|
fail:
|
||||||
|
#endif
|
||||||
internal_errorf("rogue pointer %p", ptr);
|
internal_errorf("rogue pointer %p", ptr);
|
||||||
|
}
|
||||||
return (ap);
|
return (ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +80,11 @@ aresize(void *ptr, size_t numb, Area *ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((numb >= SIZE_MAX - ALLOC_SIZE) ||
|
if ((numb >= SIZE_MAX - ALLOC_SIZE) ||
|
||||||
(lp = remalloc(lp, numb + ALLOC_SIZE)) == NULL)
|
(lp = remalloc(lp, numb + ALLOC_SIZE)) == NULL
|
||||||
|
#ifndef MKSH_SMALL
|
||||||
|
|| ALLOC_ISUNALIGNED(lp)
|
||||||
|
#endif
|
||||||
|
)
|
||||||
internal_errorf("cannot allocate %lu data bytes",
|
internal_errorf("cannot allocate %lu data bytes",
|
||||||
(unsigned long)numb);
|
(unsigned long)numb);
|
||||||
/* this only works because Area is an ALLOC_ITEM */
|
/* this only works because Area is an ALLOC_ITEM */
|
||||||
|
11
main.c
11
main.c
@ -33,7 +33,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.136 2009/07/25 21:31:26 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.137 2009/08/08 13:08:51 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ main(int argc, const char *argv[])
|
|||||||
int argi, i;
|
int argi, i;
|
||||||
Source *s;
|
Source *s;
|
||||||
struct block *l;
|
struct block *l;
|
||||||
int restricted, errexit;
|
unsigned char restricted, errexit;
|
||||||
const char **wp;
|
const char **wp;
|
||||||
pid_t ppid;
|
pid_t ppid;
|
||||||
struct tbl *vp;
|
struct tbl *vp;
|
||||||
@ -412,8 +412,7 @@ main(int argc, const char *argv[])
|
|||||||
/* After typeset command... */
|
/* After typeset command... */
|
||||||
Flag(FRESTRICTED) = 1;
|
Flag(FRESTRICTED) = 1;
|
||||||
}
|
}
|
||||||
if (errexit)
|
Flag(FERREXIT) = errexit;
|
||||||
Flag(FERREXIT) = 1;
|
|
||||||
|
|
||||||
if (Flag(FTALKING)) {
|
if (Flag(FTALKING)) {
|
||||||
hist_init(s);
|
hist_init(s);
|
||||||
@ -1373,8 +1372,8 @@ ktnext(struct tstate *ts)
|
|||||||
static int
|
static int
|
||||||
tnamecmp(const void *p1, const void *p2)
|
tnamecmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
const struct tbl *a = *((struct tbl * const *)p1);
|
const struct tbl *a = *((const struct tbl * const *)p1);
|
||||||
const struct tbl *b = *((struct tbl * const *)p2);
|
const struct tbl *b = *((const struct tbl * const *)p2);
|
||||||
|
|
||||||
return (strcmp(a->name, b->name));
|
return (strcmp(a->name, b->name));
|
||||||
}
|
}
|
||||||
|
16
misc.c
16
misc.c
@ -29,7 +29,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.114 2009/08/01 20:31:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.115 2009/08/08 13:08:52 tg Exp $");
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
/* XXX conditions correct? */
|
/* XXX conditions correct? */
|
||||||
@ -238,11 +238,9 @@ getoptions(void)
|
|||||||
|
|
||||||
/* change a Flag(*) value; takes care of special actions */
|
/* change a Flag(*) value; takes care of special actions */
|
||||||
void
|
void
|
||||||
change_flag(enum sh_flag f,
|
change_flag(enum sh_flag f, int what, unsigned int newval)
|
||||||
int what, /* flag to change */
|
|
||||||
char newval) /* what is changing the flag (command line vs set) */
|
|
||||||
{
|
{
|
||||||
char oldval;
|
unsigned char oldval;
|
||||||
|
|
||||||
oldval = Flag(f);
|
oldval = Flag(f);
|
||||||
Flag(f) = newval ? 1 : 0; /* needed for tristates */
|
Flag(f) = newval ? 1 : 0; /* needed for tristates */
|
||||||
@ -261,7 +259,7 @@ change_flag(enum sh_flag f,
|
|||||||
Flag(FVI) =
|
Flag(FVI) =
|
||||||
#endif
|
#endif
|
||||||
Flag(FEMACS) = Flag(FGMACS) = 0;
|
Flag(FEMACS) = Flag(FGMACS) = 0;
|
||||||
Flag(f) = newval;
|
Flag(f) = (unsigned char)newval;
|
||||||
} else if (f == FPRIVILEGED && oldval && !newval) {
|
} else if (f == FPRIVILEGED && oldval && !newval) {
|
||||||
/* Turning off -p? */
|
/* Turning off -p? */
|
||||||
#if HAVE_SETRESUGID
|
#if HAVE_SETRESUGID
|
||||||
@ -284,7 +282,7 @@ change_flag(enum sh_flag f,
|
|||||||
/* Changing interactive flag? */
|
/* Changing interactive flag? */
|
||||||
if (f == FTALKING) {
|
if (f == FTALKING) {
|
||||||
if ((what == OF_CMDLINE || what == OF_SET) && procpid == kshpid)
|
if ((what == OF_CMDLINE || what == OF_SET) && procpid == kshpid)
|
||||||
Flag(FTALKING_I) = newval;
|
Flag(FTALKING_I) = (unsigned char)newval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,7 +789,7 @@ pat_scan(const unsigned char *p, const unsigned char *pe, int match_sep)
|
|||||||
int
|
int
|
||||||
xstrcmp(const void *p1, const void *p2)
|
xstrcmp(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
return (strcmp(*(char * const *)p1, *(char * const *)p2));
|
return (strcmp(*(const char * const *)p1, *(const char * const *)p2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise a Getopt structure */
|
/* Initialise a Getopt structure */
|
||||||
@ -1377,7 +1375,7 @@ chvt(const char *fn)
|
|||||||
errorf("chvt: not a char device: %s", fn);
|
errorf("chvt: not a char device: %s", fn);
|
||||||
if ((sb.st_uid != 0) && chown(fn, 0, 0))
|
if ((sb.st_uid != 0) && chown(fn, 0, 0))
|
||||||
warningf(false, "chvt: cannot chown root %s", fn);
|
warningf(false, "chvt: cannot chown root %s", fn);
|
||||||
if (((sb.st_mode & 07777) != 0600) && chmod(fn, 0600))
|
if (((sb.st_mode & 07777) != 0600) && chmod(fn, (mode_t)0600))
|
||||||
warningf(false, "chvt: cannot chmod 0600 %s", fn);
|
warningf(false, "chvt: cannot chmod 0600 %s", fn);
|
||||||
#if HAVE_REVOKE
|
#if HAVE_REVOKE
|
||||||
if (revoke(fn))
|
if (revoke(fn))
|
||||||
|
8
sh.h
8
sh.h
@ -134,9 +134,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.321 2009/08/01 20:32:45 tg Rel $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.322 2009/08/08 13:08:52 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R39 2009/08/01"
|
#define MKSH_VERSION "R39 2009/08/08"
|
||||||
|
|
||||||
#ifndef MKSH_INCLUDES_ONLY
|
#ifndef MKSH_INCLUDES_ONLY
|
||||||
|
|
||||||
@ -594,7 +594,7 @@ enum sh_flag {
|
|||||||
#define Flag(f) (shell_flags[(int)(f)])
|
#define Flag(f) (shell_flags[(int)(f)])
|
||||||
#define UTFMODE Flag(FUTFMODE)
|
#define UTFMODE Flag(FUTFMODE)
|
||||||
|
|
||||||
EXTERN char shell_flags[FNFLAGS];
|
EXTERN unsigned char shell_flags[FNFLAGS];
|
||||||
|
|
||||||
/* null value for variable; comparision pointer for unset */
|
/* null value for variable; comparision pointer for unset */
|
||||||
EXTERN char null[] I__("");
|
EXTERN char null[] I__("");
|
||||||
@ -1551,7 +1551,7 @@ void setctypes(const char *, int);
|
|||||||
void initctypes(void);
|
void initctypes(void);
|
||||||
size_t option(const char *);
|
size_t option(const char *);
|
||||||
char *getoptions(void);
|
char *getoptions(void);
|
||||||
void change_flag(enum sh_flag, int, char);
|
void change_flag(enum sh_flag, int, unsigned int);
|
||||||
int parse_args(const char **, int, int *);
|
int parse_args(const char **, int, int *);
|
||||||
int getn(const char *, int *);
|
int getn(const char *, int *);
|
||||||
int bi_getn(const char *, int *);
|
int bi_getn(const char *, int *);
|
||||||
|
2
shf.c
2
shf.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.30 2009/06/10 18:12:49 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.31 2009/08/08 13:08:53 tg Exp $");
|
||||||
|
|
||||||
/* flags to shf_emptybuf() */
|
/* flags to shf_emptybuf() */
|
||||||
#define EB_READSW 0x01 /* about to switch to reading */
|
#define EB_READSW 0x01 /* about to switch to reading */
|
||||||
|
4
var.c
4
var.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.76 2009/08/01 20:32:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.77 2009/08/08 13:08:53 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -919,7 +919,7 @@ makenv(void)
|
|||||||
*/
|
*/
|
||||||
#if HAVE_ARC4RANDOM && !defined(MKSH_SMALL)
|
#if HAVE_ARC4RANDOM && !defined(MKSH_SMALL)
|
||||||
static uint32_t rnd_cache[2];
|
static uint32_t rnd_cache[2];
|
||||||
static char rnd_lastflag = 2;
|
static unsigned char rnd_lastflag = 2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Reference in New Issue
Block a user