/* Copyright (c) 2003-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "strescape.h"
{
const char *p;
/* see if we need to quote it */
for (p = str; *p != '\0'; p++) {
if (IS_ESCAPED_CHAR(*p))
break;
}
if (*p == '\0')
return str;
/* quote */
for (; *p != '\0'; p++) {
if (IS_ESCAPED_CHAR(*p))
str_append_c(ret, *p);
}
}
{
while (i < src_size) {
for (; i < src_size; i++) {
if (src_c[i] == '\\')
break;
}
if (i < src_size) {
if (++i == src_size)
break;
}
start = i;
}
}
{
/* @UNSAFE */
while (*str != '\\') {
if (*str == '\0')
return start;
str++;
}
if (*str == '\\') {
str++;
if (*str == '\0')
break;
}
}
*dest = '\0';
return start;
}
{
const char *p;
char *escaped;
for (p = *str; *p != '\0'; p++) {
if (*p == '"')
break;
else if (*p == '\\') {
if (p[1] == '\0')
return -1;
p++;
}
}
if (*p != '"')
return -1;
*str = p+1;
return 0;
}
{
switch (src[i]) {
case '\000':
break;
case '\001':
break;
case '\t':
break;
case '\r':
break;
case '\n':
break;
default:
break;
}
}
}
}
{
const char *p;
for (p = str; *p != '\0'; p++) {
if (*p <= '\r') {
str_append_tabescaped(tmp, p);
}
}
return str;
}
{
while (i < src_size) {
for (; i < src_size; i++) {
if (src_c[i] == '\001')
break;
}
if (i < src_size) {
i++;
if (i < src_size) {
switch (src_c[i]) {
case '0':
break;
case '1':
break;
case 't':
break;
case 'r':
break;
case 'n':
break;
default:
break;
}
i++;
}
}
start = i;
}
}
{
/* @UNSAFE */
/* no unescaping needed */
return start;
}
if (*str != '\001')
else {
str++;
if (*str == '\0')
break;
switch (*str) {
case '0':
*dest++ = '\000';
break;
case '1':
*dest++ = '\001';
break;
case 't':
*dest++ = '\t';
break;
case 'r':
*dest++ = '\r';
break;
case 'n':
*dest++ = '\n';
break;
default:
break;
}
}
}
*dest = '\0';
return start;
}
{
return str;
else
}
{
/* @UNSAFE */
char **array;
if (*data == '\0')
return t_new(const char *, 1);
alloc_count = 32;
/* separator or escape char found */
if (*data == '\001') {
data++;
continue;
}
sizeof(char *) * alloc_count,
sizeof(char *) *
}
*data++ = '\0';
if (need_unescape) {
}
}
if (need_unescape)
return (const char *const *)array;
}
{
char **args;
unsigned int i;
return args;
}
{
}