* support old environments without libgen.h (ancient GNU/Linux)
and stdbool.h (ancient GNU/Linux; NetBSD® 1.6.1) * __dead must come after, not before, to accomodate gcc 2.7.2.3
This commit is contained in:
parent
8fea7398d3
commit
ddd2dac47d
12
Build.sh
12
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.127 2007/01/17 22:35:09 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.128 2007/01/17 22:51:45 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Environment: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF
|
# Environment: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF
|
||||||
# With -x (cross compile): TARGET_OS (default: uname -s)
|
# With -x (cross compile): TARGET_OS (default: uname -s)
|
||||||
@ -297,6 +297,16 @@ ac_test sys_param_h '' '<sys/param.h>' <<'EOF'
|
|||||||
int main(void) { return (0); }
|
int main(void) { return (0); }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
ac_test libgen_h '' '<libgen.h>' <<'EOF'
|
||||||
|
#include <libgen.h>
|
||||||
|
int main(void) { return (0); }
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ac_test stdbool_h '' '<stdbool.h>' <<'EOF'
|
||||||
|
#include <stdbool.h>
|
||||||
|
int main(void) { return (0); }
|
||||||
|
EOF
|
||||||
|
|
||||||
#
|
#
|
||||||
# Environment: signals
|
# Environment: signals
|
||||||
#
|
#
|
||||||
|
5
Makefile
5
Makefile
@ -1,10 +1,11 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.23 2007/01/17 21:42:23 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.24 2007/01/17 22:51:46 tg Exp $
|
||||||
|
|
||||||
PROG= mksh
|
PROG= mksh
|
||||||
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
|
||||||
jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c
|
||||||
CPPFLAGS+= -DHAVE_ATTRIBUTE -DHAVE_ATTRIBUTE_BOUNDED -DHAVE_ATTRIBUTE_USED
|
CPPFLAGS+= -DHAVE_ATTRIBUTE -DHAVE_ATTRIBUTE_BOUNDED -DHAVE_ATTRIBUTE_USED
|
||||||
CPPFLAGS+= -DHAVE_SYS_PARAM_H -DHAVE_SYS_SIGNAME -DHAVE_SYS_SIGLIST
|
CPPFLAGS+= -DHAVE_SYS_PARAM_H -DHAVE_LIBGEN_H -DHAVE_STDBOOL_H
|
||||||
|
CPPFLAGS+= -DHAVE_SYS_SIGNAME -DHAVE_SYS_SIGLIST
|
||||||
CPPFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_ARC4RANDOM_PUSH -DHAVE_SETLOCALE_CTYPE
|
CPPFLAGS+= -DHAVE_ARC4RANDOM -DHAVE_ARC4RANDOM_PUSH -DHAVE_SETLOCALE_CTYPE
|
||||||
CPPFLAGS+= -DHAVE_LANGINFO_CODESET -DHAVE_SETMODE -DHAVE_SETRESUGID
|
CPPFLAGS+= -DHAVE_LANGINFO_CODESET -DHAVE_SETMODE -DHAVE_SETRESUGID
|
||||||
CPPFLAGS+= -DHAVE_SETGROUPS -DHAVE_STRCASESTR -DHAVE_STRLCPY
|
CPPFLAGS+= -DHAVE_SETGROUPS -DHAVE_STRCASESTR -DHAVE_STRLCPY
|
||||||
|
5
exec.c
5
exec.c
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.23 2007/01/15 00:18:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.24 2007/01/17 22:51:46 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, char **,
|
static int comexec(struct op *, struct tbl *volatile, char **,
|
||||||
int volatile);
|
int volatile);
|
||||||
static __dead void scriptexec(struct op *, char **);
|
static void scriptexec(struct op *, char **)
|
||||||
|
__attribute__((noreturn));
|
||||||
static int call_builtin(struct tbl *, char **);
|
static int call_builtin(struct tbl *, char **);
|
||||||
static int iosetup(struct ioword *, struct tbl *);
|
static int iosetup(struct ioword *, struct tbl *);
|
||||||
static int herein(const char *, int);
|
static int herein(const char *, int);
|
||||||
|
5
expr.c
5
expr.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.7 2007/01/12 01:49:27 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.8 2007/01/17 22:51:46 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 {
|
||||||
@ -126,7 +126,8 @@ enum error_type {
|
|||||||
ET_LVALUE, ET_RDONLY, ET_STR
|
ET_LVALUE, ET_RDONLY, ET_STR
|
||||||
};
|
};
|
||||||
|
|
||||||
static __dead void evalerr(Expr_state *, enum error_type, const char *);
|
static void evalerr(Expr_state *, enum error_type, const char *)
|
||||||
|
__attribute__((noreturn));
|
||||||
static struct tbl *evalexpr(Expr_state *, enum prec);
|
static struct tbl *evalexpr(Expr_state *, enum prec);
|
||||||
static void token(Expr_state *);
|
static void token(Expr_state *);
|
||||||
static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool);
|
static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool);
|
||||||
|
24
sh.h
24
sh.h
@ -8,7 +8,7 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.100 2007/01/17 21:42:23 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.101 2007/01/17 22:51:46 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2007/01/17"
|
#define MKSH_VERSION "R29 2007/01/17"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
@ -48,7 +48,9 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#if HAVE_LIBGEN_H
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#if !defined(__sun__)
|
#if !defined(__sun__)
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
@ -57,7 +59,9 @@
|
|||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#if HAVE_STDBOOL_H
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#endif
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -78,6 +82,13 @@
|
|||||||
#include <values.h>
|
#include <values.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_STDBOOL_H
|
||||||
|
/* kludge, but enough for mksh */
|
||||||
|
typedef int bool;
|
||||||
|
#define false 0
|
||||||
|
#define true 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* extra macros */
|
/* extra macros */
|
||||||
|
|
||||||
#ifndef timeradd
|
#ifndef timeradd
|
||||||
@ -119,8 +130,6 @@
|
|||||||
#else
|
#else
|
||||||
#define __attribute__(x) /* nothing */
|
#define __attribute__(x) /* nothing */
|
||||||
#endif
|
#endif
|
||||||
#undef __dead
|
|
||||||
#define __dead __attribute__((noreturn))
|
|
||||||
#undef __unused
|
#undef __unused
|
||||||
#define __unused __attribute__((unused))
|
#define __unused __attribute__((unused))
|
||||||
|
|
||||||
@ -1200,7 +1209,8 @@ pid_t j_async(void);
|
|||||||
int j_stopped_running(void);
|
int j_stopped_running(void);
|
||||||
/* lex.c */
|
/* lex.c */
|
||||||
int yylex(int);
|
int yylex(int);
|
||||||
__dead void yyerror(const char *, ...)
|
void yyerror(const char *, ...)
|
||||||
|
__attribute__((noreturn))
|
||||||
__attribute__((format (printf, 1, 2)));
|
__attribute__((format (printf, 1, 2)));
|
||||||
Source *pushs(int, Area *);
|
Source *pushs(int, Area *);
|
||||||
void set_prompt(int, Source *);
|
void set_prompt(int, Source *);
|
||||||
@ -1210,12 +1220,14 @@ int promptlen(const char *);
|
|||||||
int include(const char *, int, char **, int);
|
int include(const char *, int, char **, int);
|
||||||
int command(const char *);
|
int command(const char *);
|
||||||
int shell(Source *volatile, int volatile);
|
int shell(Source *volatile, int volatile);
|
||||||
__dead void unwind(int);
|
void unwind(int)
|
||||||
|
__attribute__((noreturn));
|
||||||
void newenv(int);
|
void newenv(int);
|
||||||
void quitenv(struct shf *);
|
void quitenv(struct shf *);
|
||||||
void cleanup_parents_env(void);
|
void cleanup_parents_env(void);
|
||||||
void cleanup_proc_env(void);
|
void cleanup_proc_env(void);
|
||||||
__dead void errorf(const char *, ...)
|
void errorf(const char *, ...)
|
||||||
|
__attribute__((noreturn))
|
||||||
__attribute__((format (printf, 1, 2)));
|
__attribute__((format (printf, 1, 2)));
|
||||||
void warningf(bool, const char *, ...)
|
void warningf(bool, const char *, ...)
|
||||||
__attribute__((format (printf, 2, 3)));
|
__attribute__((format (printf, 2, 3)));
|
||||||
|
8
syn.c
8
syn.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.9 2007/01/12 01:49:29 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.10 2007/01/17 22:51:47 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) */
|
||||||
@ -26,7 +26,8 @@ static struct op *function_body(char *, int);
|
|||||||
static char **wordlist(void);
|
static char **wordlist(void);
|
||||||
static struct op *block(int, struct op *, struct op *, char **);
|
static struct op *block(int, struct op *, struct op *, char **);
|
||||||
static struct op *newtp(int);
|
static struct op *newtp(int);
|
||||||
static __dead void syntaxerr(const char *);
|
static void syntaxerr(const char *)
|
||||||
|
__attribute__((noreturn));
|
||||||
static void nesting_push(struct nesting_state *, int);
|
static void nesting_push(struct nesting_state *, int);
|
||||||
static void nesting_pop(struct nesting_state *);
|
static void nesting_pop(struct nesting_state *);
|
||||||
static int assign_command(char *);
|
static int assign_command(char *);
|
||||||
@ -35,7 +36,8 @@ static int dbtestp_isa(Test_env *, Test_meta);
|
|||||||
static const char *dbtestp_getopnd(Test_env *, Test_op, int);
|
static const char *dbtestp_getopnd(Test_env *, Test_op, int);
|
||||||
static int dbtestp_eval(Test_env *, Test_op, const char *,
|
static int dbtestp_eval(Test_env *, Test_op, const char *,
|
||||||
const char *, int);
|
const char *, int);
|
||||||
static __dead void dbtestp_error(Test_env *, int, const char *);
|
static void dbtestp_error(Test_env *, int, const char *)
|
||||||
|
__attribute__((noreturn));
|
||||||
|
|
||||||
static struct op *outtree; /* yyparse output */
|
static struct op *outtree; /* yyparse output */
|
||||||
static struct nesting_state nesting; /* \n changed to ; */
|
static struct nesting_state nesting; /* \n changed to ; */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user