RT also said what was missing on SunOS 4.1.1 (it also needs -DMKSH_UNEMPLOYED?)
This commit is contained in:
parent
b8d3f12025
commit
4c5d7094ef
23
Build.sh
23
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.599 2012/12/17 21:55:04 tg Exp $'
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.600 2012/12/17 22:14:24 tg Exp $'
|
||||
#-
|
||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
# 2011, 2012
|
||||
@ -1304,6 +1304,10 @@ ac_test attribute_bounded '' 'for __attribute__((__bounded__))' <<-'EOF'
|
||||
__attribute__((__bounded__ (__buffer__, 2, 3)));
|
||||
int main(int ac, char *av[]) { return (xcopy(av[0], av[--ac], 1)); }
|
||||
int xcopy(const void *s, void *d, size_t n) {
|
||||
/*
|
||||
* if memmove does not exist, we are not on a system
|
||||
* with GCC with __bounded__ attribute either so poo
|
||||
*/
|
||||
memmove(d, s, n); return ((int)n);
|
||||
}
|
||||
#endif
|
||||
@ -1528,7 +1532,7 @@ else
|
||||
#define EXTERN
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.599 2012/12/17 21:55:04 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.600 2012/12/17 22:14:24 tg Exp $");
|
||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||
EOF
|
||||
case $cm in
|
||||
@ -1633,6 +1637,16 @@ ac_test killpg <<-'EOF'
|
||||
int main(int ac, char *av[]) { return (av[0][killpg(123, ac)]); }
|
||||
EOF
|
||||
|
||||
ac_test memmove <<-'EOF'
|
||||
#include <string.h>
|
||||
#if HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
int main(int ac, char *av[]) {
|
||||
return ((int)memmove(av[0], av[1], ac));
|
||||
}
|
||||
EOF
|
||||
|
||||
ac_test mknod '' 'if to use mknod(), makedev() and friends' <<-'EOF'
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
@ -1765,6 +1779,11 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
ac_test strerror <<-'EOF'
|
||||
extern char *strerror(int);
|
||||
int main(int ac, char *av[]) { return (*strerror(*av[ac])); }
|
||||
EOF
|
||||
|
||||
ac_test strlcpy <<-'EOF'
|
||||
#include <string.h>
|
||||
int main(int ac, char *av[]) { return (strlcpy(*av, av[1],
|
||||
|
11
sh.h
11
sh.h
@ -160,7 +160,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.616 2012/12/17 21:55:06 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.617 2012/12/17 22:14:26 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R41 2012/12/07"
|
||||
|
||||
@ -354,10 +354,19 @@ extern int flock(int, int);
|
||||
extern int getrusage(int, struct rusage *);
|
||||
#endif
|
||||
|
||||
#if !HAVE_MEMMOVE
|
||||
/* we assume either memmove or bcopy exist, at the moment */
|
||||
#define memmove(dst, src, len) bcopy((src), (dst), (len))
|
||||
#endif
|
||||
|
||||
#if !HAVE_REVOKE_DECL
|
||||
extern int revoke(const char *);
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRERROR
|
||||
extern char *strerror(int);
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRLCPY
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
|
21
shf.c
21
shf.c
@ -24,7 +24,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.50 2012/12/08 18:30:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.51 2012/12/17 22:14:27 tg Exp $");
|
||||
|
||||
/* flags to shf_emptybuf() */
|
||||
#define EB_READSW 0x01 /* about to switch to reading */
|
||||
@ -1077,3 +1077,22 @@ shf_putc(int c, struct shf *shf)
|
||||
return (shf_putc_i(c, shf));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_STRERROR
|
||||
/*
|
||||
* This is absolutely minimalistic. We could catch a number of well-
|
||||
* known errors (like ENOENT) and provide real error strings for them,
|
||||
* but to do that, I'd like a survey of which errors usually occur on
|
||||
* what systems, to be worth it. Modern systems do have strerror; this
|
||||
* is a porting aid only right now.
|
||||
*/
|
||||
char *
|
||||
strerror(int errnum)
|
||||
{
|
||||
/* "Errno. " + sign + rounded(octal) bits + NUL */
|
||||
static char errbuf[7 + 1 + (8 * sizeof(int) + 2) / 3 + 1];
|
||||
|
||||
shf_snprintf(errbuf, sizeof(errbuf), "Errno. %d", errnum);
|
||||
return (errbuf);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user