You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/12/10 22:26:01 UTC
svn commit: r1212883 - in /httpd/httpd/trunk: docs/manual/expr.xml
server/util_expr_eval.c
Author: sf
Date: Sat Dec 10 21:26:00 2011
New Revision: 1212883
URL: http://svn.apache.org/viewvc?rev=1212883&view=rev
Log:
Fix names of unary operators like '-s' being compared case insensitively.
Improve error message if op or function is not found. Document '-s' operator.
Modified:
httpd/httpd/trunk/docs/manual/expr.xml
httpd/httpd/trunk/server/util_expr_eval.c
Modified: httpd/httpd/trunk/docs/manual/expr.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1212883&r1=1212882&r2=1212883&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/expr.xml (original)
+++ httpd/httpd/trunk/docs/manual/expr.xml Sat Dec 10 21:26:00 2011
@@ -374,6 +374,9 @@ listfunction ::= listfuncname "<strong>(
<tr><td><code>-f</code></td>
<td>The argument is treated as a filename.
True if the file exists and is regular file</td><td>yes</td></tr>
+ <tr><td><code>-s</code></td>
+ <td>The argument is treated as a filename.
+ True if the file exists and is not empty</td><td>yes</td></tr>
<tr><td><code>-L</code></td>
<td>The argument is treated as a filename.
True if the file exists and is symlink</td><td>yes</td></tr>
Modified: httpd/httpd/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1212883&r1=1212882&r2=1212883&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Sat Dec 10 21:26:00 2011
@@ -1636,7 +1636,12 @@ static int core_expr_lookup(ap_expr_look
ap_assert(0);
}
while (prov->func) {
- if (strcasecmp(prov->name, parms->name) == 0) {
+ int match;
+ if (parms->type == AP_EXPR_FUNC_OP_UNARY)
+ match = !strcmp(prov->name, parms->name);
+ else
+ match = !strcasecmp(prov->name, parms->name);
+ if (match) {
if ((parms->flags & AP_EXPR_FLAG_RESTRICTED)
&& prov->restricted) {
*parms->err =
@@ -1668,6 +1673,7 @@ static int core_expr_lookup(ap_expr_look
static int expr_lookup_not_found(ap_expr_lookup_parms *parms)
{
const char *type;
+ const char *prefix = "";
switch (parms->type) {
case AP_EXPR_FUNC_VAR:
@@ -1689,8 +1695,12 @@ static int expr_lookup_not_found(ap_expr
*parms->err = "Inavalid expression type in expr_lookup";
return !OK;
}
- *parms->err = apr_psprintf(parms->ptemp, "%s '%s' does not exist", type,
- parms->name);
+ if ( parms->type == AP_EXPR_FUNC_OP_UNARY
+ || parms->type == AP_EXPR_FUNC_OP_BINARY) {
+ prefix = "-";
+ }
+ *parms->err = apr_psprintf(parms->ptemp, "%s '%s%s' does not exist", type,
+ prefix, parms->name);
return !OK;
}