# [PATCH] getopt on windows

- Thread: https://externals.io/message/31360
- Original archive: https://news-web.php.net/php.internals/31360
- Started by David Soria Parra on 2007-08-02T01:26:01+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31360 — David Soria Parra — 2007-08-02T01:26:01+00:00

URL: https://externals.io/message/31360#31360

Hi Internals,

I noticed that `getopt()` is not available on windows machines. Therefore I
tried to look for a solution. I build a patch, which does nothing
else than using the getop.c from the FreeBSD libc. This should be license
compatible (3-clause BSD License) as some other sources from the win32
distribution (e.g. win32/glob.c/) of PHP also use BSD license. 

I added getopt.c and getopt.h into php-src/win32/ and applied a patch to
ext/standard/config.w32 and win32/build/config.w32. 

For me the patch worked fine on WinXP 32bit with VC2003 as well as on my
linux 32bit.

You find the patch under
http://experimentalworks.net/~dsp/getopt.patch.tar.gz

Greetings 
  David (dsp at php dot net)

----
GnuPG Footprint: A29A C291 8205 D82D BA66 2049 34D9 D8CB D549 B3A3
2049 34D9 D8CB D549 B3A3
