mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +00:00
changes made to enable compilation
This commit is contained in:
parent
19f70a154e
commit
7a50dba812
10 changed files with 1171 additions and 33 deletions
17
third_party/make/lib/fcntl.c
vendored
17
third_party/make/lib/fcntl.c
vendored
|
@ -208,24 +208,20 @@ fcntl (int fd, int action, /* arg */...)
|
|||
va_list arg;
|
||||
int result = -1;
|
||||
va_start (arg, action);
|
||||
switch (action)
|
||||
{
|
||||
case F_DUPFD:
|
||||
if(action == F_DUPFD)
|
||||
{
|
||||
int target = va_arg (arg, int);
|
||||
result = rpl_fcntl_DUPFD (fd, target);
|
||||
break;
|
||||
}
|
||||
|
||||
case F_DUPFD_CLOEXEC:
|
||||
else if(action == F_DUPFD_CLOEXEC)
|
||||
{
|
||||
int target = va_arg (arg, int);
|
||||
result = rpl_fcntl_DUPFD_CLOEXEC (fd, target);
|
||||
break;
|
||||
}
|
||||
|
||||
#if !HAVE_FCNTL
|
||||
case F_GETFD:
|
||||
else if(action == F_GETFD)
|
||||
{
|
||||
# if defined _WIN32 && ! defined __CYGWIN__
|
||||
HANDLE handle = (HANDLE) _get_osfhandle (fd);
|
||||
|
@ -241,7 +237,6 @@ fcntl (int fd, int action, /* arg */...)
|
|||
if (0 <= dup2 (fd, fd))
|
||||
result = 0;
|
||||
# endif /* !W32 */
|
||||
break;
|
||||
} /* F_GETFD */
|
||||
#endif /* !HAVE_FCNTL */
|
||||
|
||||
|
@ -253,9 +248,9 @@ fcntl (int fd, int action, /* arg */...)
|
|||
using dup2 to move the duplicate onto the original, but that
|
||||
is not supported for now. */
|
||||
|
||||
default:
|
||||
else
|
||||
{
|
||||
#if HAVE_FCNTL
|
||||
#if 0
|
||||
switch (action)
|
||||
{
|
||||
#ifdef F_BARRIERFSYNC /* macOS */
|
||||
|
@ -436,9 +431,7 @@ fcntl (int fd, int action, /* arg */...)
|
|||
#else
|
||||
errno = EINVAL;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
va_end (arg);
|
||||
return result;
|
||||
}
|
||||
|
|
4
third_party/make/lib/stdbool.in.h
vendored
4
third_party/make/lib/stdbool.in.h
vendored
|
@ -74,7 +74,7 @@
|
|||
/* A compiler known to have 'bool'. */
|
||||
/* If the compiler already has both 'bool' and '_Bool', we can assume they
|
||||
are the same types. */
|
||||
# if !@HAVE__BOOL@
|
||||
# if 0
|
||||
typedef bool _Bool;
|
||||
# endif
|
||||
# else
|
||||
|
@ -115,7 +115,7 @@ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
|
|||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# define bool _Bool
|
||||
// # define bool _Bool
|
||||
#endif
|
||||
|
||||
/* The other macros must be usable in preprocessor directives. */
|
||||
|
|
2
third_party/make/src/arscan.c
vendored
2
third_party/make/src/arscan.c
vendored
|
@ -331,7 +331,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
|
|||
#endif
|
||||
|
||||
#ifndef WINDOWS32
|
||||
# if !defined (__ANDROID__) && !defined (__BEOS__)
|
||||
# if 0 && !defined (__ANDROID__) && !defined (__BEOS__)
|
||||
# include <ar.h>
|
||||
# else
|
||||
/* These platforms don't have <ar.h> but have archives in the same format
|
||||
|
|
1133
third_party/make/src/config.h
vendored
Normal file
1133
third_party/make/src/config.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
third_party/make/src/dir.c
vendored
9
third_party/make/src/dir.c
vendored
|
@ -19,6 +19,15 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "filedef.h"
|
||||
#include "dep.h"
|
||||
|
||||
#ifndef __ptr_t
|
||||
#define __ptr_t void*
|
||||
#endif
|
||||
#define gl_readdir __dummy2[1]
|
||||
#define gl_opendir __dummy2[2]
|
||||
#define gl_closedir __dummy2[0]
|
||||
#define gl_lstat __dummy2[3]
|
||||
#define gl_stat __dummy2[4]
|
||||
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
# define NAMLEN(dirent) strlen((dirent)->d_name)
|
||||
|
|
8
third_party/make/src/getopt.h
vendored
8
third_party/make/src/getopt.h
vendored
|
@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with
|
|||
this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
#if 0 && !defined(_GETOPT_H)
|
||||
#define _GETOPT_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -127,4 +128,11 @@ extern int _getopt_internal ();
|
|||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
extern int _getopt_internal (int argc, char *const *argv,
|
||||
const char *shortopts,
|
||||
const struct option *longopts, int *longind,
|
||||
int long_only);
|
||||
#endif
|
||||
|
||||
#endif /* getopt.h */
|
||||
|
|
14
third_party/make/src/job.c
vendored
14
third_party/make/src/job.c
vendored
|
@ -2552,12 +2552,10 @@ exec_command (char **argv, char **envp)
|
|||
|
||||
# endif /* !__EMX__ */
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
case ENOENT:
|
||||
if(errno == ENOENT)
|
||||
OSS (error, NILF, "%s: %s", argv[0], strerror (errno));
|
||||
break;
|
||||
case ENOEXEC:
|
||||
else if(errno == ENOEXEC)
|
||||
{
|
||||
/* The file was not a program. Try it as a shell script. */
|
||||
const char *shell;
|
||||
|
@ -2614,19 +2612,15 @@ exec_command (char **argv, char **envp)
|
|||
execvp (shell, new_argv);
|
||||
# endif
|
||||
OSS (error, NILF, "%s: %s", new_argv[0], strerror (errno));
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef __EMX__
|
||||
case EINVAL:
|
||||
else if (errno == EINVAL)
|
||||
/* this nasty error was driving me nuts :-( */
|
||||
O (error, NILF, _("spawnvpe: environment space might be exhausted"));
|
||||
/* FALLTHROUGH */
|
||||
# endif
|
||||
|
||||
default:
|
||||
OSS (error, NILF, "%s: %s", argv[0], strerror (errno));
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef __EMX__
|
||||
|
@ -2916,7 +2910,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
|
|||
instring = word_has_equals = seen_nonequals = last_argument_was_empty = 0;
|
||||
for (p = line; *p != '\0'; ++p)
|
||||
{
|
||||
assert (ap <= end);
|
||||
// assert (ap <= end);
|
||||
|
||||
if (instring)
|
||||
{
|
||||
|
|
3
third_party/make/src/makeint.h
vendored
3
third_party/make/src/makeint.h
vendored
|
@ -517,7 +517,8 @@ void pfatal_with_name (const char *) NORETURN;
|
|||
void perror_with_name (const char *, const char *);
|
||||
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
|
||||
void *xmalloc (size_t);
|
||||
void *xcalloc (size_t);
|
||||
// void *xcalloc (size_t);
|
||||
#define xcalloc(size) ((xcalloc)(1, (size)))
|
||||
void *xrealloc (void *, size_t);
|
||||
char *xstrdup (const char *);
|
||||
char *xstrndup (const char *, size_t);
|
||||
|
|
5
third_party/make/src/misc.c
vendored
5
third_party/make/src/misc.c
vendored
|
@ -176,7 +176,7 @@ concat (unsigned int num, ...)
|
|||
/* Like malloc but get fatal error if memory is exhausted. */
|
||||
/* Don't bother if we're using dmalloc; it provides these for us. */
|
||||
|
||||
#ifndef HAVE_DMALLOC_H
|
||||
#if 0 && !defined(HAVE_DMALLOC_H)
|
||||
|
||||
#undef xmalloc
|
||||
#undef xcalloc
|
||||
|
@ -197,14 +197,13 @@ xmalloc (size_t size)
|
|||
void *
|
||||
xcalloc (size_t size)
|
||||
{
|
||||
/* Make sure we don't allocate 0, for pre-ISO implementations. */
|
||||
/* Make sure we don't allocate 0, for pre-ISO implementations. */
|
||||
void *result = calloc (size ? size : 1, 1);
|
||||
if (result == 0)
|
||||
out_of_memory ();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
xrealloc (void *ptr, size_t size)
|
||||
{
|
||||
|
|
9
third_party/make/src/read.c
vendored
9
third_party/make/src/read.c
vendored
|
@ -27,6 +27,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "rule.h"
|
||||
#include "debug.h"
|
||||
#include "hash.h"
|
||||
# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
|
||||
|
||||
|
||||
#ifdef WINDOWS32
|
||||
|
@ -361,15 +362,15 @@ eval_makefile (const char *filename, unsigned short flags)
|
|||
deps->error = errno;
|
||||
|
||||
/* Check for unrecoverable errors: out of mem or FILE slots. */
|
||||
switch (deps->error)
|
||||
{
|
||||
if (0 ||
|
||||
#ifdef EMFILE
|
||||
case EMFILE:
|
||||
deps->error == EMFILE ||
|
||||
#endif
|
||||
#ifdef ENFILE
|
||||
case ENFILE:
|
||||
deps->error == ENFILE ||
|
||||
#endif
|
||||
case ENOMEM:
|
||||
deps->error == ENOMEM)
|
||||
{
|
||||
const char *err = strerror (deps->error);
|
||||
OS (fatal, reading_file, "%s", err);
|
||||
|
|
Loading…
Add table
Reference in a new issue