From dev-return-9134-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Wed Feb 05 19:58:45 2003 Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 98846 invoked by uid 500); 5 Feb 2003 19:58:44 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 98753 invoked from network); 5 Feb 2003 19:58:43 -0000 Message-ID: <3E416CF8.5080404@xbc.nu> Date: Wed, 05 Feb 2003 20:58:48 +0100 From: =?UTF-8?B?QnJhbmtvIMSMaWJlag==?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021212 X-Accept-Language: sl, en-gb, en MIME-Version: 1.0 To: dev@apr.apache.org Subject: Proposal: new filepath API for search paths Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I'd like to propose a new function in the apr_filepath module, to be added for 0.9.2 and/or httpd-2.0.45: /** * Split a search path defined in an environment variable (e.g., @c $PATH) * into separate components * @ingroup apr_filepath * @param pathelts the returned components of the search path * @param envvar the name of the environment variable with the search path * @param p the pool to allocate the array and path components from * @deffunc apr_status_t apr_filepath_splitenv(apr_array_header_t **pathelts, const char *envvar, apr_pool_t *p) * @remark if the environment variable does not exist, the result code will * be @c APR_ENOENT; other codes are implementation-specific. */ APR_DECLARE(apr_status_t) apr_filepath_splitenv(apr_array_header_t **pathelts, const char *envvar, apr_pool_t *p); The apr-iconv module would use this to interpret the APR_ICONV_PATH variable in a way that's compatible with other functions that accept paths (e.g., the returned path components would be in UTF-8 on most Windows variants). For example, the module loading code in iconv-module.c would look like the following, instead of the apr_strtok based implementation we have now: status = apr_filepath_splitenv(&pathelts, "APR_ICONV_PATH", subpool); if (!status) { int i; char **elts = (char **)pathelts->elts; for (i = 0; i < pathelts->nelts; ++i) { if (iconv_getpathname(buf, elts[i], buffer, subpool) == 0) { apr_pool_destroy(subpool); return APR_SUCCESS; } } } I have a workinng Windows and Unix implementation, but would like to get some feedback on the proposed interface before checking in the code. -- Brane Čibej http://www.xbc.nu/brane/