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
@ -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:

2
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

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
/*

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;
@ -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)
{

2
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

8
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

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)
{

2
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) */