strfuncs.c revision 5f30a00d160c75271d7b80d87a341963d8a9f6e2
/* Copyright (c) 2002-2003 Timo Sirainen */
/* @UNSAFE: whole file */
#include "lib.h"
#include "printf-upper-bound.h"
#include "strfuncs.h"
#include <stdio.h>
#include <limits.h>
#include <ctype.h>
#define STRCONCAT_BUFSIZE 512
static const char *fix_format_real(const char *fmt, const char *p)
{
const char *errstr;
char *buf;
while (*p != '\0') {
if (*p == '%' && p[1] == 'm') {
}
p += 2;
} else {
/* p + \0 */
alloc += 128;
}
p++;
}
}
return buf;
}
/* replace %m with strerror() */
const char *printf_string_fix_format(const char *fmt)
{
const char *p;
for (p = fmt; *p != '\0'; p++) {
if (*p == '%' && p[1] == 'm')
return fix_format_real(fmt, p);
}
return fmt;
}
{
#ifndef HAVE_VSNPRINTF
char *buf;
#endif
int ret;
t_push();
#ifdef HAVE_VSNPRINTF
#else
#endif
if (len < 0) {
/* some error occured */
len = 0;
ret = -1;
/* too large */
ret = -1;
} else {
ret = 0;
}
#ifndef HAVE_VSNPRINTF
#endif
t_pop();
return ret;
}
{
void *mem;
return NULL;
len++;
len++;
return mem;
}
{
return NULL;
}
{
char *mem;
return mem;
}
{
char *mem;
return NULL;
len = 0;
len++;
return mem;
}
{
char *ret;
return ret;
}
{
char *ret;
if (!pool->datastack_pool)
t_push();
#ifdef HAVE_VSNPRINTF
#else
#endif
if (!pool->datastack_pool)
t_pop();
return ret;
}
{
const char *str;
char *temp;
return NULL;
i = 0;
do {
/* need more memory */
}
/* next string */
temp[i++] = '\0';
*ret_len = i;
return temp;
}
{
const char *temp;
char *ret;
else {
}
return ret;
}
{
}
char *t_strdup_noconst(const char *str)
{
}
const char *t_strdup_empty(const char *str)
{
}
{
}
{
}
const char *t_strdup_printf(const char *format, ...)
{
const char *ret;
return ret;
}
{
}
const char *t_strconcat(const char *str1, ...)
{
const char *ret;
return ret;
}
{
const char *p;
for (p = str; *p != '\0'; p++) {
if (*p == cutchar)
return t_strdup_until(str, p);
}
return str;
}
{
return FALSE;
return FALSE;
str++;
}
return TRUE;
}
{
if (dstsize == 0)
return -1;
dstsize--;
}
*dest++ = '\0';
}
{
if (dstsize > 0)
*dest = '\0';
return -1;
}
return 0;
}
const char *file_prefix, const char *file)
{
if (dstsize > 0)
*dest = '\0';
return -1;
}
return 0;
}
{
char *p;
for (p = str; *p != '\0'; p++)
*p = i_toupper(*p);
return str;
}
{
char *p;
for (p = str; *p != '\0'; p++)
*p = i_tolower(*p);
return str;
}
const char *t_str_lcase(const char *str)
{
}
const char *t_str_ucase(const char *str)
{
}
{
return 1;
}
{
int ret;
while (size > 0) {
if (ret != 0)
return ret;
}
return 0;
}
{
}
{
}
int spaces)
{
const char **array;
char *str;
if (spaces)
if (*data == '\0')
return t_new(const char *, 1);
alloc_len = 32;
while (*str != '\0') {
/* separator found */
sizeof(const char *) *
}
*str = '\0';
else {
*str = '\0';
}
}
str++;
}
return array;
}
{
}
{
}
unsigned int strarray_length(const char *const *arr)
{
unsigned int count;
return 0;
count++;
return count;
}
{
char *str;
alloc_len = 64;
if (needed_space < alloc_len) {
}
if (pos != 0) {
}
}
return str;
}
{
char *buffer;
int pos;
do {
number /= 10;
}