Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31469 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24944 invoked by uid 1010); 6 Aug 2007 13:57:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 24929 invoked from network); 6 Aug 2007 13:57:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Aug 2007 13:57:27 -0000 X-Host-Fingerprint: 201.235.81.26 26-81-235-201.fibertel.com.ar Date: Mon, 06 Aug 2007 09:57:26 -0400 Received: from [201.235.81.26] ([201.235.81.26:3293] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/1D-61247-4C827B64 for ; Mon, 06 Aug 2007 09:57:26 -0400 Message-ID: To: internals@lists.php.net User-Agent: pan 0.120 (Plate of Shrimp) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Posted-By: 201.235.81.26 Subject: [PATCH] Getopt with longopts and windows support - part 2 From: dsp@php.net (David Soria Parra) Hi internals, so based on a discussion of php.pecl we thought about using the php_getopt for the PHP_FUNCTION(getopt) instead of the system provided getopt. Here is the patch for that. Hopefully someone is reviewing and commiting the patch as i don't have karma. It addes main/getopt.c main/php_getopt.h to the build system and uses the php_getopt function in the ext/standard/basic_functions.c. Furthermore it removes all HAVE_GETOPT and HARTMUT_0 switches. it also enable longopts for both win and linux in the form $opt = getopt("a", array("param:", "param2")); Where ":" in the longopts marks that the parameter takes an argument. The main/getopt.c and main/php_getopt.h is in fact taken from sapi/cli/getopt.c and sapi/cli/php_getopt.h but is slightly modified. http://experimentalworks.net/~dsp/getopt.patch.tar.gz It also runs on windows. To apply the patch: 1) remove sapi/cli/getopt.c sapi/cli/php_getopt.h sapi/cgi/getopt.c sapi/cgi/php_getopt.h 2) add main/getopt.c and main/php_getopt.h frm the archive 3) apply the patch.