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:
tg 2012-12-28 02:28:39 +00:00
parent 64eddba65f
commit b2396677e7
9 changed files with 34 additions and 30 deletions

View File

@ -1,5 +1,5 @@
#!/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,
# 2011, 2012
@ -1528,7 +1528,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#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); }
EOF
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'
extern int sys_nerr;
extern char *sys_errlist[];
extern const char * const sys_errlist[];
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
EOF
ac_testn _sys_errlist '!' sys_errlist 0 "the _sys_errlist[] array and _sys_nerr" <<-'EOF'
extern int _sys_nerr;
extern char *_sys_errlist[];
extern const char * const _sys_errlist[];
int main(void) { return (*_sys_errlist[_sys_nerr - 1]); }
EOF
if test 1 = "$HAVE__SYS_ERRLIST"; then
@ -1585,11 +1585,11 @@ ac_cppflags SYS_ERRLIST
for what in name list; do
uwhat=`upper $what`
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]); }
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]); }
EOF
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"
int main(void) { return (*sys_errlist[sys_nerr - 1]); }
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
#include "sh.h"
int main(void) { return (sys_siglist[0][0]); }

View File

@ -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: 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 $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R41 2012/12/21
@(#)MIRBSD KSH R41 2012/12/27
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R41 2012/12/21
@(#)LEGACY KSH R41 2012/12/27
description:
Check version of legacy shell.
stdin:

6
edit.c
View File

@ -28,7 +28,7 @@
#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
@ -73,9 +73,9 @@ static void x_putcf(int);
static void x_modified(void);
static void x_mode(bool);
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 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 char *x_glob_hlp_tilde_and_rem_qchar(char *, bool);
static int x_basename(const char *, const char *);

View File

@ -38,7 +38,7 @@
#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
/*
@ -3272,7 +3272,7 @@ static Test_op
ptest_isa(Test_env *te, Test_meta meta)
{
/* Order important - indexed by Test_meta values */
static const char *const tokens[] = {
static const char * const tokens[] = {
"-o", "-a", "!", "(", ")"
};
Test_op rv;

View File

@ -27,7 +27,7 @@
#include <sys/file.h>
#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];
static struct sigaction Sigact_ign;
@ -953,7 +953,7 @@ hist_finish(void)
#if !HAVE_SYS_SIGNAME
static const struct mksh_sigpair {
const char *const name;
const char * const name;
int nr;
} mksh_sigpairs[] = {
#include "signames.inc"
@ -961,6 +961,12 @@ static const struct mksh_sigpair {
};
#endif
#if HAVE_SYS_SIGLIST
#if !HAVE_SYS_SIGLIST_DECL
extern const char * const sys_siglist[];
#endif
#endif
void
inittraps(void)
{

4
jobs.c
View File

@ -22,7 +22,7 @@
#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
#define mksh_killpg killpg
@ -107,7 +107,7 @@ struct job {
#define JL_AMBIG 2 /* %foo or %?foo is ambiguous */
#define JL_INVALID 3 /* non-pid, non-% job id */
static const char *const lookup_msgs[] = {
static const char * const lookup_msgs[] = {
null,
"no such job",
"ambiguous",

10
sh.h
View File

@ -164,9 +164,9 @@
#endif
#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
#define MKSH_VERSION "R41 2012/12/21"
#define MKSH_VERSION "R41 2012/12/27"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -379,10 +379,6 @@ extern const char *cstrerror(int);
size_t strlcpy(char *, const char *, size_t);
#endif
#if !HAVE_SYS_SIGLIST_DECL
extern const char *const sys_siglist[];
#endif
#ifdef __INTERIX
/* XXX imake style */
#define makedev mkdev
@ -2055,7 +2051,7 @@ typedef struct test_env {
int flags; /* TEF_* */
} Test_env;
extern const char *const dbtest_tokens[];
extern const char * const dbtest_tokens[];
Test_op test_isop(Test_meta, const char *);
int test_eval(Test_env *, Test_op, const char *, const char *, bool);

6
shf.c
View File

@ -24,7 +24,7 @@
#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() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -1087,12 +1087,14 @@ cstrerror(int errnum)
#define strerror dontuse_strerror /* poisoned */
}
#elif !HAVE_STRERROR
#if HAVE_SYS_ERRLIST
#if !HAVE_SYS_ERRLIST_DECL
extern int sys_nerr;
extern char *sys_errlist[];
extern const char * const sys_errlist[];
#endif
#endif
const char *
cstrerror(int errnum)
{

4
syn.c
View File

@ -23,7 +23,7 @@
#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 {
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_oparen[] = { 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_oparen, dbtest_cparen
};