get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/65649/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 65649,
    "url": "http://patches.dpdk.org/api/patches/65649/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200207031437.9124-5-pallavi.kadam@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200207031437.9124-5-pallavi.kadam@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200207031437.9124-5-pallavi.kadam@intel.com",
    "date": "2020-02-07T03:14:32",
    "name": "[v8,4/9] eal: getopt implementation for windows",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "eb8b826fbc7c3e5c132dba07b3547b784ae87e6b",
    "submitter": {
        "id": 1177,
        "url": "http://patches.dpdk.org/api/people/1177/?format=api",
        "name": "Kadam, Pallavi",
        "email": "pallavi.kadam@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200207031437.9124-5-pallavi.kadam@intel.com/mbox/",
    "series": [
        {
            "id": 8457,
            "url": "http://patches.dpdk.org/api/series/8457/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8457",
            "date": "2020-02-07T03:14:28",
            "name": "Windows patchset with additional EAL functionalities",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/8457/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/65649/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/65649/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 16EE2A0541;\n\tFri,  7 Feb 2020 04:16:47 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id CFB171C0D9;\n\tFri,  7 Feb 2020 04:16:07 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id E40E81C07B\n for <dev@dpdk.org>; Fri,  7 Feb 2020 04:15:56 +0100 (CET)",
            "from orsmga005.jf.intel.com ([10.7.209.41])\n by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n 06 Feb 2020 19:15:53 -0800",
            "from win-dpdk-pallavi.jf.intel.com (HELO localhost.localdomain)\n ([10.166.188.75])\n by orsmga005.jf.intel.com with ESMTP; 06 Feb 2020 19:15:53 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.70,411,1574150400\"; d=\"scan'208\";a=\"404693002\"",
        "From": "Pallavi Kadam <pallavi.kadam@intel.com>",
        "To": "dev@dpdk.org,\n\tthomas@monjalon.net",
        "Cc": "Harini.Ramakrishnan@microsoft.com, keith.wiles@intel.com,\n bruce.richardson@intel.com, david.marchand@redhat.com,\n jerinjacobk@gmail.com, ranjit.menon@intel.com,\n antara.ganesh.kolar@intel.com, pallavi.kadam@intel.com",
        "Date": "Thu,  6 Feb 2020 19:14:32 -0800",
        "Message-Id": "<20200207031437.9124-5-pallavi.kadam@intel.com>",
        "X-Mailer": "git-send-email 2.18.0.windows.1",
        "In-Reply-To": "<20200207031437.9124-1-pallavi.kadam@intel.com>",
        "References": "<20200201000406.11060-1-pallavi.kadam@intel.com>\n <20200207031437.9124-1-pallavi.kadam@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v8 4/9] eal: getopt implementation for windows",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Adding getopt files to support parsing option on\nWindows.\n\nThe original contribution is under BSD-2 license.\nhttps://github.com/greenplum-db/libusual/blob/master/usual/getopt.c\nhttps://github.com/greenplum-db/libusual/blob/master/usual/getopt.h\n\nSigned-off-by: Antara Ganesh Kolar <antara.ganesh.kolar@intel.com>\nSigned-off-by: Pallavi Kadam <pallavi.kadam@intel.com>\nReviewed-by: Ranjit Menon <ranjit.menon@intel.com>\nReviewed-by: Keith Wiles <keith.wiles@intel.com>\n---\n lib/librte_eal/windows/eal/getopt.c         | 470 ++++++++++++++++++++\n lib/librte_eal/windows/eal/include/getopt.h |  92 ++++\n lib/librte_eal/windows/eal/meson.build      |   1 +\n 3 files changed, 563 insertions(+)\n create mode 100644 lib/librte_eal/windows/eal/getopt.c\n create mode 100644 lib/librte_eal/windows/eal/include/getopt.h",
    "diff": "diff --git a/lib/librte_eal/windows/eal/getopt.c b/lib/librte_eal/windows/eal/getopt.c\nnew file mode 100644\nindex 000000000..170c9b5e0\n--- /dev/null\n+++ b/lib/librte_eal/windows/eal/getopt.c\n@@ -0,0 +1,470 @@\n+/* SPDX-License-Identifier: ISC AND BSD-2-Clause\n+ * Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>\n+ *\n+ * Sponsored in part by the Defense Advanced Research Projects\n+ * Agency (DARPA) and Air Force Research Laboratory, Air Force\n+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.\n+ */\n+/*\n+ * Copyright (c) 2000 The NetBSD Foundation, Inc.\n+ * All rights reserved.\n+ *\n+ * This code is derived from software contributed to The NetBSD Foundation\n+ * by Dieter Baron and Thomas Klausner.\n+ */\n+\n+#include <getopt.h>\n+\n+#ifdef NEED_USUAL_GETOPT\n+\n+#include <string.h>\n+#include <stdlib.h>\n+\n+const char    *optarg;\t\t/* argument associated with option */\n+int\topterr = 1;\t\t/* if error message should be printed */\n+int\toptind = 1;\t\t/* index into parent argv vector */\n+int\toptopt = '?';\t\t/* character checked for validity */\n+\n+static void pass(void) {}\n+#define warnx(a, ...) pass()\n+\n+#define PRINT_ERROR\t((opterr) && (*options != ':'))\n+\n+#define FLAG_PERMUTE\t0x01\t/* permute non-options to the end of argv */\n+#define FLAG_ALLARGS\t0x02\t/* treat non-options as args to option \"-1\" */\n+#define FLAG_LONGONLY\t0x04\t/* operate as getopt_long_only */\n+\n+/* return values */\n+#define\tBADCH\t\t((int)'?')\n+#define\tBADARG\t\t((*options == ':') ? (int)':' : (int)'?')\n+#define\tINORDER\t\t1\n+\n+#define\tEMSG\t\t\"\"\n+\n+static const char *place = EMSG; /* option letter processing */\n+\n+/* XXX: set optreset to 1 rather than these two */\n+static int nonopt_start = -1; /* first non option argument (for permute) */\n+static int nonopt_end = -1;   /* first option after non options (for permute) */\n+\n+/* Error messages */\n+static const char recargchar[] = \"option requires an argument -- %c\";\n+static const char recargstring[] = \"option requires an argument -- %s\";\n+static const char ambig[] = \"ambiguous option -- %.*s\";\n+static const char noarg[] = \"option doesn't take an argument -- %.*s\";\n+static const char illoptchar[] = \"unknown option -- %c\";\n+static const char illoptstring[] = \"unknown option -- %s\";\n+\n+/*\n+ * Compute the greatest common divisor of a and b.\n+ */\n+static int\n+gcd(int a, int b)\n+{\n+\tint c;\n+\n+\tc = a % b;\n+\twhile (c != 0) {\n+\t\ta = b;\n+\t\tb = c;\n+\t\tc = a % b;\n+\t}\n+\n+\treturn (b);\n+}\n+\n+/*\n+ * Exchange the block from nonopt_start to nonopt_end with the block\n+ * from nonopt_end to opt_end (keeping the same order of arguments\n+ * in each block).\n+ */\n+static void\n+permute_args(int panonopt_start, int panonopt_end, int opt_end,\n+\tchar **nargv)\n+{\n+\tint cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;\n+\tchar *swap;\n+\n+\t/*\n+\t * compute lengths of blocks and number and size of cycles\n+\t */\n+\tnnonopts = panonopt_end - panonopt_start;\n+\tnopts = opt_end - panonopt_end;\n+\tncycle = gcd(nnonopts, nopts);\n+\tcyclelen = (opt_end - panonopt_start) / ncycle;\n+\n+\tfor (i = 0; i < ncycle; i++) {\n+\t\tcstart = panonopt_end+i;\n+\t\tpos = cstart;\n+\t\tfor (j = 0; j < cyclelen; j++) {\n+\t\t\tif (pos >= panonopt_end)\n+\t\t\t\tpos -= nnonopts;\n+\t\t\telse\n+\t\t\t\tpos += nopts;\n+\t\t\tswap = nargv[pos];\n+\t\t\t/* LINTED const cast */\n+\t\t\t((char **) nargv)[pos] = nargv[cstart];\n+\t\t\t/* LINTED const cast */\n+\t\t\t((char **)nargv)[cstart] = swap;\n+\t\t}\n+\t}\n+}\n+\n+/*\n+ * parse_long_options --\n+ *\tParse long options in argc/argv argument vector.\n+ * Returns -1 if short_too is set and the option does not match long_options.\n+ */\n+static int\n+parse_long_options(char **nargv, const char *options,\n+\tconst struct option *long_options, int *idx, int short_too)\n+{\n+\tconst char *current_argv;\n+\tchar *has_equal;\n+\tsize_t current_argv_len;\n+\tint i, match;\n+\n+\tcurrent_argv = place;\n+\tmatch = -1;\n+\n+\toptind++;\n+\n+\thas_equal = strchr(current_argv, '=');\n+\tif (has_equal != NULL) {\n+\t\t/* argument found (--option=arg) */\n+\t\tcurrent_argv_len = has_equal - current_argv;\n+\t\thas_equal++;\n+\t} else\n+\t\tcurrent_argv_len = strlen(current_argv);\n+\n+\tfor (i = 0; long_options[i].name; i++) {\n+\t\t/* find matching long option */\n+\t\tif (strncmp(current_argv, long_options[i].name,\n+\t\t    current_argv_len))\n+\t\t\tcontinue;\n+\n+\t\tif (strlen(long_options[i].name) == current_argv_len) {\n+\t\t\t/* exact match */\n+\t\t\tmatch = i;\n+\t\t\tbreak;\n+\t\t}\n+\t\t/*\n+\t\t * If this is a known short option, don't allow\n+\t\t * a partial match of a single character.\n+\t\t */\n+\t\tif (short_too && current_argv_len == 1)\n+\t\t\tcontinue;\n+\n+\t\tif (match == -1)\t/* partial match */\n+\t\t\tmatch = i;\n+\t\telse {\n+\t\t\t/* ambiguous abbreviation */\n+\t\t\tif (PRINT_ERROR)\n+\t\t\t\twarnx(ambig, (int)current_argv_len,\n+\t\t\t\t     current_argv);\n+\t\t\toptopt = 0;\n+\t\t\treturn BADCH;\n+\t\t}\n+\t}\n+\tif (match != -1) {\t\t/* option found */\n+\t\tif (long_options[match].has_arg == no_argument\n+\t\t    && has_equal) {\n+\t\t\tif (PRINT_ERROR)\n+\t\t\t\twarnx(noarg, (int)current_argv_len,\n+\t\t\t\t     current_argv);\n+\t\t\t/*\n+\t\t\t * XXX: GNU sets optopt to val regardless of flag\n+\t\t\t */\n+\t\t\tif (long_options[match].flag == NULL)\n+\t\t\t\toptopt = long_options[match].val;\n+\t\t\telse\n+\t\t\t\toptopt = 0;\n+\t\t\treturn BADARG;\n+\t\t}\n+\t\tif (long_options[match].has_arg == required_argument ||\n+\t\t    long_options[match].has_arg == optional_argument) {\n+\t\t\tif (has_equal)\n+\t\t\t\toptarg = has_equal;\n+\t\t\telse if (long_options[match].has_arg ==\n+\t\t\t    required_argument) {\n+\t\t\t\t/*\n+\t\t\t\t * optional argument doesn't use next nargv\n+\t\t\t\t */\n+\t\t\t\toptarg = nargv[optind++];\n+\t\t\t}\n+\t\t}\n+\t\tif ((long_options[match].has_arg == required_argument)\n+\t\t    && (optarg == NULL)) {\n+\t\t\t/*\n+\t\t\t * Missing argument; leading ':' indicates no error\n+\t\t\t * should be generated.\n+\t\t\t */\n+\t\t\tif (PRINT_ERROR)\n+\t\t\t\twarnx(recargstring,\n+\t\t\t\t    current_argv);\n+\t\t\t/*\n+\t\t\t * XXX: GNU sets optopt to val regardless of flag\n+\t\t\t */\n+\t\t\tif (long_options[match].flag == NULL)\n+\t\t\t\toptopt = long_options[match].val;\n+\t\t\telse\n+\t\t\t\toptopt = 0;\n+\t\t\t--optind;\n+\t\t\treturn BADARG;\n+\t\t}\n+\t} else {\t\t\t/* unknown option */\n+\t\tif (short_too) {\n+\t\t\t--optind;\n+\t\t\treturn (-1);\n+\t\t}\n+\t\tif (PRINT_ERROR)\n+\t\t\twarnx(illoptstring, current_argv);\n+\t\toptopt = 0;\n+\t\treturn BADCH;\n+\t}\n+\tif (idx)\n+\t\t*idx = match;\n+\tif (long_options[match].flag) {\n+\t\t*long_options[match].flag = long_options[match].val;\n+\t\treturn 0;\n+\t} else\n+\t\treturn (long_options[match].val);\n+}\n+\n+/*\n+ * getopt_internal --\n+ *\tParse argc/argv argument vector.  Called by user level routines.\n+ */\n+static int\n+getopt_internal(int nargc, char **nargv, const char *options,\n+\tconst struct option *long_options, int *idx, int flags)\n+{\n+\tchar *oli;\t\t\t\t/* option letter list index */\n+\tint optchar, short_too;\n+\tstatic int posixly_correct = -1;\n+\tchar *buf;\n+\tsize_t len;\n+\tint optreset = 0;\n+\n+\tif (options == NULL)\n+\t\treturn (-1);\n+\n+\t/*\n+\t * Disable GNU extensions if POSIXLY_CORRECT is set or options\n+\t * string begins with a '+'.\n+\t */\n+\tif (posixly_correct == -1)\n+\t\tposixly_correct = _dupenv_s(&buf, &len, \"POSIXLY_CORRECT\");\n+\tif (!posixly_correct || *options == '+')\n+\t\tflags &= ~FLAG_PERMUTE;\n+\telse if (*options == '-')\n+\t\tflags |= FLAG_ALLARGS;\n+\tif (*options == '+' || *options == '-')\n+\t\toptions++;\n+\tif (!posixly_correct)\n+\t\tfree(buf);\n+\t/*\n+\t * reset if requested\n+\t */\n+\tif (optind == 0)\n+\t\toptind = optreset = 1;\n+\n+\toptarg = NULL;\n+\tif (optreset)\n+\t\tnonopt_start = nonopt_end = -1;\n+start:\n+\tif (optreset || !*place) {\t\t/* update scanning pointer */\n+\t\toptreset = 0;\n+\t\tif (optind >= nargc) {          /* end of argument vector */\n+\t\t\tplace = EMSG;\n+\t\t\tif (nonopt_end != -1) {\n+\t\t\t\t/* do permutation, if we have to */\n+\t\t\t\tpermute_args(nonopt_start, nonopt_end,\n+\t\t\t\t    optind, nargv);\n+\t\t\t\toptind -= nonopt_end - nonopt_start;\n+\t\t\t} else if (nonopt_start != -1) {\n+\t\t\t\t/*\n+\t\t\t\t * If we skipped non-options, set optind\n+\t\t\t\t * to the first of them.\n+\t\t\t\t */\n+\t\t\t\toptind = nonopt_start;\n+\t\t\t}\n+\t\t\tnonopt_start = nonopt_end = -1;\n+\t\t\treturn (-1);\n+\t\t}\n+\t\tplace = nargv[optind];\n+\t\tif (*place != '-' ||\n+\t\t    (place[1] == '\\0' && strchr(options, '-') == NULL)) {\n+\t\t\tplace = EMSG;\t\t/* found non-option */\n+\t\t\tif (flags & FLAG_ALLARGS) {\n+\t\t\t\t/*\n+\t\t\t\t * GNU extension:\n+\t\t\t\t * return non-option as argument to option 1\n+\t\t\t\t */\n+\t\t\t\toptarg = nargv[optind++];\n+\t\t\t\treturn INORDER;\n+\t\t\t}\n+\t\t\tif (!(flags & FLAG_PERMUTE)) {\n+\t\t\t\t/*\n+\t\t\t\t * If no permutation wanted, stop parsing\n+\t\t\t\t * at first non-option.\n+\t\t\t\t */\n+\t\t\t\treturn (-1);\n+\t\t\t}\n+\t\t\t/* do permutation */\n+\t\t\tif (nonopt_start == -1)\n+\t\t\t\tnonopt_start = optind;\n+\t\t\telse if (nonopt_end != -1) {\n+\t\t\t\tpermute_args(nonopt_start, nonopt_end,\n+\t\t\t\t    optind, nargv);\n+\t\t\t\tnonopt_start = optind -\n+\t\t\t\t    (nonopt_end - nonopt_start);\n+\t\t\t\tnonopt_end = -1;\n+\t\t\t}\n+\t\t\toptind++;\n+\t\t\t/* process next argument */\n+\t\t\tgoto start;\n+\t\t}\n+\t\tif (nonopt_start != -1 && nonopt_end == -1)\n+\t\t\tnonopt_end = optind;\n+\n+\t\t/*\n+\t\t * If we have \"-\" do nothing, if \"--\" we are done.\n+\t\t */\n+\t\tif (place[1] != '\\0' && *++place == '-' && place[1] == '\\0') {\n+\t\t\toptind++;\n+\t\t\tplace = EMSG;\n+\t\t\t/*\n+\t\t\t * We found an option (--), so if we skipped\n+\t\t\t * non-options, we have to permute.\n+\t\t\t */\n+\t\t\tif (nonopt_end != -1) {\n+\t\t\t\tpermute_args(nonopt_start, nonopt_end,\n+\t\t\t\t    optind, nargv);\n+\t\t\t\toptind -= nonopt_end - nonopt_start;\n+\t\t\t}\n+\t\t\tnonopt_start = nonopt_end = -1;\n+\t\t\treturn (-1);\n+\t\t}\n+\t}\n+\n+\t/*\n+\t * Check long options if:\n+\t *  1) we were passed some\n+\t *  2) the arg is not just \"-\"\n+\t *  3) either the arg starts with -- we are getopt_long_only()\n+\t */\n+\tif (long_options != NULL && place != nargv[optind] &&\n+\t    (*place == '-' || (flags & FLAG_LONGONLY))) {\n+\t\tshort_too = 0;\n+\t\tif (*place == '-')\n+\t\t\tplace++;\t\t/* --foo long option */\n+\t\telse if (*place != ':' && strchr(options, *place) != NULL)\n+\t\t\tshort_too = 1;\t\t/* could be short option too */\n+\n+\t\toptchar = parse_long_options(nargv, options, long_options,\n+\t\t    idx, short_too);\n+\t\tif (optchar != -1) {\n+\t\t\tplace = EMSG;\n+\t\t\treturn optchar;\n+\t\t}\n+\t}\n+\n+\toptchar = (int)*place++;\n+\toli = strchr(options, optchar);\n+\tif (optchar == (int)':' ||\n+\t    (optchar == (int)'-' && *place != '\\0') ||\n+\t    oli == NULL) {\n+\t\t/*\n+\t\t * If the user specified \"-\" and  '-' isn't listed in\n+\t\t * options, return -1 (non-option) as per POSIX.\n+\t\t * Otherwise, it is an unknown option character (or ':').\n+\t\t */\n+\t\tif (optchar == (int)'-' && *place == '\\0')\n+\t\t\treturn (-1);\n+\t\tif (!*place)\n+\t\t\t++optind;\n+\t\tif (PRINT_ERROR)\n+\t\t\twarnx(illoptchar, optchar);\n+\t\toptopt = optchar;\n+\t\treturn BADCH;\n+\t}\n+\tif (long_options != NULL && optchar == 'W' && oli[1] == ';') {\n+\t\t/* -W long-option */\n+\t\tif (*place)\n+\t\t\t;\n+\t\telse if (++optind >= nargc) {\t/* no arg */\n+\t\t\tplace = EMSG;\n+\t\t\tif (PRINT_ERROR)\n+\t\t\t\twarnx(recargchar, optchar);\n+\t\t\toptopt = optchar;\n+\t\t\treturn BADARG;\n+\t\t}\t\t\t\t/* white space */\n+\t\tplace = nargv[optind];\n+\t\toptchar = parse_long_options(nargv, options, long_options,\n+\t\t    idx, 0);\n+\t\tplace = EMSG;\n+\t\treturn optchar;\n+\t}\n+\tif (*++oli != ':') {\t\t\t/* doesn't take argument */\n+\t\tif (!*place)\n+\t\t\t++optind;\n+\t} else {\t\t\t\t/* takes (optional) argument */\n+\t\toptarg = NULL;\n+\t\tif (*place)\t\t\t/* no white space */\n+\t\t\toptarg = place;\n+\t\telse if (oli[1] != ':') {\t/* arg not optional */\n+\t\t\tif (++optind >= nargc) {\t/* no arg */\n+\t\t\t\tplace = EMSG;\n+\t\t\t\tif (PRINT_ERROR)\n+\t\t\t\t\twarnx(recargchar, optchar);\n+\t\t\t\toptopt = optchar;\n+\t\t\t\treturn BADARG;\n+\t\t\t}\n+\t\t\toptarg = nargv[optind];\n+\t\t}\n+\t\tplace = EMSG;\n+\t\t++optind;\n+\t}\n+\t/* dump back option letter */\n+\treturn optchar;\n+}\n+\n+/*\n+ * getopt --\n+ *\tParse argc/argv argument vector.\n+ */\n+int\n+getopt(int nargc, char *nargv[], const char *options)\n+{\n+\treturn getopt_internal(nargc, nargv, options, NULL, NULL,\n+\t\t\t       FLAG_PERMUTE);\n+}\n+\n+/*\n+ * getopt_long --\n+ *\tParse argc/argv argument vector.\n+ */\n+int\n+getopt_long(int nargc, char *nargv[], const char *options,\n+\tconst struct option *long_options, int *idx)\n+{\n+\n+\treturn (getopt_internal(nargc, nargv, options, long_options, idx,\n+\t    FLAG_PERMUTE));\n+}\n+\n+/*\n+ * getopt_long_only --\n+ *\tParse argc/argv argument vector.\n+ */\n+int\n+getopt_long_only(int nargc, char *nargv[], const char *options,\n+\tconst struct option *long_options, int *idx)\n+{\n+\n+\treturn (getopt_internal(nargc, nargv, options, long_options, idx,\n+\t    FLAG_PERMUTE|FLAG_LONGONLY));\n+}\n+\n+#endif /* NEED_USUAL_GETOPT */\ndiff --git a/lib/librte_eal/windows/eal/include/getopt.h b/lib/librte_eal/windows/eal/include/getopt.h\nnew file mode 100644\nindex 000000000..2eebe54e3\n--- /dev/null\n+++ b/lib/librte_eal/windows/eal/include/getopt.h\n@@ -0,0 +1,92 @@\n+/* SPDX-License-Identifier: BSD-2-Clause\n+ * Copyright (c) 2000 The NetBSD Foundation, Inc.\n+ * All rights reserved.\n+ *\n+ * This code is derived from software contributed to The NetBSD Foundation\n+ * by Dieter Baron and Thomas Klausner.\n+ */\n+\n+/**\n+ * @file\n+ * getopt compat.\n+ *\n+ * This module provides getopt() and getopt_long().\n+ */\n+\n+#ifndef _USUAL_GETOPT_H_\n+#define _USUAL_GETOPT_H_\n+\n+#ifndef NEED_USUAL_GETOPT\n+#if !defined(HAVE_GETOPT_H) || !defined(HAVE_GETOPT) || \\\n+\t!defined(HAVE_GETOPT_LONG)\n+#define NEED_USUAL_GETOPT\n+#endif\n+#endif\n+\n+#ifndef NEED_USUAL_GETOPT\n+\n+/* Use system getopt */\n+#include <getopt.h>\n+\n+#else /* NEED_USUAL_GETOPT */\n+\n+/* avoid name collision */\n+#define optarg usual_optarg\n+#define opterr usual_opterr\n+#define optind usual_optind\n+#define optopt usual_optopt\n+#define getopt(a, b, c) usual_getopt(a, b, c)\n+#define getopt_long(a, b, c, d, e) usual_getopt_long(a, b, c, d, e)\n+\n+\n+/** argument to current option, or NULL if it has none */\n+extern const char *optarg;\n+/** Current position in arg string.  Starts from 1.\n+ * Setting to 0 resets state.\n+ */\n+extern int optind;\n+/** whether getopt() should print error messages on problems.  Default: 1. */\n+extern int opterr;\n+/** Option char which caused error */\n+extern int optopt;\n+\n+/** long option takes no argument */\n+#define no_argument        0\n+/** long option requires argument */\n+#define required_argument  1\n+/** long option has optional argument */\n+#define optional_argument  2\n+\n+/** Long option description */\n+struct option {\n+\t/** name of long option */\n+\tconst char *name;\n+\n+\t/**\n+\t * whether option takes an argument.\n+\t * One of no_argument, required_argument, and optional_argument.\n+\t */\n+\tint has_arg;\n+\n+\t/** if not NULL, set *flag to val when option found */\n+\tint *flag;\n+\n+\t/** if flag not NULL, value to set *flag to; else return value */\n+\tint val;\n+};\n+\n+/** Compat: getopt */\n+int getopt(int argc, char *argv[], const char *options);\n+\n+/** Compat: getopt_long */\n+int getopt_long(int argc, char *argv[], const char *options,\n+\t\tconst struct option *longopts, int *longindex);\n+\n+/** Compat: getopt_long_only */\n+int getopt_long_only(int nargc, char *argv[], const char *options,\n+\t\t     const struct option *long_options, int *idx);\n+\n+\n+#endif /* NEED_USUAL_GETOPT */\n+\n+#endif /* !_USUAL_GETOPT_H_ */\ndiff --git a/lib/librte_eal/windows/eal/meson.build b/lib/librte_eal/windows/eal/meson.build\nindex af4f70f00..d37222158 100644\n--- a/lib/librte_eal/windows/eal/meson.build\n+++ b/lib/librte_eal/windows/eal/meson.build\n@@ -17,4 +17,5 @@ env_sources = files('eal.c',\n \t'eal_debug.c',\n \t'eal_lcore.c',\n \t'eal_thread.c',\n+\t'getopt.c',\n )\n",
    "prefixes": [
        "v8",
        "4/9"
    ]
}