mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Refactor fatcosmocc into a single file
This commit is contained in:
parent
b494d56549
commit
0e586c834a
15 changed files with 217 additions and 240 deletions
3
third_party/getopt/getopt.internal.h
vendored
3
third_party/getopt/getopt.internal.h
vendored
|
@ -1,6 +1,7 @@
|
|||
#ifndef COSMOPOLITAN_GETOPT_H_
|
||||
#define COSMOPOLITAN_GETOPT_H_
|
||||
#ifdef COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#if defined(COSMOPOLITAN_GETOPT_LONG1_H_) || \
|
||||
defined(COSMOPOLITAN_GETOPT_LONG2_H_)
|
||||
#error "don't mix getopt_long() with cosmo's getopt()"
|
||||
#endif
|
||||
|
||||
|
|
3
third_party/getopt/long.c
vendored
3
third_party/getopt/long.c
vendored
|
@ -1,7 +1,8 @@
|
|||
#include "third_party/getopt/long.h"
|
||||
#include "libc/log/bsd.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/getopt/long1.h"
|
||||
#include "third_party/getopt/long2.h"
|
||||
// clang-format off
|
||||
|
||||
/* $OpenBSD: getopt_long.c,v 1.32 2020/05/27 22:25:09 schwarze Exp $ */
|
||||
|
|
16
third_party/getopt/long1.h
vendored
Executable file
16
third_party/getopt/long1.h
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
#ifndef COSMOPOLITAN_GETOPT_LONG1_H_
|
||||
#define COSMOPOLITAN_GETOPT_LONG1_H_
|
||||
#ifdef COSMOPOLITAN_GETOPT_H_
|
||||
#error "don't mix getopt_long() with cosmo's getopt()"
|
||||
#endif
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt, optreset;
|
||||
|
||||
int getopt(int, char *const *, const char *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_GETOPT_LONG1_H_ */
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#define COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#ifndef COSMOPOLITAN_GETOPT_LONG2_H_
|
||||
#define COSMOPOLITAN_GETOPT_LONG2_H_
|
||||
#ifdef COSMOPOLITAN_GETOPT_H_
|
||||
#error "don't mix getopt_long() with cosmo's getopt()"
|
||||
#endif
|
||||
|
@ -18,14 +18,10 @@ struct option {
|
|||
int val;
|
||||
};
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt, optreset;
|
||||
|
||||
int getopt(int, char *const *, const char *);
|
||||
int getopt_long(int, char *const *, const char *, const struct option *, int *);
|
||||
int getopt_long_only(int, char *const *, const char *, const struct option *,
|
||||
int *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_GETOPT_LONG_H_ */
|
||||
#endif /* COSMOPOLITAN_GETOPT_LONG2_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue