Disable the getopt argument permutation on BSD systems.
On BSD based operating systems (which includes Mac OS X), the getopt() function is posix compliant and thus the option processing stops when the first non-option is found. But the getopt_long() function permutes the argument vector, just like the GNU implementation. Using a leading '+' character in the option string disables the permutation again.
This commit is contained in:
parent
5add68b2d5
commit
67a3697a4d
@ -106,6 +106,7 @@ AM_CONDITIONAL([IRDA], [test "$irda_win32" = "yes" || test "$irda_linux" = "yes"
|
||||
AC_CHECK_HEADERS([linux/serial.h])
|
||||
AC_CHECK_HEADERS([IOKit/serial/ioss.h])
|
||||
AC_CHECK_HEADERS([getopt.h])
|
||||
AC_CHECK_HEADERS([sys/param.h])
|
||||
|
||||
# Checks for global variable declarations.
|
||||
AC_CHECK_DECLS([optreset])
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <libdivecomputer/context.h>
|
||||
#include <libdivecomputer/descriptor.h>
|
||||
@ -40,13 +43,17 @@
|
||||
#include "utils.h"
|
||||
|
||||
#if defined(__GLIBC__) || defined(__MINGW32__)
|
||||
#define NOPERMUTATION "+"
|
||||
#define RESET 0
|
||||
#else
|
||||
#define NOPERMUTATION ""
|
||||
#define RESET 1
|
||||
#endif
|
||||
|
||||
#if defined(__GLIBC__) || defined(__MINGW32__) || defined(BSD)
|
||||
#define NOPERMUTATION "+"
|
||||
#else
|
||||
#define NOPERMUTATION ""
|
||||
#endif
|
||||
|
||||
static const dctool_command_t *g_commands[] = {
|
||||
&dctool_help,
|
||||
&dctool_version,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user