mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-24 02:51:43 +01:00
Map getopt to bsd_getopt if we are using the overlay
This will ensure the code can safely and correctly use optreset transparently.
This commit is contained in:
parent
17a9a8472e
commit
9d04217174
@ -39,6 +39,11 @@
|
||||
__BEGIN_DECLS
|
||||
extern int optreset;
|
||||
|
||||
#ifdef LIBBSD_OVERLAY
|
||||
#undef getopt
|
||||
#define getopt(argc, argv, optstr) bsd_getopt(argc, argv, optstr)
|
||||
#endif
|
||||
|
||||
int bsd_getopt (int, char **, char *);
|
||||
__END_DECLS
|
||||
|
||||
|
@ -36,5 +36,9 @@ bsd_getopt(int argc, char **argv, char *shortopts)
|
||||
optind = 0;
|
||||
}
|
||||
|
||||
return getopt(argc, argv, shortopts);
|
||||
/*
|
||||
* Make sure we are using the system getopt() and not a possible
|
||||
* overlay macro.
|
||||
*/
|
||||
return (getopt)(argc, argv, shortopts);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user