2 * Copyright (c) 2017-2020, De Rais <derais@cock.li>
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
31 const char *program_name
= "rb79-update-recent-page";
33 /* Show usage message, do not exit */
37 printf("Usage: %s\n", program_name
);
45 struct configuration conf
= { 0 };
47 setlocale(LC_ALL
, "");
49 conf
= (struct configuration
) {
51 .static_www_folder
= static_www_folder
, /* */
52 .work_path
= work_path
, /* */
53 .temp_dir_template
= temp_dir_template
, /* */
54 .trip_salt
= trip_salt
, /* */
55 .trip_salt_len
= strlen(trip_salt
), /* */
56 .boards
= boards
, /* */
57 .boards_num
= NUM_OF(boards
), /* */
58 .max_form_data_size
= max_form_data_size
, /* */
59 .max_file_size
= max_file_size
, /* */
60 .max_text_len
= max_text_len
, /* */
61 .filetypes
= filetypes
, /* */
62 .filetypes_num
= NUM_OF(filetypes
), /* */
63 .file_description_prog
= file_description_prog
, /* */
64 .headers
= headers
, /* */
65 .headers_num
= NUM_OF(headers
), /* */
66 .challenges
= challenges
, /* */
67 .challenges_num
= NUM_OF(challenges
), /* */
68 .wordfilter_inputs
= wordfilter_inputs
, /* */
69 .wordfilter_inputs_num
= NUM_OF(wordfilter_inputs
), /* */
70 .forbidden_inputs
= forbidden_inputs
, /* */
71 .forbidden_inputs_num
= NUM_OF(forbidden_inputs
), /* */
74 /* Set up a minimal part of the system */
75 if (setup_locks(&conf
) < 0) {
79 if (setup_dbs(&conf
) < 0) {
83 if (setup_write_thread(&conf
) < 0) {
87 if (lock_acquire_recent() < 0) {
91 ret
= wt_write_recent_page();
92 lock_release_recent();