dillo
3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java). Fossies Dox: dillo-3.0.5.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 33 #define DLIB_MSG(...) \ 36 fprintf(stderr, __VA_ARGS__); \ 45 void *value = malloc (size);
53 void *value = realloc (mem, size);
62 memset (value, 0, size);
78 int len = strlen(s)+1;
79 char *ns =
dNew(
char, len);
89 char *ns =
dNew(
char, sz+1);
108 for (s = (
char*)s1; s; s = va_arg(args,
char*))
127 for (len = strlen(p); len &&
dIsspace(p[len-1]); --len);
141 memset(s, 0, strlen(s));
149 char *ret =
dNew(
char, len+1);
150 for (ret[len] = 0; len > 0; ret[--len] = c);
164 p = strpbrk(str, delim);
187 if (haystack && needle) {
188 for (i = 0, j = 0; haystack[i] && needle[j]; ++i)
196 ret = (
char *)(haystack + i - j);
205 while ((*s1 || *s2) &&
217 while (n-- && (*s1 || *s2) &&
235 if (keep && n_sz > ds->
len) {
280 if (ds && s && l && pos_0 >= 0 && pos_0 <= ds->len) {
281 for (n_sz = ds->
sz; ds->
len + l >= n_sz; n_sz *= 2);
286 memmove(ds->
str+pos_0+l, ds->
str+pos_0, ds->
len-pos_0);
287 memcpy(ds->
str+pos_0, s, l);
352 if (ds->
sz > ds->
len + 1) {
368 if (ds && len < ds->len) {
379 if (ds && ds->
sz > 0)
380 memset(ds->
str,
'\0', ds->
sz);
388 if (ds && pos_0 >= 0 && len > 0 && pos_0 + len <= ds->len) {
389 memmove(ds->
str + pos_0, ds->
str + pos_0 + len, ds->
len - pos_0 - len);
406 va_copy(argp2, argp);
407 n = vsnprintf(ds->
str + ds->
len, ds->
sz - ds->
len, format, argp2);
413 if (n > -1 && n + 1 < ds->
sz - ds->
len) {
420 if (n > -1 && n < ds->sz - ds->
len) {
424 n_sz = ds->
len + n + 1;
453 va_start(argp, format);
467 va_start(argp, format);
492 if (needle && haystack) {
493 if (needle->
len == 0)
494 return haystack->
str;
496 for (i = 0; i <= (haystack->
len - needle->
len); i++) {
497 if (haystack->
str[i] == needle->
str[0] &&
498 !memcmp(haystack->
str + i, needle->
str, needle->
len))
499 return haystack->
str + i;
514 static const char *
const HEX =
"0123456789ABCDEF";
515 static Dstr *out = NULL;
525 for (i = 0; (i < in->
len) && (out->
len < maxlen); ++i) {
526 if (isprint(in->
str[i]) || (in->
str[i] ==
'\n')) {
534 if (out->
len >= maxlen)
578 if (!lp || pos0 < 0 || pos0 > lp->
len)
581 if (lp->
sz == lp->
len) {
587 for (i = lp->
len - 1; i > pos0; --i)
589 lp->
list[pos0] = data;
628 for (i = 0; i < lp->
len; ++i) {
629 if (lp->
list[i] == data) {
646 for (i = 0; i < lp->
len; ++i) {
647 if (lp->
list[i] == data) {
649 for (j = i; j < lp->
len; ++j)
662 if (!lp || n0 < 0 || n0 >= lp->
len)
673 return (i >= 0) ? lp->
list[i] : NULL;
688 for (i = 0; i < lp->
len; ++i) {
689 if (lp->
list[i] == data) {
710 for (i = 0; i < lp->
len; ++i) {
711 if (func(lp->
list[i], data) == 0) {
725 void **p = left, **q = right, **t = left;
728 while (p != t && compare(*p, *t) < 0)
730 while (q != t && compare(*q, *t) > 0)
758 if (lp && lp->
len > 1) {
776 st = func(lp->
list[i], data);
804 st = func(lp->
list[i], data);
842 if (!*line[0] || *line[0] ==
'#') {
845 }
else if ((eq = strchr(*line,
'='))) {
847 for (p = *line; *p && *p !=
'=' && !
dIsspace(*p); ++p);
859 if (len >= 2 && *p ==
'"' && p[len-1] ==
'"') {
891 char *buffer =
dNew(
char, size);
892 if (getcwd (buffer, size) == buffer)
906 static char *homedir = NULL;
909 if (getenv(
"HOME")) {
910 homedir =
dStrdup(getenv(
"HOME"));
912 }
else if (getenv(
"HOMEDRIVE") && getenv(
"HOMEPATH")) {
913 homedir =
dStrconcat(getenv(
"HOMEDRIVE"), getenv(
"HOMEPATH"), NULL);
915 DLIB_MSG(
"dGethomedir: $HOME not set, using '/'.\n");
935 while ((ch = fgetc(stream)) != EOF) {
941 line = (dstr->
len) ? dstr->
str : NULL;
955 while (st == -1 && errno == EINTR);
void dStr_free(Dstr *ds, int all)
int dStr_cmp(Dstr *ds1, Dstr *ds2)
void dStr_append_l(Dstr *ds, const char *s, int l)
void dList_prepend(Dlist *lp, void *data)
void * dList_find_sorted(Dlist *lp, const void *data, dCompareFunc func)
void dStr_append_c(Dstr *ds, int c)
#define dReturn_val_if_fail(expr, val)
int dParser_parse_rc_line(char **line, char **name, char **value)
void dStr_truncate(Dstr *ds, int len)
void dStr_vsprintfa(Dstr *ds, const char *format, va_list argp)
int dList_length(Dlist *lp)
char * dStrconcat(const char *s1,...)
static void QuickSort(void **left, void **right, dCompareFunc compare)
void dStr_insert_l(Dstr *ds, int pos_0, const char *s, int l)
static bool_t dLib_show_msg
char * dStrnfill(size_t len, char c)
#define D_ASCII_TOLOWER(c)
void dList_sort(Dlist *lp, dCompareFunc func)
void * dList_nth_data(Dlist *lp, int n0)
void * dList_find_custom(Dlist *lp, const void *data, dCompareFunc func)
#define dNew(type, count)
char * dStrndup(const char *s, size_t sz)
char * dStriAsciiStr(const char *haystack, const char *needle)
int dList_find_idx(Dlist *lp, const void *data)
void dStr_insert(Dstr *ds, int pos_0, const char *s)
Dstr * dStr_new(const char *s)
void dStr_shred(Dstr *ds)
int dStrAsciiCasecmp(const char *s1, const char *s2)
void dLib_show_messages(bool_t show)
void dStr_erase(Dstr *ds, int pos_0, int len)
void * dRealloc(void *mem, size_t size)
void dStr_vsprintf(Dstr *ds, const char *format, va_list argp)
void * dMalloc0(size_t size)
static void dStr_resize(Dstr *ds, int n_sz, int keep)
Dstr * dStr_sized_new(int sz)
char * dGetline(FILE *stream)
void dList_insert_sorted(Dlist *lp, void *data, dCompareFunc func)
void dList_insert_pos(Dlist *lp, void *data, int pos0)
void dStr_append(Dstr *ds, const char *s)
void dList_append(Dlist *lp, void *data)
void dStr_sprintf(Dstr *ds, const char *format,...)
void * dMalloc(size_t size)
void dList_free(Dlist *lp)
Dlist * dList_new(int size)
void dList_remove(Dlist *lp, const void *data)
const char * dStr_printable(Dstr *in, int maxlen)
char * dStrdup(const char *s)
void dList_remove_fast(Dlist *lp, const void *data)
int(* dCompareFunc)(const void *a, const void *b)
char * dStrsep(char **orig, const char *delim)
void dStr_sprintfa(Dstr *ds, const char *format,...)
int dStrnAsciiCasecmp(const char *s1, const char *s2, size_t n)
void * dList_find(Dlist *lp, const void *data)
char * dStrstrip(char *s)
char * dStr_memmem(Dstr *haystack, Dstr *needle)