• remove “#if 0” and “#ifdef notdef” style old debugging code

• expose “#ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT” just in case they decide to
  require it and show it in the ksh version automatically
• sync the use of non-ASCII characters over files (unification)
This commit is contained in:
tg 2009-05-16 18:40:09 +00:00
parent cde2f02986
commit b6ce748064
10 changed files with 30 additions and 53 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.392 2009/05/16 16:59:31 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.393 2009/05/16 18:40:03 tg Stab $'
#- #-
# 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>
@ -22,7 +22,7 @@ srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.392 2009/05/16 16:59:31 tg Exp $'
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED # MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED
# MKSH_CONSERVATIVE_FDS # MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
@ -453,8 +453,8 @@ $e $bi$me: Scanning for functions... please ignore any errors.$ao
# Compiler: which one? # Compiler: which one?
# #
# notes: # notes:
# ICC defines __GNUC__ too # - ICC defines __GNUC__ too
# GCC defines __hpux too # - GCC defines __hpux too
# - LLVM+clang defines __GNUC__ too # - LLVM+clang defines __GNUC__ too
# - nwcc defines __GNUC__ too # - nwcc defines __GNUC__ too
CPP="$CC -E" CPP="$CC -E"
@ -520,7 +520,7 @@ rm -f x
echo 'int main(void) { return (0); }' >scn.c echo 'int main(void) { return (0); }' >scn.c
case $ct in case $ct in
ack) ack)
# work around “the famous ACK const bug” # work around "the famous ACK const bug"
CPPFLAGS="-Dconst= $CPPFLAGS" CPPFLAGS="-Dconst= $CPPFLAGS"
;; ;;
adsp) adsp)
@ -1167,7 +1167,7 @@ EOF
ac_test setmode mknod 1 <<-'EOF' ac_test setmode mknod 1 <<-'EOF'
#if defined(__MSVCRT__) || defined(__CYGWIN__) #if defined(__MSVCRT__) || defined(__CYGWIN__)
/* force a failure: Win32 setmode() is not what we want */ /* force a failure: Win32 setmode() is not what we want... */
int main(void) { return (thiswillneverbedefinedIhope()); } int main(void) { return (thiswillneverbedefinedIhope()); }
#else #else
#include <unistd.h> #include <unistd.h>

10
check.t
View File

@ -1,25 +1,25 @@
# $MirOS: src/bin/mksh/check.t,v 1.276 2009/05/16 16:59:32 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.277 2009/05/16 18:40:04 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 $
#- #-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Thorsten Glaser <tg@mirbsd.org> # Thorsten Glaser <tg@mirbsd.org>
# #
# Provided that these terms and disclaimer and all copyright notices # Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission # are retained or reproduced in an accompanying document, permission
# is granted to deal in this work without restriction, including un- # is granted to deal in this work without restriction, including un
# limited rights to use, publicly perform, distribute, sell, modify, # limited rights to use, publicly perform, distribute, sell, modify,
# merge, give away, or sublicence. # merge, give away, or sublicence.
# #
# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
# the utmost extent permitted by applicable law, neither express nor # the utmost extent permitted by applicable law, neither express nor
# implied; without malicious intent or gross negligence. In no event # implied; without malicious intent or gross negligence. In no event
# may a licensor, author or contributor be held liable for indirect, # may a licensor, author or contributor be held liable for indirect,
# direct, other damage, loss, or other issues arising in any way out # direct, other damage, loss, or other issues arising in any way out
# of dealing in the work, even if advised of the possibility of such # of dealing in the work, even if advised of the possibility of such
# damage or existence of a defect, except proven that it results out # damage or existence of a defect, except proven that it results out
# of said person's immediate fault when using the work as intended. # of said persons immediate fault when using the work as intended.
#- #-
# You may also want to test IFS with the script at # You may also want to test IFS with the script at
# http://www.research.att.com/~gsf/public/ifs.sh # http://www.research.att.com/~gsf/public/ifs.sh

24
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.56 2009/05/16 16:59:34 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/eval.c,v 1.57 2009/05/16 18:40:05 tg Exp $");
#ifdef MKSH_SMALL #ifdef MKSH_SMALL
#define MKSH_NOPWNAM #define MKSH_NOPWNAM
@ -426,16 +426,6 @@ expand(const char *cp, /* input word */
s = wdcopy(sp, ATEMP); s = wdcopy(sp, ATEMP);
p = s + (wdscan(sp, ADELIM) - sp); p = s + (wdscan(sp, ADELIM) - sp);
d = s + (wdscan(sp, CSUBST) - sp); d = s + (wdscan(sp, CSUBST) - sp);
#if 0
fprintf(stderr,
"D: s=%p 〈%s〉\n"
" p=%p 〈%s〉\n"
" d=%p 〈%s〉\n",
s, wdstrip(s, true, false),
p, wdstrip(p, true, false),
d, wdstrip(d, true, false));
fflush(stderr);
#endif
if (p >= d) if (p >= d)
goto unwind_substsyn; goto unwind_substsyn;
p[-2] = EOS; p[-2] = EOS;
@ -465,12 +455,6 @@ expand(const char *cp, /* input word */
else else
s++; s++;
*d = '\0'; *d = '\0';
#if 0
fprintf(stderr,
"D: %s%s%s\n",
tpat0, pat, rrep);
fflush(stderr);
#endif
afree(tpat0, ATEMP); afree(tpat0, ATEMP);
/* reject empty pattern */ /* reject empty pattern */
@ -497,12 +481,6 @@ expand(const char *cp, /* input word */
tpat2 = tpat1 + 2; tpat2 = tpat1 + 2;
} }
again_repl: again_repl:
#if 0
fprintf(stderr,
"D: 「%s」 ← %s%s\n",
s, tpat0, rrep);
fflush(stderr);
#endif
/* this would not be necessary if gmatchx would return /* this would not be necessary if gmatchx would return
* the start and end values of a match found, like re* * the start and end values of a match found, like re*
*/ */

4
exec.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.55 2009/05/16 16:59:35 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.56 2009/05/16 18:40:05 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 *);
@ -772,7 +772,7 @@ scriptexec(struct op *tp, const char **ap)
(fd == /* ECOFF_M68K */ 0x0150 || fd == 0x5001) || (fd == /* ECOFF_M68K */ 0x0150 || fd == 0x5001) ||
(fd == /* ECOFF_SH */ 0x0500 || fd == 0x0005) || (fd == /* ECOFF_SH */ 0x0500 || fd == 0x0005) ||
(fd == 0x7F45 && buf[2] == 'L' && buf[3] == 'F') || (fd == 0x7F45 && buf[2] == 'L' && buf[3] == 'F') ||
(fd == /* “MZ” */ 0x4D5A) || (fd == /* "MZ" */ 0x4D5A) ||
(fd == /* gzip */ 0x1F8B)) (fd == /* gzip */ 0x1F8B))
errorf("%s: not executable: magic %04X", tp->str, fd); errorf("%s: not executable: magic %04X", tp->str, fd);
} }

View File

@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.106 2009/05/16 17:33:10 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.107 2009/05/16 18:40:06 tg Exp $");
/* A leading = means assignments before command are kept; /* A leading = means assignments before command are kept;
* a leading * means a POSIX special builtin; * a leading * means a POSIX special builtin;
@ -2419,7 +2419,7 @@ c_mknod(const char **wp)
return (rv); return (rv);
c_mknod_usage: c_mknod_usage:
#if 0 #if 0
/* XXX doesnt help */ /* XXX doesn't help */
builtin_argv0 = NULL; builtin_argv0 = NULL;
#endif #endif
bi_errorf("usage: mknod [-m mode] name [b | c] major minor"); bi_errorf("usage: mknod [-m mode] name [b | c] major minor");

View File

@ -26,11 +26,11 @@
#include <sys/file.h> #include <sys/file.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.80 2009/05/16 16:59:36 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.81 2009/05/16 18:40:06 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.
* IRIX doesnt have this constant. * IRIX doesn't have this constant.
*/ */
#ifndef MAP_FILE #ifndef MAP_FILE
#define MAP_FILE 0 #define MAP_FILE 0

4
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.126 2009/05/16 16:59:37 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.127 2009/05/16 18:40:07 tg Exp $");
extern char **environ; extern char **environ;
@ -295,7 +295,7 @@ main(int argc, const char *argv[])
s = pushs(SSTRING, ATEMP); s = pushs(SSTRING, ATEMP);
if (!(s->start = s->str = argv[argi++])) if (!(s->start = s->str = argv[argi++]))
errorf("-c requires an argument"); errorf("-c requires an argument");
#if 0 #ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT
/* compatibility to MidnightBSD 0.1 /bin/sh (not desired) */ /* compatibility to MidnightBSD 0.1 /bin/sh (not desired) */
if (argv[argi] && !strcmp(argv[argi], "--")) if (argv[argi] && !strcmp(argv[argi], "--"))
++argi; ++argi;

8
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.105 2009/05/16 16:59:38 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.106 2009/05/16 18:40:07 tg Exp $");
#undef USE_CHVT #undef USE_CHVT
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL) #if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
@ -518,12 +518,6 @@ gmatchx(const char *s, const char *p, bool isfile)
if (s == NULL || p == NULL) if (s == NULL || p == NULL)
return 0; return 0;
#if 0
/* debugging output */
fprintf(stderr, "gmatchx:\n\tstring =`%s`\n\tpattern=`%s`\n", s, p);
fflush(stderr);
#endif
se = s + strlen(s); se = s + strlen(s);
pe = p + strlen(p); pe = p + strlen(p);
/* isfile is false iff no syntax check has been done on /* isfile is false iff no syntax check has been done on

4
mksh.1
View File

@ -1,7 +1,7 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.165 2009/05/16 16:59:38 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.166 2009/05/16 18:40:08 tg Exp $
.\" $OpenBSD: ksh.1,v 1.128 2009/03/06 12:28:36 jmc Exp $ .\" $OpenBSD: ksh.1,v 1.128 2009/03/06 12:28:36 jmc Exp $
.\"- .\"-
.\" Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
.\" Thorsten Glaser <tg@mirbsd.org> .\" Thorsten Glaser <tg@mirbsd.org>
.\" .\"
.\" Provided that these terms and disclaimer and all copyright notices .\" Provided that these terms and disclaimer and all copyright notices

9
sh.h
View File

@ -122,7 +122,7 @@
#define __SCCSID(x) __IDSTRING(sccsid,x) #define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.297 2009/05/16 16:59:39 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.298 2009/05/16 18:40:09 tg Exp $");
#endif #endif
#define MKSH_VERSION "R38 2009/05/16" #define MKSH_VERSION "R38 2009/05/16"
@ -341,7 +341,12 @@ EXTERN uid_t ksheuid; /* effective uid of shell */
EXTERN int exstat; /* exit status */ EXTERN int exstat; /* exit status */
EXTERN int subst_exstat; /* exit status of last $(..)/`..` */ EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */ EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
EXTERN const char initvsn[] I__("KSH_VERSION=@(#)MIRBSD KSH " MKSH_VERSION); EXTERN const char initvsn[] I__("KSH_VERSION=@(#)MIRBSD KSH "
MKSH_VERSION
#ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT
"MidnightBSD-0.1-ash-compat"
#endif
);
#define KSH_VERSION (initvsn + /* "KSH_VERSION=@(#)" */ 16) #define KSH_VERSION (initvsn + /* "KSH_VERSION=@(#)" */ 16)
/* /*