summaryrefslogtreecommitdiff
path: root/src/getopt.c
diff options
context:
space:
mode:
authorfcolin2008-04-21 15:32:50 +0000
committerfcolin2008-04-21 15:32:50 +0000
commit50b963828e46b8e64b934b16a1c4d67adfdf9d88 (patch)
tree3fabfb642cb7fc9fbd5447160a9275be12e65eb3 /src/getopt.c
parenta3821ac78d363c9d35c1fa872ce87ebd7e372c30 (diff)
downloadivy-c-50b963828e46b8e64b934b16a1c4d67adfdf9d88.zip
ivy-c-50b963828e46b8e64b934b16a1c4d67adfdf9d88.tar.gz
ivy-c-50b963828e46b8e64b934b16a1c4d67adfdf9d88.tar.bz2
ivy-c-50b963828e46b8e64b934b16a1c4d67adfdf9d88.tar.xz
Compilation sous WINDOWS
Diffstat (limited to 'src/getopt.c')
-rw-r--r--src/getopt.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/getopt.c b/src/getopt.c
deleted file mode 100644
index 36a9bc1..0000000
--- a/src/getopt.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-int optind = 1;
-char *optarg = (char *)NULL;
-
-int getopt (int argc, char **argv, char *optstring)
-{
- int cur_option; /* Current option */
- char *cp; /* Character pointer */
- static int GetOptionPosition = 1;
-
- if (GetOptionPosition == 1)
- {
-
-/* Check for out of range, correct start character and not single */
-
- if ((optind >= argc) || (*argv[optind] != '-') || !argv[optind][1])
- return EOF;
-
- if (!strcmp (argv[optind], "--"))
- return EOF;
- }
-
-/* Get the current character from the current argument vector */
-
- cur_option = argv[optind][GetOptionPosition];
-
-/* Validate it */
-
- if ((cur_option == ':') ||
- ((cp = strchr (optstring, cur_option)) == (char *)NULL))
- {
-
-/* Move to the next offset */
-
- if (!argv[optind][++GetOptionPosition])
- {
- optind++;
- GetOptionPosition = 1;
- }
-
- return '?';
- }
-
-/* Parameters following ? */
-
- optarg = (char *)NULL;
-
- if (*(++cp) == ':')
- {
- if (argv[optind][GetOptionPosition + 1])
- optarg = &argv[optind++][GetOptionPosition + 1];
-
- else if (++optind >= argc)
- {
- optarg = (char *)NULL;
- GetOptionPosition = 1;
- return '?';
- }
-
- else
- optarg = argv[optind++];
-
- GetOptionPosition = 1;
- }
-
- else if (!argv[optind][++GetOptionPosition])
- {
- GetOptionPosition = 1;
- optind++;
- }
-
- return cur_option;
-}