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)  

dlib.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include "dlib.h"
Include dependency graph for dlib.c:

Go to the source code of this file.

Macros

#define DLIB_MSG(...)
 

Functions

void * dMalloc (size_t size)
 
void * dRealloc (void *mem, size_t size)
 
void * dMalloc0 (size_t size)
 
void dFree (void *mem)
 
char * dStrdup (const char *s)
 
char * dStrndup (const char *s, size_t sz)
 
char * dStrconcat (const char *s1,...)
 
char * dStrstrip (char *s)
 
void dStrshred (char *s)
 
char * dStrnfill (size_t len, char c)
 
char * dStrsep (char **orig, const char *delim)
 
char * dStriAsciiStr (const char *haystack, const char *needle)
 
int dStrAsciiCasecmp (const char *s1, const char *s2)
 
int dStrnAsciiCasecmp (const char *s1, const char *s2, size_t n)
 
static void dStr_resize (Dstr *ds, int n_sz, int keep)
 
DstrdStr_sized_new (int sz)
 
void dStr_fit (Dstr *ds)
 
void dStr_insert_l (Dstr *ds, int pos_0, const char *s, int l)
 
void dStr_insert (Dstr *ds, int pos_0, const char *s)
 
void dStr_append_l (Dstr *ds, const char *s, int l)
 
void dStr_append (Dstr *ds, const char *s)
 
DstrdStr_new (const char *s)
 
void dStr_free (Dstr *ds, int all)
 
void dStr_append_c (Dstr *ds, int c)
 
void dStr_truncate (Dstr *ds, int len)
 
void dStr_shred (Dstr *ds)
 
void dStr_erase (Dstr *ds, int pos_0, int len)
 
void dStr_vsprintfa (Dstr *ds, const char *format, va_list argp)
 
void dStr_vsprintf (Dstr *ds, const char *format, va_list argp)
 
void dStr_sprintf (Dstr *ds, const char *format,...)
 
void dStr_sprintfa (Dstr *ds, const char *format,...)
 
int dStr_cmp (Dstr *ds1, Dstr *ds2)
 
char * dStr_memmem (Dstr *haystack, Dstr *needle)
 
const char * dStr_printable (Dstr *in, int maxlen)
 
DlistdList_new (int size)
 
void dList_free (Dlist *lp)
 
void dList_insert_pos (Dlist *lp, void *data, int pos0)
 
void dList_append (Dlist *lp, void *data)
 
void dList_prepend (Dlist *lp, void *data)
 
int dList_length (Dlist *lp)
 
void dList_remove_fast (Dlist *lp, const void *data)
 
void dList_remove (Dlist *lp, const void *data)
 
void * dList_nth_data (Dlist *lp, int n0)
 
void * dList_find (Dlist *lp, const void *data)
 
int dList_find_idx (Dlist *lp, const void *data)
 
void * dList_find_custom (Dlist *lp, const void *data, dCompareFunc func)
 
static void QuickSort (void **left, void **right, dCompareFunc compare)
 
void dList_sort (Dlist *lp, dCompareFunc func)
 
void dList_insert_sorted (Dlist *lp, void *data, dCompareFunc func)
 
void * dList_find_sorted (Dlist *lp, const void *data, dCompareFunc func)
 
int dParser_parse_rc_line (char **line, char **name, char **value)
 
void dLib_show_messages (bool_t show)
 
char * dGetcwd ()
 
char * dGethomedir ()
 
char * dGetline (FILE *stream)
 
int dClose (int fd)
 

Variables

static bool_t dLib_show_msg = (! (0) )
 

Macro Definition Documentation

◆ DLIB_MSG

#define DLIB_MSG (   ...)
Value:
fprintf(stderr, __VA_ARGS__); \

Definition at line 33 of file dlib.c.

Function Documentation

◆ dClose()

◆ dFree()

void dFree ( void *  mem)

Definition at line 66 of file dlib.c.

Referenced by a_Bitvec_free(), a_Bookmarks_add(), a_Bookmarks_chat_add(), a_Bw_free(), a_Cache_process_dbuf(), a_Cache_set_content_type(), a_Capi_ccc(), a_Capi_dpi_send_data(), a_Capi_open_url(), a_Cookies_get_query(), a_Cookies_set(), a_Decode_free(), a_Dialog_input(), a_Dicache_close(), a_Dicache_freeall(), a_Dicache_set_cmap(), a_Dns_freeall(), a_Domain_freeall(), a_Domain_parse(), a_Dpi_ccc(), a_Dpi_rd_dpi_socket_dir(), a_Dpi_srs(), a_Dpiapi_dialog(), a_Dpip_check_auth(), a_Dpip_dsh_free(), a_History_freeall(), a_History_set_title_by_url(), a_Html_common_image_attrs(), a_Html_image_new(), a_Html_load_stylesheet(), a_Http_ccc(), a_Http_freeall(), a_Http_make_connect_str(), a_Http_make_query_str(), a_Http_set_proxy_passwd(), a_IO_ccc(), a_Klist_free(), a_Klist_remove(), a_Menu_history_popup(), a_Menu_page_popup(), a_Misc_content_type_cmp(), a_Nav_expect_done(), a_Nav_free(), a_Prefs_freeall(), a_UIcmd_get_passwd(), a_UIcmd_open_file(), a_UIcmd_open_urlstr(), a_UIcmd_search_dialog(), a_UIcmd_view_page_source(), a_Url_free(), a_Url_new(), a_Url_set_alt(), a_Web_free(), Auth_do_auth_dialog(), Auth_do_auth_dialog_cb(), Auth_do_auth_required(), Auth_parse_free(), Auth_realm_add_path(), Auth_realm_delete(), Bms_check_import(), Bms_del(), Bms_load(), Bms_save(), Bms_sec_del(), Bms_update_sec_title(), Bms_update_title(), Bmsrv_add_bm(), Bmsrv_dpi_send_status_msg(), Bmsrv_modify_add_section(), Bmsrv_modify_add_url(), Bmsrv_modify_update(), Bmsrv_parse_token(), Bmsrv_send_modify_answer(), Bmsrv_send_modify_page(), Bmsrv_send_modify_update(), Bmsrv_send_reload_request(), DilloHtmlForm::buildQueryData(), DilloHtmlForm::buildQueryUrl(), StyleEngine::buildUserStyle(), Cache_auth_callback(), Cache_auth_free(), Cache_client_dequeue(), Cache_entry_free(), Cache_parse_header(), Cache_provide_redirection_blocked_page(), Cache_savelink_cb(), Capi_conn_resume(), Capi_conn_unref(), Capi_dpi_build_cmd(), Capi_dpi_send_source(), Capi_url_uses_dpi(), UI::change_panel(), cleanup(), Cookie_control_init(), Cookies_delete_node(), Cookies_free_cookie(), Cookies_get(), Cookies_init(), Cookies_parse(), Cookies_parse_date(), Cookies_server_timediff(), Cookies_validate_path(), Decode_charset_free(), Decode_chunked_free(), Decode_compression_free(), Decode_deflate(), Keys::delKeyCmd(), dGetcwd(), Dicache_remove(), dList_free(), Dns_queue_remove(), Dns_server_req(), Dpi_conn_free(), Dpi_connect_socket(), Dpi_get_server_port(), Dpi_parse_token(), Dpi_read_comm_keys(), Dpi_start_dpid(), Dpiapi_dialog_answer_cb(), dStr_free(), dStr_resize(), DilloHtmlForm::encodeText(), File_dillodir_free(), File_dillodir_new(), File_info2html(), File_normalize_path(), File_print_parent_dir(), File_remove_client(), File_send_dir(), File_send_error_page(), File_send_file(), File_serve_client(), File_toggle_html_style(), fill_services_list(), Paths::free(), Keys::free(), CssProperty::free(), free_dpi_attr(), free_plugin_list(), free_services_list(), DilloHtml::freeParseData(), get_command(), get_dpi_attr(), get_dpi_dir(), get_message(), Paths::getPrefsFP(), help_cb(), Html_parse_doctype(), Html_parse_entity(), Html_process_space(), Html_process_word(), Html_tag_content_frame(), Html_tag_content_map(), Html_tag_content_textarea(), Html_tag_open_a(), Html_tag_open_button(), Html_tag_open_font(), Html_tag_open_form(), Html_tag_open_hr(), Html_tag_open_input(), Html_tag_open_meta(), Html_tag_open_select(), Html_write_raw(), Http_connect_queued_sockets(), Http_dns_cb(), Http_get(), Http_host_connection_remove(), Http_must_use_proxy(), Http_send_query(), Http_socket_dequeue(), Http_socket_free(), Image_free(), CustTabs::increase_focus_counter(), Paths::init(), init_sockdir(), IO_free(), main(), make_wget_argv(), makeStartUrl(), mk_sockdir(), Nav_stack_clean(), Nav_stack_truncate(), no_ssl_support(), Keys::parse(), CssParser::parseImport(), Keys::parseKey(), parseOption(), read_req_cb(), register_all(), register_service(), save_comm_keys(), send_bm_page(), send_decoded_data(), send_failure_message(), send_html_text(), send_numbered_text(), send_plain_text(), send_sockport(), srv_parse_tok(), stop_active_dpis(), DilloHtmlForm::strUrlencodeAppend(), try_ftp_transfer(), tst_dir(), UIcmd_make_save_filename(), UIcmd_make_search_str(), UIcmd_save(), DilloHtml::write(), CssSimpleSelector::~CssSimpleSelector(), DilloHtml::~DilloHtml(), DilloHtmlForm::~DilloHtmlForm(), DilloHtmlInput::~DilloHtmlInput(), DilloHtmlOptgroup::~DilloHtmlOptgroup(), DilloHtmlOption::~DilloHtmlOption(), DLItem::~DLItem(), and DoctreeNode::~DoctreeNode().

◆ dGetcwd()

char* dGetcwd ( )

Definition at line 886 of file dlib.c.

References dFree(), and dNew.

Referenced by Paths::init().

◆ dGethomedir()

◆ dGetline()

◆ dLib_show_messages()

void dLib_show_messages ( bool_t  show)

Definition at line 874 of file dlib.c.

References dLib_show_msg.

Referenced by main().

◆ dList_append()

◆ dList_find()

void* dList_find ( Dlist lp,
const void *  data 
)

◆ dList_find_custom()

◆ dList_find_idx()

int dList_find_idx ( Dlist lp,
const void *  data 
)

Definition at line 681 of file dlib.c.

References Dlist::len, and Dlist::list.

Referenced by dList_find().

◆ dList_find_sorted()

◆ dList_free()

◆ dList_insert_pos()

void dList_insert_pos ( Dlist lp,
void *  data,
int  pos0 
)

◆ dList_insert_sorted()

void dList_insert_sorted ( Dlist lp,
void *  data,
dCompareFunc  func 
)

◆ dList_length()

◆ dList_new()

◆ dList_nth_data()

◆ dList_prepend()

void dList_prepend ( Dlist lp,
void *  data 
)

Definition at line 603 of file dlib.c.

References dList_insert_pos().

◆ dList_remove()

◆ dList_remove_fast()

◆ dList_sort()

void dList_sort ( Dlist lp,
dCompareFunc  func 
)

Definition at line 756 of file dlib.c.

References Dlist::len, Dlist::list, and QuickSort().

Referenced by File_dillodir_new(), and fill_services_list().

◆ dMalloc()

void* dMalloc ( size_t  size)

Definition at line 43 of file dlib.c.

Referenced by a_Misc_encode_base64(), a_Misc_readtag(), and dMalloc0().

◆ dMalloc0()

void* dMalloc0 ( size_t  size)

Definition at line 59 of file dlib.c.

References dMalloc().

◆ dParser_parse_rc_line()

int dParser_parse_rc_line ( char **  line,
char **  name,
char **  value 
)

Definition at line 832 of file dlib.c.

References dIsspace, dReturn_val_if_fail, and dStrstrip().

Referenced by fill_services_list(), and Keys::parse().

◆ dRealloc()

void* dRealloc ( void *  mem,
size_t  size 
)

◆ dStr_append()

◆ dStr_append_c()

◆ dStr_append_l()

◆ dStr_cmp()

int dStr_cmp ( Dstr ds1,
Dstr ds2 
)

Definition at line 476 of file dlib.c.

References Dstr::len, MIN, and Dstr::str.

Referenced by a_Url_cmp().

◆ dStr_erase()

◆ dStr_fit()

void dStr_fit ( Dstr ds)

Definition at line 267 of file dlib.c.

References dStr_resize(), and Dstr::len.

Referenced by a_Cache_process_dbuf(), Cache_entry_inject(), and Cache_get_header().

◆ dStr_free()

◆ dStr_insert()

void dStr_insert ( Dstr ds,
int  pos_0,
const char *  s 
)

Definition at line 296 of file dlib.c.

References dStr_insert_l().

◆ dStr_insert_l()

void dStr_insert_l ( Dstr ds,
int  pos_0,
const char *  s,
int  l 
)

Definition at line 276 of file dlib.c.

References dStr_resize(), Dstr::len, Dstr::str, and Dstr::sz.

Referenced by dStr_append_l(), and dStr_insert().

◆ dStr_memmem()

char* dStr_memmem ( Dstr haystack,
Dstr needle 
)

Definition at line 488 of file dlib.c.

References Dstr::len, and Dstr::str.

Referenced by DilloHtmlForm::makeMultipartBoundary().

◆ dStr_new()

◆ dStr_printable()

const char* dStr_printable ( Dstr in,
int  maxlen 
)

◆ dStr_resize()

static void dStr_resize ( Dstr ds,
int  n_sz,
int  keep 
)
static

Definition at line 232 of file dlib.c.

References dFree(), dNew, dRealloc(), Dstr_char_t, Dstr::len, Dstr::str, and Dstr::sz.

Referenced by dStr_fit(), dStr_insert_l(), dStr_sized_new(), and dStr_vsprintfa().

◆ dStr_shred()

void dStr_shred ( Dstr ds)

Definition at line 377 of file dlib.c.

References Dstr::str, and Dstr::sz.

Referenced by a_Digest_compute_digest().

◆ dStr_sized_new()

◆ dStr_sprintf()

◆ dStr_sprintfa()

◆ dStr_truncate()

◆ dStr_vsprintf()

void dStr_vsprintf ( Dstr ds,
const char *  format,
va_list  argp 
)

Definition at line 437 of file dlib.c.

References dStr_truncate(), and dStr_vsprintfa().

Referenced by a_UIcmd_set_msg(), and dStr_sprintf().

◆ dStr_vsprintfa()

void dStr_vsprintfa ( Dstr ds,
const char *  format,
va_list  argp 
)

Definition at line 399 of file dlib.c.

References dStr_resize(), Dstr::len, Dstr::str, and Dstr::sz.

Referenced by DilloHtml::bugMessage(), dStr_sprintfa(), and dStr_vsprintf().

◆ dStrAsciiCasecmp()

int dStrAsciiCasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 201 of file dlib.c.

References D_ASCII_TOLOWER.

Referenced by a_Cache_download_enabled(), a_Capi_dpi_verify_request(), a_Capi_open_url(), a_Color_parse(), a_Decode_charset_init(), a_Decode_content_init(), a_Decode_transfer_init(), a_Dns_resolve(), a_Domain_parse(), a_Domain_permit(), a_Html_image_new(), a_Html_tag_set_align_attr(), a_Html_tag_set_valign_attr(), a_Menu_page_popup(), a_Misc_content_type_cmp(), a_UIcmd_view_page_source(), a_Url_same_organization(), StyleEngine::apply(), Auth_host_by_url(), Auth_parse_basic_challenge_cb(), Auth_parse_digest_challenge_cb(), DilloHtmlForm::buildQueryData(), Cache_parse_header(), Cookie_control_init(), Cookies_control_check_domain(), Cookies_domain_matches(), Cookies_get(), Cookies_parse(), Css_property_info_cmp(), Css_shorthand_info_cmp(), datauri_get_mime(), Dns_assign_channels(), Dns_queue_find(), Domain_match(), Domain_node_by_domain_cmp(), Domain_node_cmp(), File_ext(), File_send_file(), DilloHtmlForm::filesInputMultipartAppend(), Keys::getCmdCode(), Keys::getKeyCode(), Keys::getModifier(), DilloHtmlForm::getRadioInput(), Html_get_radio_input(), Html_parse_doctype(), Html_tag_content_area(), Html_tag_open_button(), Html_tag_open_form(), Html_tag_open_input(), Html_tag_open_link(), Html_tag_open_meta(), Html_tag_open_style(), Html_tag_open_table(), Html_tag_open_ul(), Http_host_connection_get(), Http_must_use_proxy(), main(), CssSimpleSelector::match(), Nav_reload_callback(), CssParser::parse(), CssParser::parseImport(), CssParser::parseMedia(), parseOption(), CssParser::parseUrl(), CssParser::parseValue(), CssParser::parseWeight(), and CssParser::tokenMatchesProperty().

◆ dStrconcat()

◆ dStrdup()

char* dStrdup ( const char *  s)

Definition at line 75 of file dlib.c.

References dNew.

Referenced by a_Auth_get_auth_str(), a_Bookmarks_chat_add(), a_Cache_set_content_type(), a_Cookies_get_query(), a_Dialog_input(), a_Domain_parse(), a_History_set_title_by_url(), a_Html_get_attr_wdef(), a_Html_image_new(), a_Http_init(), a_Http_make_connect_str(), a_Menu_page_popup(), a_Nav_save_url(), a_Prefs_init(), a_UIcmd_get_location_text(), a_UIcmd_init(), a_Url_decode_hex_str(), a_Url_dup(), a_Url_set_alt(), a_Url_string_strip_delimiters(), Auth_do_auth_dialog_cb(), Auth_do_auth_required(), Auth_realm_add_path(), Bmsrv_modify_add_section(), Bmsrv_modify_add_url(), Bmsrv_modify_update(), Bmsrv_parse_token(), Bmsrv_send_modify_update(), DilloHtmlForm::buildQueryUrl(), Cache_process_queue(), Capi_conn_new(), Capi_url_uses_dpi(), UI::change_panel(), Cookie_control_init(), Cookies_add_cookie(), Cookies_get(), Cookies_load_cookies(), Cookies_validate_domain(), Cookies_validate_path(), CssPropertyList::CssPropertyList(), datauri_get_data(), datauri_get_mime(), dGethomedir(), DilloHtml::DilloHtml(), DilloHtmlForm::DilloHtmlForm(), DilloHtmlInput::DilloHtmlInput(), DLItem::DLItem(), Dns_cache_add(), Dns_queue_add(), Dns_server_req(), File_dillodir_new(), File_prepare_send_dir(), File_prepare_send_error_page(), File_prepare_send_file(), File_print_parent_dir(), fill_services_list(), get_dpi_attr(), get_dpi_dir(), Html_parse_entity(), Html_tag_content_frame(), Html_tag_content_textarea(), Html_tag_open_font(), Html_tag_open_form(), Html_tag_open_input(), Html_tag_open_meta(), Http_get(), Http_get_referer(), Http_host_connection_get(), Http_must_use_proxy(), Keys::init(), main(), makeStartUrl(), CssParser::parseImport(), Keys::parseKey(), parseOption(), CssParser::parseUrl(), CssParser::parseValue(), register_all(), register_service(), StyleEngine::setId(), StyleEngine::setNonCssHint(), CssSimpleSelector::setSelect(), UIcmd_save(), Unescape_html_str(), Unescape_uri_str(), and Url_object_new().

◆ dStriAsciiStr()

char* dStriAsciiStr ( const char *  haystack,
const char *  needle 
)

◆ dStrnAsciiCasecmp()

◆ dStrndup()

◆ dStrnfill()

char* dStrnfill ( size_t  len,
char  c 
)

Definition at line 147 of file dlib.c.

References dNew.

Referenced by Html_process_space().

◆ dStrsep()

char* dStrsep ( char **  orig,
const char *  delim 
)

Definition at line 157 of file dlib.c.

Referenced by Cookies_load_cookies(), Html_tag_open_form(), and Http_must_use_proxy().

◆ dStrshred()

void dStrshred ( char *  s)

Definition at line 138 of file dlib.c.

Referenced by Auth_do_auth_dialog_cb().

◆ dStrstrip()

◆ QuickSort()

static void QuickSort ( void **  left,
void **  right,
dCompareFunc  compare 
)
static

Definition at line 723 of file dlib.c.

Referenced by dList_sort().

Variable Documentation

◆ dLib_show_msg

bool_t dLib_show_msg = (! (0) )
static

Definition at line 30 of file dlib.c.

Referenced by dLib_show_messages().

D_STMT_START
#define D_STMT_START
Definition: dlib.h:62
dLib_show_msg
static bool_t dLib_show_msg
Definition: dlib.c:30
D_STMT_END
#define D_STMT_END
Definition: dlib.h:63