2 ashd - A Sane HTTP Daemon
3 Copyright (C) 2008 Fredrik Tolf <fredrik@dolda2000.com>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 void _sizebuf(struct buffer *buf, size_t wanted, size_t el)
39 buf->b = srealloc(buf->b, n * el);
41 buf->b = smalloc(n * el);
45 char *decstr(char **p, size_t *len)
49 for(p2 = *p; (p2 - *p) < *len; p2++) {
62 char *vsprintf2(char *format, va_list al)
69 ret = vsnprintf(NULL, 0, format, al2);
71 buf = smalloc(ret + 1);
73 vsnprintf(buf, ret + 1, format, al2);
78 char *sprintf2(char *format, ...)
83 va_start(args, format);
84 buf = vsprintf2(format, args);
89 char *sprintf3(char *format, ...)
91 static char *buf = NULL;
96 va_start(args, format);
97 buf = vsprintf2(format, args);
104 return((off_t)strtoll(n, NULL, 10));