Use the optreset variable on BSD systems.
On BSD based operating systems the optreset variable should be used to reset the internal getopt state. Setting optind to zero is a GNU extension.
This commit is contained in:
parent
ade8619ea6
commit
5add68b2d5
@ -107,6 +107,9 @@ AC_CHECK_HEADERS([linux/serial.h])
|
||||
AC_CHECK_HEADERS([IOKit/serial/ioss.h])
|
||||
AC_CHECK_HEADERS([getopt.h])
|
||||
|
||||
# Checks for global variable declarations.
|
||||
AC_CHECK_DECLS([optreset])
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_STRERROR_R
|
||||
AC_CHECK_FUNCS([localtime_r gmtime_r])
|
||||
|
||||
@ -217,6 +217,9 @@ main (int argc, char *argv[])
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
optind = RESET;
|
||||
#if defined(HAVE_DECL_OPTRESET) && HAVE_DECL_OPTRESET
|
||||
optreset = 1;
|
||||
#endif
|
||||
|
||||
// Translate the help option into a command.
|
||||
char *argv_help[] = {(char *) "help", NULL, NULL};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user