Defines | |
#define | FALSE 0 |
#define | TRUE 1 |
Typedefs | |
typedef unsigned char | byte |
Functions | |
char * | safestrncpy (char *dest, const char *src, size_t n) |
sanitize strncopy. | |
int | num_tokens (char *source, char tok) |
discover number of parameters/tokens in a string | |
void | extract_token (char *dest, const char *source, int parmnum, char separator, int maxlen) |
void | remove_token (char *source, int parmnum, char separator) |
a tokenizer that kills, maims, and destroys | |
int | extract_int (const char *source, int parmnum) |
extract an int parm w/o supplying a buffer | |
long | extract_long (const char *source, int parmnum) |
extract an long parm w/o supplying a buffer | |
int | haschar (char *st, char ch) |
check for the presence of a character within a string (returns count) | |
char * | memreadline (char *start, char *buf, int maxlen) |
Utility function to "readline" from memory. | |
int | pattern2 (char *search, char *patn) |
searches for a paternn within asearch string | |
void | striplt (char *buf) |
Strip leading and trailing spaces from a string. | |
int | is_msg_in_mset (char *mset, long msgnum) |
Determine whether the specified message number is contained within the specified set. | |
void | stripout (char *str, char leftboundary, char rightboundary) |
Strip a boundarized substring out of a string (for example, remove parentheses and anything inside them). | |
void | sleeeeeeeeeep (int seconds) |
Replacement for sleep() that uses select() in order to avoid SIGALRM. | |
void | CtdlEncodeBase64 (char *dest, const char *source, size_t sourcelen, int linebreaks) |
encode a string into base64 to for example tunnel it through mail transport CtdlDecodeBase64() and CtdlEncodeBase64() are adaptations of code by John Walker, copied over from the Citadel server. | |
int | CtdlDecodeBase64 (char *dest, const char *source, size_t length) |
Convert base64-encoded to binary. It will stop after reading 'length' bytes. | |
void | generate_uuid (char *buf) |
Generate a new, globally unique UID parameter for a calendar etc. object. | |
void | CtdlMakeTempFileName (char *name, int len) |
Local replacement for controversial C library function that generates names for temporary files. Included to shut up compiler warnings. | |
char * | bmstrcasestr (char *text, char *pattern) |
char* safestrncpy | ( | char * | dest, | |
const char * | src, | |||
size_t | n | |||
) |
sanitize strncopy.
dest | destination string | |
src | source string | |
n | length of source to copy |
Definition at line 28 of file tools.c.
Referenced by addurls(), become_logged_in(), cal_process_object(), change_start_page(), changepw(), context_loop(), create_user(), ctdl_iconv_open(), delete_user(), display_addressbook(), display_changepw(), display_edit(), display_edituser(), display_enter(), display_note(), display_rss(), display_wiki_page(), do_edit_vcard(), do_logout(), do_welcome(), edituser(), embed_room_banner(), extract_charset_from_meta(), fetch_ab_name(), get_serv_info(), gotonext(), httplang_to_locale(), ig_uds_server(), load_msg_ptrs(), locate_host(), main(), output_headers(), output_html(), output_static(), page_user(), parse_fields_from_rule_editor(), pullquote_message(), read_message(), readinfo(), req_gets(), rfc2047encode(), save_edit(), session_loop(), set_floordiv_expanded(), set_preferences(), siteconfig(), submit_vcard(), svprintf(), the_mime_parser(), upload_handler(), utf8ify_rfc822_string(), validate(), vcard_fn_to_n(), and vcard_serialize().
int num_tokens | ( | char * | source, | |
char | tok | |||
) |
discover number of parameters/tokens in a string
source | string to inspect | |
tok | seperation token |
Definition at line 46 of file tools.c.
Referenced by chat_recv(), display_customize_iconbar(), display_editroom(), display_inetconf(), display_parsed_vcard(), do_folder_view(), do_iconbar(), do_iconbar_roomlist(), do_iconbar_view(), do_rooms_view(), get_preference(), httplang_to_locale(), is_msg_in_mset(), lastfirst_firstlast(), netedit(), new_messages_section(), post_message(), read_message(), remove_charset_attribute(), save_individual_event(), session_loop(), set_preference(), submit_vcard(), and vcard_fn_to_n().
void extract_token | ( | char * | dest, | |
const char * | source, | |||
int | parmnum, | |||
char | separator, | |||
int | maxlen | |||
) |
brief a string tokenizer
dest | destination string | |
source | the string to grab tokens from | |
parmnum | the n'th token to grab | |
separator | the tokenizer string | |
maxlen | the length of dest |
Definition at line 68 of file tools.c.
Referenced by become_logged_in(), cal_process_object(), chat_recv(), confirm_move_msg(), context_loop(), cookie_to_stuff(), delete_node(), display_add_remove_scripts(), display_addressbook(), display_customize_iconbar(), display_edit_node(), display_editroom(), display_edituser(), display_floorconfig(), display_inetconf(), display_netconf(), display_parsed_vcard(), display_queue_msg(), display_rules_editor_inner_div(), display_sieve(), display_using_handler(), display_whok(), do_edit_vcard(), do_folder_view(), do_freebusy(), do_iconbar(), do_iconbar_roomlist(), do_iconbar_view(), do_invt_kick(), do_listsub(), do_rooms_view(), edit_node(), editroom(), er_set_default_view(), extract_int(), extract_long(), fetch_ab_name(), get_preference(), gotonext(), gotoroom(), httplang_to_locale(), is_msg_in_mset(), lastfirst_firstlast(), list_all_rooms_by_floor(), listrms(), load_floorlist(), load_mimepart(), load_msg_ptrs(), locate_user_vcard(), mimepart(), netedit(), new_messages_section(), pullquote_message(), read_message(), recp_autocomplete(), remove_charset_attribute(), save_individual_event(), save_inetconf(), save_sieve(), select_user_to_edit(), self_service(), session_loop(), set_preference(), submit_vcard(), userlist(), utf8ify_rfc822_string(), vcard_fn_to_n(), who_inner_div(), and wholist_section().
void remove_token | ( | char * | source, | |
int | parmnum, | |||
char | separator | |||
) |
a tokenizer that kills, maims, and destroys
source | the string to process | |
parmnum | which token to kill | |
separator | the tokenizer string |
Definition at line 106 of file tools.c.
Referenced by context_loop(), display_editroom(), display_parsed_vcard(), display_rules_editor_inner_div(), lastfirst_firstlast(), post_message(), remove_charset_attribute(), session_loop(), utf8ify_rfc822_string(), and vcard_fn_to_n().
int extract_int | ( | const char * | source, | |
int | parmnum | |||
) |
extract an int parm w/o supplying a buffer
source | the string to locate the int in | |
parmnum | the n'th token to grab the int from |
Definition at line 151 of file tools.c.
References extract_token().
Referenced by become_logged_in(), cal_process_object(), cookie_to_stuff(), display_add_remove_scripts(), display_addressbook(), display_editroom(), display_edituser(), display_floorconfig(), display_rules_editor_inner_div(), display_sieve(), display_siteconfig(), display_using_handler(), do_listsub(), editroom(), embed_room_banner(), er_set_default_view(), fetch_ab_name(), gotonext(), gotoroom(), list_all_rooms_by_floor(), listrms(), load_floorlist(), new_messages_section(), pullquote_message(), read_message(), save_sieve(), self_service(), userlist(), and who_inner_div().
long extract_long | ( | const char * | source, | |
int | parmnum | |||
) |
extract an long parm w/o supplying a buffer
source | string to examine | |
parmnum | n'th token to search long in |
Definition at line 165 of file tools.c.
References extract_token().
Referenced by display_edituser(), display_queue_msg(), gotoroom(), load_mimepart(), load_msg_ptrs(), mimepart(), output_image(), userlist(), and who_inner_div().
int haschar | ( | char * | st, | |
char | ch | |||
) |
char* memreadline | ( | char * | start, | |
char * | buf, | |||
int | maxlen | |||
) |
Utility function to "readline" from memory.
start | Location in memory from which we are reading. | |
buf | the buffer to place the string in. | |
maxlen | Size of string buffer |
< tally our own length to avoid strlen() delays
Definition at line 202 of file tools.c.
Referenced by the_mime_parser().
int pattern2 | ( | char * | search, | |
char * | patn | |||
) |
searches for a paternn within asearch string
search | the string to search | |
patn | the pattern to find in string |
Definition at line 232 of file tools.c.
Referenced by vcard_load().
void striplt | ( | char * | buf | ) |
Strip leading and trailing spaces from a string.
buf | the string to modify |
Definition at line 247 of file tools.c.
Referenced by cal_process_object(), check_attendee_availability(), display_edit_individual_event(), extract_charset_from_meta(), fetch_ab_name(), netedit(), output_html(), read_message(), remove_charset_attribute(), save_individual_event(), save_sieve(), session_loop(), the_mime_parser(), and vcard_fn_to_n().
int is_msg_in_mset | ( | char * | mset, | |
long | msgnum | |||
) |
Determine whether the specified message number is contained within the specified set.
mset | Message set string | |
msgnum | Message number we are looking for |
Definition at line 267 of file tools.c.
References extract_token(), num_tokens(), and snprintf().
Referenced by readloop().
void stripout | ( | char * | str, | |
char | leftboundary, | |||
char | rightboundary | |||
) |
Strip a boundarized substring out of a string (for example, remove parentheses and anything inside them).
This improved version can strip out *multiple* boundarized substrings.
str | the string to process | |
leftboundary | the boundary character on the left side of the target string | |
rightboundary | the boundary character on the right side of the target string |
Definition at line 311 of file tools.c.
Referenced by save_individual_event().
void sleeeeeeeeeep | ( | int | seconds | ) |
Replacement for sleep() that uses select() in order to avoid SIGALRM.
seconds | how many seconds should we sleep? |
Definition at line 342 of file tools.c.
Referenced by housekeeping_loop().
void CtdlEncodeBase64 | ( | char * | dest, | |
const char * | source, | |||
size_t | sourcelen, | |||
int | linebreaks | |||
) |
encode a string into base64 to for example tunnel it through mail transport CtdlDecodeBase64() and CtdlEncodeBase64() are adaptations of code by John Walker, copied over from the Citadel server.
dest | encrypted string | |
source | the string to encrypt | |
sourcelen | the length of the source data (may contain string terminators) |
Fill dtable with character encodings.
Replace characters in output stream with "=" pad characters if fewer than three characters were read from the end of the input stream.
Definition at line 362 of file tools.c.
Referenced by parse_fields_from_rule_editor(), and post_mime_to_server().
int CtdlDecodeBase64 | ( | char * | dest, | |
const char * | source, | |||
size_t | length | |||
) |
Convert base64-encoded to binary. It will stop after reading 'length' bytes.
dest | The destination buffer | |
source | The base64 data to be decoded. | |
length | The number of bytes to decode. |
CONSTANTCONDITION
Ignoring errors: discard invalid character
Definition at line 447 of file tools.c.
References TRUE.
Referenced by context_loop(), display_parsed_vcard(), display_rules_editor_inner_div(), mime_decode(), session_loop(), and utf8ify_rfc822_string().
void generate_uuid | ( | char * | buf | ) |
Generate a new, globally unique UID parameter for a calendar etc. object.
buf | String buffer into which our newly created UUID should be placed |
Definition at line 516 of file tools.c.
Referenced by save_individual_event(), and save_individual_task().
void CtdlMakeTempFileName | ( | char * | name, | |
int | len | |||
) |
Local replacement for controversial C library function that generates names for temporary files. Included to shut up compiler warnings.
name | the created filename | |
len | the length of the filename |
Definition at line 535 of file tools.c.
References snprintf().