|
Dillo v3.2.0-151-g90488cbf
|
#include <stdio.h>#include <stdlib.h>#include <stddef.h>#include <string.h>#include <unistd.h>#include <errno.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/types.h>#include <sys/un.h>#include <time.h>#include <netdb.h>#include <fcntl.h>#include <signal.h>#include "../dpip/dpip.h"#include "dpiutil.h"
Go to the source code of this file.
Macros | |
| #define | _MSG(...) |
| #define | MSG(...) printf("[bookmarks dpi]: " __VA_ARGS__) |
| #define | DOCTYPE "<!DOCTYPE html>\n" |
| #define | CSS_STYLE |
| #define | modifypage_sections_header mainpage_sections_header |
| #define | modifypage_sections_footer mainpage_sections_footer |
| #define | modifypage_section_card_footer mainpage_section_card_footer |
Functions | |
| static char * | make_one_line_str (char *str) |
| static void | Unencode_str (char *e_str) |
| static int | Bmsrv_dpi_send_status_msg (Dsh *sh, char *str) |
| static int | Bms_node_by_key_cmp (const void *node, const void *key) |
| static int | Bms_node_by_section_cmp (const void *node, const void *key) |
| static int | Bms_sec_by_number_cmp (const void *node, const void *key) |
| static BmRec * | Bms_get (int key) |
| static BmSec * | Bms_get_sec (int key) |
| static void | Bms_add (int section, char *url, char *title) |
| static void | Bms_sec_add (char *title) |
| static void | Bms_del (int key) |
| static void | Bms_sec_del (int section) |
| static void | Bms_move (int key, int target_section) |
| static void | Bms_update_title (int key, char *n_title) |
| static void | Bms_update_sec_title (int key, char *n_title) |
| static void | Bms_free (void) |
| static void | Bms_normalize (void) |
| static void | Bms_check_import (void) |
| static int | Bms_load (void) |
| static int | Bms_cond_load (void) |
| static int | Bms_save (void) |
| static int | Bmsrv_add_bm (Dsh *sh, char *url, char *title) |
| static void | Bmsrv_count_urls_and_sections (char *url, int *n_sec, int *n_url) |
| static int | Bmsrv_send_reload_request (Dsh *sh, char *url) |
| static int | Bmsrv_send_modify_page (Dsh *sh) |
| static int | Bmsrv_send_modify_page_add_section (Dsh *sh) |
| static int | Bmsrv_send_modify_page_add_url (Dsh *sh) |
| static int | Bmsrv_send_modify_update (Dsh *sh, char *url) |
| static int | Bmsrv_send_modify_answer (Dsh *sh, char *url) |
| static int | Bmsrv_modify_delete (char *url) |
| static int | Bmsrv_modify_move (char *url) |
| static int | Bmsrv_modify_update (char *url) |
| static int | Bmsrv_modify_add_section (char *url) |
| static int | Bmsrv_modify_add_url (Dsh *sh, char *s_url) |
| static int | Bmsrv_check_modify_request (Dsh *sh, char *url) |
| static int | Bmsrv_process_modify_request (Dsh *sh, char *url) |
| static int | send_bm_page (Dsh *sh) |
| static int | Bmsrv_parse_token (Dsh *sh, char *Buf) |
| static void | cleanup (void) |
| static void | termination_handler (int signum) |
| int | main (void) |
Variables | |
| static char * | Header = "Content-type: text/html\n\n" |
| static char * | BmFile = NULL |
| static time_t | BmFileTimeStamp = 0 |
| static Dlist * | B_bms = NULL |
| static int | bm_key = 0 |
| static Dlist * | B_secs = NULL |
| static int | sec_key = 0 |
| static int | MODIFY_PAGE_NUM = 1 |
| static const char * | mainpage_header |
| static const char * | modifypage_header |
| static const char * | mainpage_sections_header |
| static const char * | mainpage_sections_item |
| static const char * | sections_sep |
| static const char * | modifypage_sections_item |
| static const char * | mainpage_sections_footer |
| static const char * | mainpage_middle1 = "\n" |
| static const char * | modifypage_middle1 = "\n" |
| static const char * | mainpage_section_card_header |
| static const char * | modifypage_section_card_header |
| static const char * | mainpage_section_card_item |
| static const char * | modifypage_section_card_item |
| static const char * | mainpage_section_card_footer |
| static const char * | mainpage_footer |
| static const char * | modifypage_footer |
| static const char * | modifypage_add_section_page |
| static const char * | modifypage_update_header |
| static const char * | modifypage_update_title |
| static const char * | modifypage_update_item_header |
| static const char * | modifypage_update_item |
| static const char * | modifypage_update_item2 |
| static const char * | modifypage_update_item_footer |
| static const char * | modifypage_update_footer |
| static const char * | modifypage_add_url |
| #define _MSG | ( | ... | ) |
Definition at line 44 of file bookmarks.c.
| #define CSS_STYLE |
Definition at line 50 of file bookmarks.c.
| #define DOCTYPE "<!DOCTYPE html>\n" |
Definition at line 47 of file bookmarks.c.
| #define modifypage_section_card_footer mainpage_section_card_footer |
Definition at line 195 of file bookmarks.c.
| #define modifypage_sections_footer mainpage_sections_footer |
Definition at line 167 of file bookmarks.c.
| #define modifypage_sections_header mainpage_sections_header |
Definition at line 152 of file bookmarks.c.
| #define MSG | ( | ... | ) | printf("[bookmarks dpi]: " __VA_ARGS__) |
Definition at line 45 of file bookmarks.c.
|
static |
Definition at line 409 of file bookmarks.c.
References B_bms, bm_key, dList_append(), dNew, Escape_html_str(), and Escape_uri_str().
Referenced by Bms_load(), Bmsrv_add_bm(), and Bmsrv_modify_add_url().
|
static |
Definition at line 572 of file bookmarks.c.
References BmFile, dFree(), dGethomedir(), dStr_free(), dStr_new(), dStr_sprintf(), dStrconcat(), dStrerror, MSG, Dstr::str, and TRUE.
Referenced by Bms_cond_load().
|
static |
Definition at line 687 of file bookmarks.c.
References B_bms, B_secs, BmFile, BmFileTimeStamp, Bms_check_import(), Bms_load(), and dList_length().
Referenced by Bmsrv_parse_token().
|
static |
Definition at line 437 of file bookmarks.c.
References B_bms, bm_key, Bms_node_by_key_cmp(), dFree(), dList_find_custom(), dList_length(), dList_remove(), and INT2VOIDP.
Referenced by Bms_free(), Bms_sec_del(), and Bmsrv_modify_delete().
|
static |
Definition at line 521 of file bookmarks.c.
References B_bms, B_secs, Bms_del(), Bms_sec_del(), and dList_nth_data().
Referenced by Bms_load().
|
static |
Definition at line 393 of file bookmarks.c.
References B_bms, Bms_node_by_key_cmp(), dList_find_custom(), and INT2VOIDP.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 401 of file bookmarks.c.
References B_secs, Bms_sec_by_number_cmp(), dList_find_custom(), and INT2VOIDP.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 613 of file bookmarks.c.
References BmFile, BmFileTimeStamp, Bms_add(), Bms_free(), Bms_sec_add(), dFree(), dGetline(), error(), MSG, and Unescape_html_str().
Referenced by Bms_cond_load().
|
static |
Definition at line 480 of file bookmarks.c.
References B_bms, Bms_node_by_key_cmp(), dList_find_custom(), and INT2VOIDP.
Referenced by Bmsrv_modify_move().
|
static |
Definition at line 369 of file bookmarks.c.
References VOIDP2INT.
Referenced by Bms_del(), Bms_get(), Bms_move(), and Bms_update_title().
|
static |
|
static |
Definition at line 539 of file bookmarks.c.
References B_bms, B_secs, Bms_sec_add(), dList_length(), and dList_nth_data().
Referenced by Bms_save().
|
static |
Definition at line 713 of file bookmarks.c.
References B_bms, B_secs, BmFile, BmFileTimeStamp, Bms_normalize(), dFree(), dList_nth_data(), dStr_free(), dStr_new(), dStr_sprintf(), dStrconcat(), Dstr::len, Dstr::str, TRUE, and Unescape_html_str().
Referenced by Bmsrv_add_bm(), Bmsrv_modify_add_section(), Bmsrv_modify_add_url(), Bmsrv_modify_delete(), Bmsrv_modify_move(), and Bmsrv_modify_update().
|
static |
Definition at line 424 of file bookmarks.c.
References B_secs, dList_append(), dNew, Escape_html_str(), and sec_key.
Referenced by Bms_load(), Bms_normalize(), and Bmsrv_modify_add_section().
|
static |
Definition at line 385 of file bookmarks.c.
References VOIDP2INT.
Referenced by Bms_get_sec(), Bms_sec_del(), and Bms_update_sec_title().
|
static |
Definition at line 455 of file bookmarks.c.
References B_bms, B_secs, Bms_del(), Bms_node_by_section_cmp(), Bms_sec_by_number_cmp(), dFree(), dList_find_custom(), dList_length(), dList_remove(), INT2VOIDP, and sec_key.
Referenced by Bms_free(), and Bmsrv_modify_delete().
|
static |
Definition at line 507 of file bookmarks.c.
References B_secs, Bms_sec_by_number_cmp(), dFree(), dList_find_custom(), Escape_html_str(), and INT2VOIDP.
Referenced by Bmsrv_modify_update().
|
static |
Definition at line 493 of file bookmarks.c.
References B_bms, Bms_node_by_key_cmp(), dFree(), dList_find_custom(), Escape_html_str(), and INT2VOIDP.
Referenced by Bmsrv_modify_update().
|
static |
Definition at line 775 of file bookmarks.c.
References Bms_add(), Bms_save(), Bmsrv_dpi_send_status_msg(), dFree(), sh, and Unescape_html_str().
Referenced by Bmsrv_parse_token().
|
static |
Definition at line 1273 of file bookmarks.c.
References Bmsrv_count_urls_and_sections(), Bmsrv_dpi_send_status_msg(), and sh.
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 800 of file bookmarks.c.
References dIsdigit().
Referenced by Bmsrv_check_modify_request(), and Bmsrv_send_modify_update().
|
static |
Definition at line 354 of file bookmarks.c.
References a_Dpip_build_cmd(), a_Dpip_dsh_write_str(), dFree(), and sh.
Referenced by Bmsrv_add_bm(), and Bmsrv_check_modify_request().
|
static |
Definition at line 1192 of file bookmarks.c.
References Bms_save(), Bms_sec_add(), dFree(), dStrdup(), and Unencode_str().
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1220 of file bookmarks.c.
References Bms_add(), Bms_save(), dFree(), dIsdigit(), dStrdup(), sh, Unencode_str(), and Unescape_html_str().
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1052 of file bookmarks.c.
References Bms_del(), Bms_save(), Bms_sec_del(), and dIsdigit().
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1098 of file bookmarks.c.
References Bms_move(), Bms_save(), and dIsdigit().
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1137 of file bookmarks.c.
References Bms_save(), Bms_update_sec_title(), Bms_update_title(), dFree(), dIsdigit(), dStrdup(), dStrndup(), and Unencode_str().
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1481 of file bookmarks.c.
References a_Dpip_build_cmd(), a_Dpip_dsh_write_str(), a_Dpip_get_attr_l(), Bms_cond_load(), Bmsrv_add_bm(), Bmsrv_process_modify_request(), Bmsrv_send_modify_answer(), dFree(), DOCTYPE, DPIP_RAW, dStrdup(), dStrnAsciiCasecmp(), Header, Dsh::mode, MSG, send_bm_page(), and sh.
Referenced by main().
|
static |
Definition at line 1338 of file bookmarks.c.
References Bmsrv_check_modify_request(), Bmsrv_modify_add_section(), Bmsrv_modify_add_url(), Bmsrv_modify_delete(), Bmsrv_modify_move(), Bmsrv_modify_update(), Bmsrv_send_modify_update(), Bmsrv_send_reload_request(), MODIFY_PAGE_NUM, and sh.
Referenced by Bmsrv_parse_token().
|
static |
Definition at line 1015 of file bookmarks.c.
References a_Dpip_build_cmd(), a_Dpip_dsh_write_str(), Bmsrv_send_modify_page(), Bmsrv_send_modify_page_add_section(), Bmsrv_send_modify_page_add_url(), Bmsrv_send_modify_update(), dFree(), Header, MODIFY_PAGE_NUM, and sh.
Referenced by Bmsrv_parse_token().
|
static |
Definition at line 838 of file bookmarks.c.
References a_Dpip_dsh_write_str(), B_bms, B_secs, dFree(), dList_nth_data(), dStr_new(), dStr_sprintf(), make_one_line_str(), modifypage_footer, modifypage_header, modifypage_middle1, modifypage_section_card_footer, modifypage_section_card_header, modifypage_section_card_item, modifypage_sections_footer, modifypage_sections_header, modifypage_sections_item, sections_sep, sh, and Dstr::str.
Referenced by Bmsrv_send_modify_answer().
|
static |
Definition at line 912 of file bookmarks.c.
References a_Dpip_dsh_write_str(), modifypage_add_section_page, and sh.
Referenced by Bmsrv_send_modify_answer().
|
static |
Definition at line 925 of file bookmarks.c.
References a_Dpip_dsh_write_str(), modifypage_add_url, and sh.
Referenced by Bmsrv_send_modify_answer().
|
static |
Definition at line 939 of file bookmarks.c.
References a_Dpip_dsh_write_str(), Bms_get(), Bms_get_sec(), Bmsrv_count_urls_and_sections(), dFree(), dIsdigit(), dStr_new(), dStr_sprintf(), dStrdup(), modifypage_update_footer, modifypage_update_header, modifypage_update_item, modifypage_update_item2, modifypage_update_item_footer, modifypage_update_item_header, modifypage_update_title, sh, and Dstr::str.
Referenced by Bmsrv_process_modify_request(), and Bmsrv_send_modify_answer().
|
static |
Definition at line 823 of file bookmarks.c.
References a_Dpip_build_cmd(), a_Dpip_dsh_write_str(), dFree(), and sh.
Referenced by Bmsrv_process_modify_request().
|
static |
Definition at line 1595 of file bookmarks.c.
Referenced by main().
| int main | ( | void | ) |
Definition at line 1612 of file bookmarks.c.
References a_Dpip_check_auth(), a_Dpip_dsh_close(), a_Dpip_dsh_free(), a_Dpip_dsh_new(), a_Dpip_dsh_read_token(), B_bms, B_secs, BmFile, Bmsrv_parse_token(), cleanup(), dFree(), dGethomedir(), dList_new(), dStrconcat(), dStrerror, MSG, sh, and termination_handler().
|
static |
Definition at line 300 of file bookmarks.c.
References dNew.
Referenced by Bmsrv_send_modify_page(), and send_bm_page().
|
static |
Definition at line 1404 of file bookmarks.c.
References a_Dpip_dsh_write_str(), B_bms, B_secs, dFree(), dList_nth_data(), dStr_new(), dStr_sprintf(), mainpage_footer, mainpage_header, mainpage_middle1, mainpage_section_card_footer, mainpage_section_card_header, mainpage_section_card_item, mainpage_sections_footer, mainpage_sections_header, mainpage_sections_item, make_one_line_str(), sections_sep, sh, and Dstr::str.
Referenced by Bmsrv_parse_token().
|
static |
Definition at line 1603 of file bookmarks.c.
Referenced by main().
|
static |
Definition at line 328 of file bookmarks.c.
References dIsdigit(), and dStrnAsciiCasecmp().
Referenced by Bmsrv_modify_add_section(), Bmsrv_modify_add_url(), and Bmsrv_modify_update().
|
static |
Definition at line 88 of file bookmarks.c.
Referenced by Bms_add(), Bms_cond_load(), Bms_del(), Bms_free(), Bms_get(), Bms_move(), Bms_normalize(), Bms_save(), Bms_sec_del(), Bms_update_title(), Bmsrv_send_modify_page(), main(), and send_bm_page().
|
static |
Definition at line 91 of file bookmarks.c.
Referenced by Bms_cond_load(), Bms_free(), Bms_get_sec(), Bms_normalize(), Bms_save(), Bms_sec_add(), Bms_sec_del(), Bms_update_sec_title(), Bmsrv_send_modify_page(), main(), and send_bm_page().
|
static |
Definition at line 89 of file bookmarks.c.
|
static |
Definition at line 86 of file bookmarks.c.
Referenced by Bms_check_import(), Bms_cond_load(), Bms_load(), Bms_save(), and main().
|
static |
Definition at line 87 of file bookmarks.c.
Referenced by Bms_cond_load(), Bms_load(), and Bms_save().
|
static |
Definition at line 85 of file bookmarks.c.
Referenced by Bmsrv_parse_token(), and Bmsrv_send_modify_answer().
|
static |
Definition at line 197 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 104 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 169 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
|
static |
Definition at line 173 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 181 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 163 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 148 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 154 of file bookmarks.c.
Referenced by send_bm_page().
|
static |
Definition at line 94 of file bookmarks.c.
Referenced by Bmsrv_process_modify_request(), and Bmsrv_send_modify_answer().
|
static |
Definition at line 207 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page_add_section().
|
static |
Definition at line 269 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page_add_url().
|
static |
Definition at line 201 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 118 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 171 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 177 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 186 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 160 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page().
|
static |
Definition at line 262 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 230 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 248 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 254 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 259 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 245 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 242 of file bookmarks.c.
Referenced by Bmsrv_send_modify_update().
|
static |
Definition at line 92 of file bookmarks.c.
Referenced by Bms_sec_add(), and Bms_sec_del().
|
static |
Definition at line 157 of file bookmarks.c.
Referenced by Bmsrv_send_modify_page(), and send_bm_page().