harmonise sys_{sig,err}list ⓐ checks, ⓑ uses, ⓒ _decl values when not needed, ⓓ prototypes; ⓔ “const” is a keyword and thus space-separated from the preceding ‘*’ pointer indicator
This commit is contained in:
14
Build.sh
14
Build.sh
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.606 2012/12/27 15:52:47 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.607 2012/12/28 02:28:29 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012
|
# 2011, 2012
|
||||||
@@ -1528,7 +1528,7 @@ else
|
|||||||
#define EXTERN
|
#define EXTERN
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.606 2012/12/27 15:52:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.607 2012/12/28 02:28:29 tg Exp $");
|
||||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||||
EOF
|
EOF
|
||||||
case $cm in
|
case $cm in
|
||||||
@@ -1567,12 +1567,12 @@ test x"NetBSD" = x"$TARGET_OS" && $e Ignore the compatibility warning.
|
|||||||
|
|
||||||
ac_testn sys_errlist '' "the sys_errlist[] array and sys_nerr" <<-'EOF'
|
ac_testn sys_errlist '' "the sys_errlist[] array and sys_nerr" <<-'EOF'
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
extern char *sys_errlist[];
|
extern const char * const sys_errlist[];
|
||||||
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
|
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
|
||||||
EOF
|
EOF
|
||||||
ac_testn _sys_errlist '!' sys_errlist 0 "the _sys_errlist[] array and _sys_nerr" <<-'EOF'
|
ac_testn _sys_errlist '!' sys_errlist 0 "the _sys_errlist[] array and _sys_nerr" <<-'EOF'
|
||||||
extern int _sys_nerr;
|
extern int _sys_nerr;
|
||||||
extern char *_sys_errlist[];
|
extern const char * const _sys_errlist[];
|
||||||
int main(void) { return (*_sys_errlist[_sys_nerr - 1]); }
|
int main(void) { return (*_sys_errlist[_sys_nerr - 1]); }
|
||||||
EOF
|
EOF
|
||||||
if test 1 = "$HAVE__SYS_ERRLIST"; then
|
if test 1 = "$HAVE__SYS_ERRLIST"; then
|
||||||
@@ -1585,11 +1585,11 @@ ac_cppflags SYS_ERRLIST
|
|||||||
for what in name list; do
|
for what in name list; do
|
||||||
uwhat=`upper $what`
|
uwhat=`upper $what`
|
||||||
ac_testn sys_sig$what '' "the sys_sig${what}[] array" <<-EOF
|
ac_testn sys_sig$what '' "the sys_sig${what}[] array" <<-EOF
|
||||||
extern const char *const sys_sig${what}[];
|
extern const char * const sys_sig${what}[];
|
||||||
int main(void) { return (sys_sig${what}[0][0]); }
|
int main(void) { return (sys_sig${what}[0][0]); }
|
||||||
EOF
|
EOF
|
||||||
ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF
|
ac_testn _sys_sig$what '!' sys_sig$what 0 "the _sys_sig${what}[] array" <<-EOF
|
||||||
extern const char *const _sys_sig${what}[];
|
extern const char * const _sys_sig${what}[];
|
||||||
int main(void) { return (_sys_sig${what}[0][0]); }
|
int main(void) { return (_sys_sig${what}[0][0]); }
|
||||||
EOF
|
EOF
|
||||||
eval uwhat_v=\$HAVE__SYS_SIG$uwhat
|
eval uwhat_v=\$HAVE__SYS_SIG$uwhat
|
||||||
@@ -1830,7 +1830,7 @@ ac_test sys_errlist_decl sys_errlist 0 "for declaration of sys_errlist[] and sys
|
|||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
|
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
|
||||||
EOF
|
EOF
|
||||||
ac_test sys_siglist_decl sys_siglist 1 'for declaration of sys_siglist[]' <<-'EOF'
|
ac_test sys_siglist_decl sys_siglist 0 'for declaration of sys_siglist[]' <<-'EOF'
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
int main(void) { return (sys_siglist[0][0]); }
|
int main(void) { return (sys_siglist[0][0]); }
|
||||||
|
6
check.t
6
check.t
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.576 2012/12/24 14:37:13 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.577 2012/12/28 02:28:30 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 $
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R41 2012/12/21
|
@(#)MIRBSD KSH R41 2012/12/27
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -38,7 +38,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R41 2012/12/21
|
@(#)LEGACY KSH R41 2012/12/27
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
6
edit.c
6
edit.c
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.259 2012/12/08 18:30:27 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.260 2012/12/28 02:28:33 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in later versions we might use libtermcap for this, but since external
|
* in later versions we might use libtermcap for this, but since external
|
||||||
@@ -73,9 +73,9 @@ static void x_putcf(int);
|
|||||||
static void x_modified(void);
|
static void x_modified(void);
|
||||||
static void x_mode(bool);
|
static void x_mode(bool);
|
||||||
static int x_do_comment(char *, ssize_t, ssize_t *);
|
static int x_do_comment(char *, ssize_t, ssize_t *);
|
||||||
static void x_print_expansions(int, char *const *, bool);
|
static void x_print_expansions(int, char * const *, bool);
|
||||||
static int x_cf_glob(int *, const char *, int, int, int *, int *, char ***);
|
static int x_cf_glob(int *, const char *, int, int, int *, int *, char ***);
|
||||||
static size_t x_longest_prefix(int, char *const *);
|
static size_t x_longest_prefix(int, char * const *);
|
||||||
static void x_glob_hlp_add_qchar(char *);
|
static void x_glob_hlp_add_qchar(char *);
|
||||||
static char *x_glob_hlp_tilde_and_rem_qchar(char *, bool);
|
static char *x_glob_hlp_tilde_and_rem_qchar(char *, bool);
|
||||||
static int x_basename(const char *, const char *);
|
static int x_basename(const char *, const char *);
|
||||||
|
4
funcs.c
4
funcs.c
@@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.235 2012/12/17 23:18:04 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.236 2012/12/28 02:28:34 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@@ -3272,7 +3272,7 @@ static Test_op
|
|||||||
ptest_isa(Test_env *te, Test_meta meta)
|
ptest_isa(Test_env *te, Test_meta meta)
|
||||||
{
|
{
|
||||||
/* Order important - indexed by Test_meta values */
|
/* Order important - indexed by Test_meta values */
|
||||||
static const char *const tokens[] = {
|
static const char * const tokens[] = {
|
||||||
"-o", "-a", "!", "(", ")"
|
"-o", "-a", "!", "(", ")"
|
||||||
};
|
};
|
||||||
Test_op rv;
|
Test_op rv;
|
||||||
|
10
histrap.c
10
histrap.c
@@ -27,7 +27,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.130 2012/12/17 23:18:05 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.131 2012/12/28 02:28:35 tg Exp $");
|
||||||
|
|
||||||
Trap sigtraps[NSIG + 1];
|
Trap sigtraps[NSIG + 1];
|
||||||
static struct sigaction Sigact_ign;
|
static struct sigaction Sigact_ign;
|
||||||
@@ -953,7 +953,7 @@ hist_finish(void)
|
|||||||
|
|
||||||
#if !HAVE_SYS_SIGNAME
|
#if !HAVE_SYS_SIGNAME
|
||||||
static const struct mksh_sigpair {
|
static const struct mksh_sigpair {
|
||||||
const char *const name;
|
const char * const name;
|
||||||
int nr;
|
int nr;
|
||||||
} mksh_sigpairs[] = {
|
} mksh_sigpairs[] = {
|
||||||
#include "signames.inc"
|
#include "signames.inc"
|
||||||
@@ -961,6 +961,12 @@ static const struct mksh_sigpair {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_SIGLIST
|
||||||
|
#if !HAVE_SYS_SIGLIST_DECL
|
||||||
|
extern const char * const sys_siglist[];
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
inittraps(void)
|
inittraps(void)
|
||||||
{
|
{
|
||||||
|
4
jobs.c
4
jobs.c
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.93 2012/12/17 23:18:06 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.94 2012/12/28 02:28:36 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
@@ -107,7 +107,7 @@ struct job {
|
|||||||
#define JL_AMBIG 2 /* %foo or %?foo is ambiguous */
|
#define JL_AMBIG 2 /* %foo or %?foo is ambiguous */
|
||||||
#define JL_INVALID 3 /* non-pid, non-% job id */
|
#define JL_INVALID 3 /* non-pid, non-% job id */
|
||||||
|
|
||||||
static const char *const lookup_msgs[] = {
|
static const char * const lookup_msgs[] = {
|
||||||
null,
|
null,
|
||||||
"no such job",
|
"no such job",
|
||||||
"ambiguous",
|
"ambiguous",
|
||||||
|
10
sh.h
10
sh.h
@@ -164,9 +164,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.621 2012/12/22 22:15:21 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.622 2012/12/28 02:28:37 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R41 2012/12/21"
|
#define MKSH_VERSION "R41 2012/12/27"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@@ -379,10 +379,6 @@ extern const char *cstrerror(int);
|
|||||||
size_t strlcpy(char *, const char *, size_t);
|
size_t strlcpy(char *, const char *, size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_SYS_SIGLIST_DECL
|
|
||||||
extern const char *const sys_siglist[];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __INTERIX
|
#ifdef __INTERIX
|
||||||
/* XXX imake style */
|
/* XXX imake style */
|
||||||
#define makedev mkdev
|
#define makedev mkdev
|
||||||
@@ -2055,7 +2051,7 @@ typedef struct test_env {
|
|||||||
int flags; /* TEF_* */
|
int flags; /* TEF_* */
|
||||||
} Test_env;
|
} Test_env;
|
||||||
|
|
||||||
extern const char *const dbtest_tokens[];
|
extern const char * const dbtest_tokens[];
|
||||||
|
|
||||||
Test_op test_isop(Test_meta, const char *);
|
Test_op test_isop(Test_meta, const char *);
|
||||||
int test_eval(Test_env *, Test_op, const char *, const char *, bool);
|
int test_eval(Test_env *, Test_op, const char *, const char *, bool);
|
||||||
|
6
shf.c
6
shf.c
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.53 2012/12/17 23:18:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.54 2012/12/28 02:28:39 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 */
|
||||||
@@ -1087,12 +1087,14 @@ cstrerror(int errnum)
|
|||||||
#define strerror dontuse_strerror /* poisoned */
|
#define strerror dontuse_strerror /* poisoned */
|
||||||
}
|
}
|
||||||
#elif !HAVE_STRERROR
|
#elif !HAVE_STRERROR
|
||||||
|
|
||||||
#if HAVE_SYS_ERRLIST
|
#if HAVE_SYS_ERRLIST
|
||||||
#if !HAVE_SYS_ERRLIST_DECL
|
#if !HAVE_SYS_ERRLIST_DECL
|
||||||
extern int sys_nerr;
|
extern int sys_nerr;
|
||||||
extern char *sys_errlist[];
|
extern const char * const sys_errlist[];
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
cstrerror(int errnum)
|
cstrerror(int errnum)
|
||||||
{
|
{
|
||||||
|
4
syn.c
4
syn.c
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.87 2012/12/05 19:38:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.88 2012/12/28 02:28:39 tg Exp $");
|
||||||
|
|
||||||
struct nesting_state {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@@ -966,7 +966,7 @@ static const char dbtest_and[] = { CHAR, '&', CHAR, '&', EOS };
|
|||||||
static const char dbtest_not[] = { CHAR, '!', EOS };
|
static const char dbtest_not[] = { CHAR, '!', EOS };
|
||||||
static const char dbtest_oparen[] = { CHAR, '(', EOS };
|
static const char dbtest_oparen[] = { CHAR, '(', EOS };
|
||||||
static const char dbtest_cparen[] = { CHAR, ')', EOS };
|
static const char dbtest_cparen[] = { CHAR, ')', EOS };
|
||||||
const char *const dbtest_tokens[] = {
|
const char * const dbtest_tokens[] = {
|
||||||
dbtest_or, dbtest_and, dbtest_not,
|
dbtest_or, dbtest_and, dbtest_not,
|
||||||
dbtest_oparen, dbtest_cparen
|
dbtest_oparen, dbtest_cparen
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user