mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Switch public headers to getopt_long() entirely
Cosmopolitan's getopt() is now redefined as __getopt().
This commit is contained in:
parent
0c630d95b5
commit
fe044e22cc
137 changed files with 148 additions and 179 deletions
1
third_party/getopt/getopt.c
vendored
1
third_party/getopt/getopt.c
vendored
|
@ -34,6 +34,7 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/getopt/getopt.internal.h"
|
||||
|
||||
asm(".ident\t\"\\n\
|
||||
getopt (BSD-3)\\n\
|
||||
|
|
14
third_party/getopt/getopt.h
vendored
14
third_party/getopt/getopt.h
vendored
|
@ -1,14 +0,0 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_GETOPT_GETOPT_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_GETOPT_GETOPT_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt, optreset;
|
||||
|
||||
int getopt(int, char *const[], const char *) paramsnonnull();
|
||||
int getsubopt(char **, char *const *, char **) paramsnonnull();
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_THIRD_PARTY_GETOPT_GETOPT_H_ */
|
25
third_party/getopt/getopt.internal.h
vendored
Normal file
25
third_party/getopt/getopt.internal.h
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef COSMOPOLITAN_GETOPT_H_
|
||||
#define COSMOPOLITAN_GETOPT_H_
|
||||
#ifdef COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#error "don't mix getopt_long() with cosmo's getopt()"
|
||||
#endif
|
||||
|
||||
#define optarg __optarg
|
||||
#define optind __optind
|
||||
#define opterr __opterr
|
||||
#define optopt __optopt
|
||||
#define optreset __optreset
|
||||
#define getopt __getopt
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt, optreset;
|
||||
|
||||
int getopt(int, char *const[], const char *) paramsnonnull();
|
||||
int getsubopt(char **, char *const *, char **) paramsnonnull();
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_GETOPT_H_ */
|
2
third_party/getopt/getsubopt.c
vendored
2
third_party/getopt/getsubopt.c
vendored
|
@ -29,7 +29,7 @@
|
|||
│ SUCH DAMAGE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/getopt/getopt.h"
|
||||
#include "third_party/getopt/getopt.internal.h"
|
||||
// clang-format off
|
||||
|
||||
/*
|
||||
|
|
13
third_party/getopt/long.h
vendored
13
third_party/getopt/long.h
vendored
|
@ -1,5 +1,8 @@
|
|||
#ifndef COSMOPOLITAN_THIRD_PARTY_GETOPT_LONG_H_
|
||||
#define COSMOPOLITAN_THIRD_PARTY_GETOPT_LONG_H_
|
||||
#ifndef COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#define COSMOPOLITAN_GETOPT_LONG_H_
|
||||
#ifdef COSMOPOLITAN_GETOPT_H_
|
||||
#error "don't mix getopt_long() with cosmo's getopt()"
|
||||
#endif
|
||||
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
|
@ -15,10 +18,14 @@ 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_THIRD_PARTY_GETOPT_LONG_H_ */
|
||||
#endif /* COSMOPOLITAN_GETOPT_LONG_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue