23RCSID(
"$Id: 81d7129491616e55b92ec83ec642e20be1675c23 $")
25#include <freeradius-devel/util/misc.h>
26#include <freeradius-devel/util/skip.h>
27#include <freeradius-devel/util/strerror.h>
39 char const *p = start;
44 while ((end && (p < end)) || *p) {
61 if (end && ((p + 2) >= end)) {
70 if (p[1] <
' ')
goto fail;
89 if (end && ((p + 4) >= end))
goto fail;
94 if ((quote ==
'\'') && isxdigit((
uint8_t) p[1]) && isxdigit((
uint8_t) p[2])) {
132 char quote, end_quote;
133 char const *p = start;
138 if (end && ((start + 4) > end)) {
143 if ((*p !=
'%') && (*p !=
'$')) {
149 if ((*p !=
'{') && (*p !=
'(')) {
155 while (isalnum((
int) *q) || (*q ==
'.') || (*q ==
'_') || (*q ==
'-')) {
175 while ((end && (p < end)) || (*p >=
' ')) {
182 if (*p == end_quote) {
185 if (!
depth)
return p - start;
193 if ((p[0] ==
'$') || (p[0] ==
'%')) {
194 if (end && (p + 2) >= end)
break;
196 if ((p[1] ==
'{') || ((p[0] ==
'$') && (p[1] ==
'('))) {
200 if (slen <= 0)
return -(p - start) + slen;
216 if ((*p ==
'"') || (*p ==
'\'') || (*p ==
'`')) {
232 if (end && ((p + 2) >= end))
break;
237 if (p[1] <
' ')
break;
266 char const *p = start;
267 bool was_regex =
false;
271 if (eol) *eol =
false;
276 while ((end && (p < end)) || *p) {
314 if ((*p ==
'$') || (*p ==
'%')) {
315 if (end && ((p + 2) >= end)) {
320 if ((p[1] ==
'{') || ((p[0] ==
'$') && (p[1] ==
'('))) {
324 if (slen <= 0)
return -(p - start) + slen;
341 if ((*p ==
'"') || (*p ==
'\'') || (*p ==
'`') || (was_regex && (*p ==
'/'))) {
355 if ((p[0] ==
'=') || (p[0] ==
'!')) {
356 if (end && ((p + 2) >= end)) {
393 if (end && ((p + 2) >= end))
break;
398 if (p[1] <
' ')
break;
405 if (eol) *eol = (
depth > 0);
407 if (terminal[(
uint8_t) *p])
return p - start;
static uint8_t depth(fr_minmax_heap_index_t i)
ssize_t fr_skip_condition(char const *start, char const *end, bool const terminal[static UINT8_MAX+1], bool *eol)
Skip a conditional expression.
ssize_t fr_skip_string(char const *start, char const *end)
Skip a quoted string.
ssize_t fr_skip_xlat(char const *start, char const *end)
Skip an xlat expression.
#define fr_strerror_const(_msg)