Go to the documentation of this file.Go to the SVN repository for this file.
35 # include <sys/cdefs.h>
37 # define __UNCONST(x) ((char*)(x))
38 # define getprogname() (nargv[0])
39 # define _DIAGASSERT(x) assert((x))
42 #if !defined(_WIN32) && 0
43 # include "namespace.h"
55 #include <freetds/sysdep_private.h>
58 __weak_alias(
getopt,_getopt)
67 #define BADCH (int)'?'
68 #define BADARG (int)':'
81 static const char *place =
EMSG;
84 _DIAGASSERT(nargv !=
NULL);
85 _DIAGASSERT(ostr !=
NULL);
90 if (
optind >= nargc || *place++ !=
'-') {
96 if (
optopt ==
'-' && *place == 0) {
106 if (strchr(ostr,
'-') ==
NULL)
117 if (
opterr && *ostr !=
':')
118 (void)fprintf(stderr,
119 "%s: unknown option -- %c\n", getprogname(),
134 optarg = __UNCONST(place);
135 else if (nargc > ++
optind)
143 (void)fprintf(stderr,
144 "%s: option requires an argument -- %c\n",
int tds_getopt(int nargc, nargv, const char *ostr)