Import Upstream version 2.0.1
Christoph Berg
5 years ago
0 | ||
1 | ||
2 | =Version 2.0.1= | |
3 | ||
4 | 2014-03-31 David Freese <w1hkj@w1hkj.com> | |
5 | ||
6 | 16671f6: Radiogram/IARU choices | |
7 | 76bbf35: Custom Forms | |
0 | 8 | |
1 | 9 | |
2 | 10 | =Version 2.0= |
3 | ||
4 | 2014-03-22 David Freese <w1hkj@w1hkj.com> | |
5 | 11 | |
6 | 12 | c1c2ca3: Radiogram |
7 | 13 | 0c420d1: CUSTOM Editable |
0 | 0 | #! /bin/sh |
1 | 1 | # Guess values for system-dependent variables and create Makefiles. |
2 | # Generated by GNU Autoconf 2.68 for FLMSG 2.0.0. | |
2 | # Generated by GNU Autoconf 2.68 for FLMSG 2.0.1. | |
3 | 3 | # |
4 | 4 | # Report bugs to <w1hkj AT w1hkj DOT com>. |
5 | 5 | # |
561 | 561 | # Identity of this package. |
562 | 562 | PACKAGE_NAME='FLMSG' |
563 | 563 | PACKAGE_TARNAME='flmsg' |
564 | PACKAGE_VERSION='2.0.0' | |
565 | PACKAGE_STRING='FLMSG 2.0.0' | |
564 | PACKAGE_VERSION='2.0.1' | |
565 | PACKAGE_STRING='FLMSG 2.0.1' | |
566 | 566 | PACKAGE_BUGREPORT='w1hkj AT w1hkj DOT com' |
567 | 567 | PACKAGE_URL='' |
568 | 568 | |
1334 | 1334 | # Omit some internal or obsolete options to make the list less imposing. |
1335 | 1335 | # This message is too long to be a string in the A/UX 3.1 sh. |
1336 | 1336 | cat <<_ACEOF |
1337 | \`configure' configures FLMSG 2.0.0 to adapt to many kinds of systems. | |
1337 | \`configure' configures FLMSG 2.0.1 to adapt to many kinds of systems. | |
1338 | 1338 | |
1339 | 1339 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1340 | 1340 | |
1405 | 1405 | |
1406 | 1406 | if test -n "$ac_init_help"; then |
1407 | 1407 | case $ac_init_help in |
1408 | short | recursive ) echo "Configuration of FLMSG 2.0.0:";; | |
1408 | short | recursive ) echo "Configuration of FLMSG 2.0.1:";; | |
1409 | 1409 | esac |
1410 | 1410 | cat <<\_ACEOF |
1411 | 1411 | |
1523 | 1523 | test -n "$ac_init_help" && exit $ac_status |
1524 | 1524 | if $ac_init_version; then |
1525 | 1525 | cat <<\_ACEOF |
1526 | FLMSG configure 2.0.0 | |
1526 | FLMSG configure 2.0.1 | |
1527 | 1527 | generated by GNU Autoconf 2.68 |
1528 | 1528 | |
1529 | 1529 | Copyright (C) 2010 Free Software Foundation, Inc. |
2032 | 2032 | This file contains any messages produced by compilers while |
2033 | 2033 | running configure, to aid debugging if configure makes a mistake. |
2034 | 2034 | |
2035 | It was created by FLMSG $as_me 2.0.0, which was | |
2035 | It was created by FLMSG $as_me 2.0.1, which was | |
2036 | 2036 | generated by GNU Autoconf 2.68. Invocation command line was |
2037 | 2037 | |
2038 | 2038 | $ $0 $@ |
2385 | 2385 | |
2386 | 2386 | FLMSG_VERSION_MINOR=0 |
2387 | 2387 | |
2388 | FLMSG_VERSION_PATCH=.0 | |
2389 | ||
2390 | FLMSG_VERSION=2.0.0 | |
2388 | FLMSG_VERSION_PATCH=.1 | |
2389 | ||
2390 | FLMSG_VERSION=2.0.1 | |
2391 | 2391 | |
2392 | 2392 | |
2393 | 2393 | |
2397 | 2397 | $as_echo "#define FLMSG_VERSION_MINOR 0" >>confdefs.h |
2398 | 2398 | |
2399 | 2399 | |
2400 | $as_echo "#define FLMSG_VERSION_PATCH \".0\"" >>confdefs.h | |
2401 | ||
2402 | ||
2403 | $as_echo "#define FLMSG_VERSION \"2.0.0\"" >>confdefs.h | |
2400 | $as_echo "#define FLMSG_VERSION_PATCH \".1\"" >>confdefs.h | |
2401 | ||
2402 | ||
2403 | $as_echo "#define FLMSG_VERSION \"2.0.1\"" >>confdefs.h | |
2404 | 2404 | |
2405 | 2405 | |
2406 | 2406 | AC_CONFIG_ARGS=$ac_configure_args |
2987 | 2987 | |
2988 | 2988 | # Define the identity of the package. |
2989 | 2989 | PACKAGE='flmsg' |
2990 | VERSION='2.0.0' | |
2990 | VERSION='2.0.1' | |
2991 | 2991 | |
2992 | 2992 | |
2993 | 2993 | cat >>confdefs.h <<_ACEOF |
7074 | 7074 | # report actual input values of CONFIG_FILES etc. instead of their |
7075 | 7075 | # values after options handling. |
7076 | 7076 | ac_log=" |
7077 | This file was extended by FLMSG $as_me 2.0.0, which was | |
7077 | This file was extended by FLMSG $as_me 2.0.1, which was | |
7078 | 7078 | generated by GNU Autoconf 2.68. Invocation command line was |
7079 | 7079 | |
7080 | 7080 | CONFIG_FILES = $CONFIG_FILES |
7140 | 7140 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
7141 | 7141 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
7142 | 7142 | ac_cs_version="\\ |
7143 | FLMSG config.status 2.0.0 | |
7143 | FLMSG config.status 2.0.1 | |
7144 | 7144 | configured by $0, generated by GNU Autoconf 2.68, |
7145 | 7145 | with options \\"\$ac_cs_config\\" |
7146 | 7146 |
11 | 11 | dnl contain other characters or be empty |
12 | 12 | m4_define(FLMSG_MAJOR, [2]) |
13 | 13 | m4_define(FLMSG_MINOR, [0]) |
14 | m4_define(FLMSG_PATCH, [.0]) | |
14 | m4_define(FLMSG_PATCH, [.1]) | |
15 | 15 | |
16 | 16 | AC_INIT([FLMSG], FLMSG_MAJOR.FLMSG_MINOR[]FLMSG_PATCH, [w1hkj AT w1hkj DOT com]) |
17 | 17 |
10 | 10 | #define BUILD_CONFIGURE_ARGS "" |
11 | 11 | |
12 | 12 | /* Build date */ |
13 | #define BUILD_DATE "Tue Mar 25 16:30:29 CDT 2014" | |
13 | #define BUILD_DATE "Mon Mar 31 09:31:13 CDT 2014" | |
14 | 14 | |
15 | 15 | /* Build host */ |
16 | 16 | #define BUILD_HOST "dave-acer" |
40 | 40 | #define FLMSG_FLTK_API_PATCH 1 |
41 | 41 | |
42 | 42 | /* version string */ |
43 | #define FLMSG_VERSION "2.0.0" | |
43 | #define FLMSG_VERSION "2.0.1" | |
44 | 44 | |
45 | 45 | /* major version number */ |
46 | 46 | #define FLMSG_VERSION_MAJOR 2 |
49 | 49 | #define FLMSG_VERSION_MINOR 0 |
50 | 50 | |
51 | 51 | /* patch/alpha version string */ |
52 | #define FLMSG_VERSION_PATCH ".0" | |
52 | #define FLMSG_VERSION_PATCH ".1" | |
53 | 53 | |
54 | 54 | /* FLTK version */ |
55 | 55 | #define FLTK_BUILD_VERSION "1.3.1" |
190 | 190 | #define PACKAGE_NAME "FLMSG" |
191 | 191 | |
192 | 192 | /* Define to the full name and version of this package. */ |
193 | #define PACKAGE_STRING "FLMSG 2.0.0" | |
193 | #define PACKAGE_STRING "FLMSG 2.0.1" | |
194 | 194 | |
195 | 195 | /* Define to the one symbol short name of this package. */ |
196 | 196 | #define PACKAGE_TARNAME "flmsg" |
199 | 199 | #define PACKAGE_URL "" |
200 | 200 | |
201 | 201 | /* Define to the version of this package. */ |
202 | #define PACKAGE_VERSION "2.0.0" | |
202 | #define PACKAGE_VERSION "2.0.1" | |
203 | 203 | |
204 | 204 | /* Define to 1 if you have the ANSI C header files. */ |
205 | 205 | #define STDC_HEADERS 1 |
230 | 230 | #define USE_X 1 |
231 | 231 | |
232 | 232 | /* Version number of package */ |
233 | #define VERSION "2.0.0" | |
233 | #define VERSION "2.0.1" | |
234 | 234 | |
235 | 235 | /* x version */ |
236 | 236 | #define X_BUILD_VERSION "1.4.99.1" |
433 | 433 | .append(name_values[n].value); |
434 | 434 | } |
435 | 435 | edit_txt.append(line).append("\n"); |
436 | //printf("%s\n", line.c_str()); | |
437 | 436 | } |
438 | 437 | Fl::awake(refresh_txt_custom_msg); |
439 | 438 | } |
444 | 443 | size_t p, p0, p1, p2, p3; |
445 | 444 | |
446 | 445 | for (size_t n = 0; n < name_values.size(); n++) { |
447 | //printf("#%02d, %s, ", n, name_values[n].name.c_str()); | |
448 | 446 | switch (name_values[n].id) { |
449 | 447 | case T_TEXT : case T_PASSWORD : |
450 | 448 | nm.assign("NAME=\"").append(name_values[n].name).append("\""); |
458 | 456 | p1 += value_str.length(); |
459 | 457 | p2 = html.find("\"", p1); |
460 | 458 | html.replace(p1, p2 - p1, val); |
461 | //printf("replace %s", name_values[n].value.c_str()); | |
462 | 459 | } else { |
463 | 460 | temp.assign(" VALUE=\"").append(val).append("\""); |
464 | 461 | html.insert(p2, temp); |
465 | //printf("insert %s", temp.c_str()); | |
466 | 462 | } |
467 | 463 | } |
468 | 464 | break; |
484 | 480 | // found name and value pair |
485 | 481 | p1 += val.length(); |
486 | 482 | if (name_values[n].value == checked) { |
487 | //printf("%s", val.c_str()); | |
488 | 483 | html.replace(p1, p2 - p1, string(" ").append(checked)); |
489 | 484 | } else if (p2 - p1 > 0) { |
490 | 485 | html.erase(p1, p2 - p1); |
501 | 496 | p1 = p + nm.length(); |
502 | 497 | p2 = html.find(">", p1); |
503 | 498 | if (name_values[n].value == "ON") { |
504 | //printf("%s", "checked"); | |
505 | 499 | html.replace(p1, p2 - p1, string(" ").append("CHECKED")); |
506 | 500 | } else { |
507 | 501 | html.replace(p1, p2 - p1, ""); |
518 | 512 | if (val[0] == '"') val.erase(0,1); |
519 | 513 | if (val[val.length() -1] == '"') val.erase(val.length()-1, 1); |
520 | 514 | html.replace(p0+1, p1-p0-1, val); |
521 | //printf("%s", val.c_str()); | |
522 | 515 | } |
523 | 516 | break; |
524 | 517 | case T_SELECT : |
534 | 527 | p3 = html.find(">", p1); |
535 | 528 | if (html.substr(p0, p1 - p0) == name_values[n].value) { |
536 | 529 | html.replace(p1+1, p3 - p1 - 1, " SELECTED"); |
537 | //printf("%s", string(name_values[n].value.c_str()).append(" selected").c_str()); | |
538 | 530 | } else |
539 | 531 | html.replace(p1+1, p3 - p1 - 1, ""); |
540 | 532 | } |
545 | 537 | default : |
546 | 538 | break; |
547 | 539 | } |
548 | //printf("\n"); | |
549 | 540 | } |
550 | 541 | } |
551 | 542 | |
1123 | 1114 | fclose(html_file); |
1124 | 1115 | |
1125 | 1116 | handle_type = HANDLE_VIEW; |
1126 | open_url("http://127.0.0.1:8080"); | |
1117 | string url = "http://127.0.0.1:"; | |
1118 | url.append(flmsg_webserver_szportnbr); | |
1119 | open_url(url.c_str()); | |
1127 | 1120 | } |
1128 | 1121 | } |
1129 | 1122 | } |
34 | 34 | static void cb_btn_custom_edit(Fl_Button*, void*) { |
35 | 35 | if (custom_select < 0) return; |
36 | 36 | handle_type = HANDLE_EDIT; |
37 | open_url("http://127.0.0.1:8080"); | |
37 | string url = "http://127.0.0.1:"; | |
38 | url.append(flmsg_webserver_szportnbr); | |
39 | open_url(url.c_str()); | |
38 | 40 | } |
39 | 41 | |
40 | 42 | static void cb_btn_custom_view(Fl_Button*, void*) { |
41 | 43 | if (custom_select < 0) return; |
42 | 44 | handle_type = HANDLE_VIEW; |
43 | open_url("http://127.0.0.1:8080"); | |
45 | string url = "http://127.0.0.1:"; | |
46 | url.append(flmsg_webserver_szportnbr); | |
47 | open_url(url.c_str()); | |
44 | 48 | } |
45 | 49 | |
46 | 50 | static void custom_changed(FTextEdit *, void *) |
87 | 87 | void *poll_server(void *); |
88 | 88 | void start_web_server(); |
89 | 89 | void close_server(); |
90 | ||
90 | void get_next_port_number(); | |
91 | ||
92 | int flmsg_webserver_portnbr = 8080; | |
93 | char flmsg_webserver_szportnbr[5]; | |
91 | 94 | //------------------------------------------------------------------------------ |
92 | 95 | |
93 | 96 | const char *options[] = {\ |
1556 | 1559 | catch (...) { |
1557 | 1560 | } |
1558 | 1561 | close_xmlrpc(); |
1562 | close_server(); | |
1559 | 1563 | debug::stop(); |
1560 | 1564 | exit(0); |
1561 | 1565 | } |
1751 | 1755 | { |
1752 | 1756 | check_mycall(); |
1753 | 1757 | |
1754 | LOG_INFO("FLMSG_dir %s", FLMSG_dir.c_str()); | |
1755 | LOG_INFO("ARQ_dir %s", ARQ_dir.c_str()); | |
1756 | LOG_INFO("ARQ_files_dir %s", ARQ_files_dir.c_str()); | |
1757 | LOG_INFO("ARQ_recv_dir %s", ARQ_recv_dir.c_str()); | |
1758 | LOG_INFO("ARQ_send_dir %s", ARQ_send_dir.c_str()); | |
1759 | LOG_INFO("WRAP_dir %s", WRAP_dir.c_str()); | |
1760 | LOG_INFO("WRAP_recv_dir %s", WRAP_recv_dir.c_str()); | |
1761 | LOG_INFO("WRAP_send_dir %s", WRAP_send_dir.c_str()); | |
1762 | LOG_INFO("WRAP_auto_dir %s", WRAP_auto_dir.c_str()); | |
1763 | LOG_INFO("ICS_dir %s", ICS_dir.c_str()); | |
1764 | LOG_INFO("ICS_msg_dir %s", ICS_msg_dir.c_str()); | |
1765 | LOG_INFO("ICS_tmp_dir %s", ICS_tmp_dir.c_str()); | |
1766 | LOG_INFO("CSV_dir %s", CSV_dir.c_str()); | |
1767 | LOG_INFO("CUSTOM_dir %s", CUSTOM_dir.c_str()); | |
1768 | LOG_INFO("Transfer dir %s", XFR_dir.c_str()); | |
1769 | LOG_INFO("FLMSG_temp_dir %s", FLMSG_temp_dir.c_str()); | |
1770 | ||
1771 | 1758 | def_203_filename = ICS_msg_dir; |
1772 | 1759 | def_203_filename.append("default"F203_EXT); |
1773 | 1760 | def_203_TemplateName = ICS_tmp_dir; |
1832 | 1819 | def_rg_filename.append("default"RGFILE_EXT); |
1833 | 1820 | def_rg_TemplateName = ICS_tmp_dir; |
1834 | 1821 | def_rg_TemplateName.append("default"RGTEMP_EXT); |
1835 | set_rg_choices(); | |
1836 | 1822 | |
1837 | 1823 | iaru_def_filename = ICS_msg_dir; |
1838 | 1824 | iaru_def_filename.append("default"IARU_FILE_EXT); |
1839 | 1825 | iaru_def_template_name = ICS_tmp_dir; |
1840 | 1826 | iaru_def_template_name.append("default"IARU_TEMP_EXT); |
1841 | iaru_set_choices(); | |
1842 | 1827 | |
1843 | 1828 | cap105_def_filename = ICS_msg_dir; |
1844 | 1829 | cap105_def_filename.append("default"CAP105_FILE_EXT); |
1951 | 1936 | } |
1952 | 1937 | catch (...) { |
1953 | 1938 | } |
1954 | start_web_server(); | |
1955 | 1939 | } |
1956 | 1940 | |
1957 | 1941 | int main(int argc, char *argv[]) |
2035 | 2019 | |
2036 | 2020 | mainwindow = flmsg_dialog(); |
2037 | 2021 | mainwindow->callback(exit_main); |
2022 | set_rg_choices(); | |
2023 | iaru_set_choices(); | |
2038 | 2024 | |
2039 | 2025 | #if FLMSG_FLTK_API_MAJOR == 1 && FLMSG_FLTK_API_MINOR == 3 |
2040 | 2026 | Fl::add_handler(default_handler); |
2066 | 2052 | |
2067 | 2053 | checkdirectories(); |
2068 | 2054 | load_custom_menu(); |
2055 | get_next_port_number(); | |
2069 | 2056 | |
2070 | 2057 | string debug_file = FLMSG_dir; |
2071 | debug_file.append("debug_log.txt"); | |
2058 | debug_file.append("debug_log_").append(flmsg_webserver_szportnbr).append(".txt"); | |
2072 | 2059 | debug::start(debug_file.c_str()); |
2073 | 2060 | |
2061 | LOG_INFO("FLMSG_dir %s", FLMSG_dir.c_str()); | |
2062 | LOG_INFO("ARQ_dir %s", ARQ_dir.c_str()); | |
2063 | LOG_INFO("ARQ_files_dir %s", ARQ_files_dir.c_str()); | |
2064 | LOG_INFO("ARQ_recv_dir %s", ARQ_recv_dir.c_str()); | |
2065 | LOG_INFO("ARQ_send_dir %s", ARQ_send_dir.c_str()); | |
2066 | LOG_INFO("WRAP_dir %s", WRAP_dir.c_str()); | |
2067 | LOG_INFO("WRAP_recv_dir %s", WRAP_recv_dir.c_str()); | |
2068 | LOG_INFO("WRAP_send_dir %s", WRAP_send_dir.c_str()); | |
2069 | LOG_INFO("WRAP_auto_dir %s", WRAP_auto_dir.c_str()); | |
2070 | LOG_INFO("ICS_dir %s", ICS_dir.c_str()); | |
2071 | LOG_INFO("ICS_msg_dir %s", ICS_msg_dir.c_str()); | |
2072 | LOG_INFO("ICS_tmp_dir %s", ICS_tmp_dir.c_str()); | |
2073 | LOG_INFO("CSV_dir %s", CSV_dir.c_str()); | |
2074 | LOG_INFO("CUSTOM_dir %s", CUSTOM_dir.c_str()); | |
2075 | LOG_INFO("Transfer dir %s", XFR_dir.c_str()); | |
2076 | LOG_INFO("FLMSG_temp_dir %s", FLMSG_temp_dir.c_str()); | |
2077 | ||
2074 | 2078 | LOG_INFO("%s", parse_info.c_str()); |
2079 | ||
2080 | start_web_server(); | |
2075 | 2081 | |
2076 | 2082 | if (printme) { |
2077 | 2083 | #ifdef __APPLE_ |
2078 | 2084 | fl_open_display(); |
2079 | 2085 | #endif |
2080 | 2086 | print_and_exit(); |
2081 | if (exit_after_print) | |
2087 | if (exit_after_print && selected_form != CUSTOM) | |
2082 | 2088 | return 0; |
2083 | 2089 | } |
2084 | 2090 | |
2626 | 2632 | |
2627 | 2633 | int handle_type = HANDLE_WAITING; |
2628 | 2634 | |
2635 | void remove_port_number() | |
2636 | { | |
2637 | string ports; | |
2638 | string chk_fname = FLMSG_dir; | |
2639 | chk_fname.append("port_names.txt"); | |
2640 | ifstream rchkfile(chk_fname.c_str()); | |
2641 | if (rchkfile) { | |
2642 | string pnbr; | |
2643 | rchkfile >> pnbr; | |
2644 | while (!rchkfile.eof()) { | |
2645 | ports.append(pnbr).append("\n"); | |
2646 | rchkfile >> pnbr; | |
2647 | } | |
2648 | rchkfile.close(); | |
2649 | size_t p = ports.find(flmsg_webserver_szportnbr); | |
2650 | if (p != string::npos) ports.erase(p, 5); | |
2651 | ofstream wchkfile(chk_fname.c_str()); | |
2652 | if (wchkfile) { | |
2653 | wchkfile << ports; | |
2654 | wchkfile.close(); | |
2655 | } | |
2656 | } | |
2657 | LOG_INFO("Closed Web server on localhost:%s", flmsg_webserver_szportnbr); | |
2658 | } | |
2659 | ||
2660 | void get_next_port_number() | |
2661 | { | |
2662 | string ports; | |
2663 | string chk_fname = FLMSG_dir; | |
2664 | chk_fname.append("port_names.txt"); | |
2665 | ifstream rchkfile(chk_fname.c_str()); | |
2666 | if (rchkfile) { | |
2667 | string pnbr; | |
2668 | rchkfile >> pnbr; | |
2669 | while (!rchkfile.eof()) { | |
2670 | ports.append(pnbr).append("\n"); | |
2671 | rchkfile >> pnbr; | |
2672 | } | |
2673 | rchkfile.close(); | |
2674 | if (ports.empty()) { | |
2675 | ports = "8080\n"; | |
2676 | flmsg_webserver_portnbr = 8080; | |
2677 | strcpy(flmsg_webserver_szportnbr, "8080"); | |
2678 | } else { | |
2679 | flmsg_webserver_portnbr = 8080; | |
2680 | snprintf(flmsg_webserver_szportnbr, | |
2681 | sizeof(flmsg_webserver_szportnbr), | |
2682 | "%d", flmsg_webserver_portnbr); | |
2683 | while (ports.find(flmsg_webserver_szportnbr) != string::npos) { | |
2684 | flmsg_webserver_portnbr++; | |
2685 | snprintf(flmsg_webserver_szportnbr, | |
2686 | sizeof(flmsg_webserver_szportnbr), | |
2687 | "%d", flmsg_webserver_portnbr); | |
2688 | } | |
2689 | ports.append(flmsg_webserver_szportnbr).append("\n"); | |
2690 | } | |
2691 | ofstream wchkfile(chk_fname.c_str()); | |
2692 | if (wchkfile) { | |
2693 | wchkfile << ports; | |
2694 | wchkfile.close(); | |
2695 | } | |
2696 | } else { | |
2697 | ports = "8080\n"; | |
2698 | flmsg_webserver_portnbr = 8080; | |
2699 | strcpy(flmsg_webserver_szportnbr, "8080"); | |
2700 | ofstream wchkfile(chk_fname.c_str()); | |
2701 | if (wchkfile) { | |
2702 | wchkfile << ports; | |
2703 | wchkfile.close(); | |
2704 | } | |
2705 | } | |
2706 | } | |
2707 | ||
2708 | ||
2629 | 2709 | static const char *html_waiting = |
2630 | 2710 | "<html><body>\n\ |
2631 | 2711 | Custom form not posted<br>\n\ |
2660 | 2740 | pthread_mutex_lock(&mutex_web_server); |
2661 | 2741 | exit_server = true; |
2662 | 2742 | pthread_mutex_unlock(&mutex_web_server); |
2743 | remove_port_number(); | |
2663 | 2744 | MilliSleep(200); |
2664 | 2745 | } |
2665 | 2746 | |
2689 | 2770 | fl_alert2("%s", "Failed to start web server"); |
2690 | 2771 | return; |
2691 | 2772 | } |
2773 | ||
2692 | 2774 | const char *msg = mg_set_option(server, "document_root", CUSTOM_dir.c_str()); |
2693 | if (msg != NULL) { | |
2775 | ||
2776 | if (msg != NULL) { | |
2694 | 2777 | fl_alert2("%s", "Failed to set file server root directory"); |
2695 | 2778 | return; |
2696 | 2779 | } |
2697 | ||
2698 | msg = mg_set_option(server, "listening_port", "8080"); | |
2699 | if (msg != NULL) { | |
2700 | fl_alert2("%s", "Failed to set listening port"); | |
2780 | ||
2781 | msg = mg_set_option(server, "listening_port", flmsg_webserver_szportnbr); | |
2782 | if (msg) { | |
2783 | LOG_ERROR("%s %s", msg, flmsg_webserver_szportnbr); | |
2784 | fl_alert2("Failed to open web server port %s", flmsg_webserver_szportnbr); | |
2701 | 2785 | return; |
2702 | 2786 | } |
2787 | ||
2703 | 2788 | mg_set_request_handler(server, web_handler); |
2704 | 2789 | |
2705 | 2790 | web_server_thread = new pthread_t; |
2707 | 2792 | perror("pthread_create"); |
2708 | 2793 | exit(EXIT_FAILURE); |
2709 | 2794 | } |
2710 | } | |
2795 | ||
2796 | LOG_INFO("Web server on localhost:%s", flmsg_webserver_szportnbr); | |
2797 | ||
2798 | } |
28 | 28 | #include "flmsg.h" |
29 | 29 | #include "fileselect.h" |
30 | 30 | #include "debug.h" |
31 | #include "util.h" | |
31 | 32 | |
32 | 33 | #include "transfer.h" |
33 | 34 | #include "time_table.h" |
862 | 863 | while (in.get(cin)) |
863 | 864 | contents += cin; |
864 | 865 | in.close(); |
865 | size_t p = contents.find(key1); | |
866 | size_t p = string::npos; | |
867 | const char *ptr = strcasestr(contents.c_str(), key1.c_str()); | |
868 | if (ptr) p = ptr - contents.c_str(); | |
866 | 869 | if ( p != string::npos) { |
867 | p = contents.find(key2); | |
870 | p = string::npos; | |
871 | ptr = strcasestr(contents.c_str(), key2.c_str()); | |
872 | if (ptr) p = ptr - contents.c_str(); | |
868 | 873 | if (p != string::npos) { |
869 | 874 | p += key2.length() + 1; |
870 | 875 | contents.erase(0, p); |
597 | 597 | extern int custom_select; |
598 | 598 | extern int handle_type; |
599 | 599 | |
600 | extern int flmsg_webserver_portnbr; | |
601 | extern char flmsg_webserver_szportnbr[]; | |
602 | ||
600 | 603 | extern pthread_t *web_server_thread; |
601 | 604 | extern pthread_mutex_t mutex_web_server; |
602 | 605 |
21 | 21 | #define UTIL_H |
22 | 22 | |
23 | 23 | #include <string> |
24 | #include "config.h" | |
24 | 25 | |
25 | 26 | #ifdef __cplusplus |
26 | 27 | extern "C" { |
125 | 126 | const__ uint32_t ceil2(uint32_t n); |
126 | 127 | const__ uint32_t floor2(uint32_t n); |
127 | 128 | |
128 | //#if !HAVE_STRCASESTR | |
129 | //char* strcasestr(const char* haystack, const char* needle); | |
130 | //#endif | |
131 | ||
132 | //#if !HAVE_STRLCPY | |
133 | //size_t strlcpy(char* dest, const char* src, size_t size); | |
134 | //#endif | |
129 | #if !HAVE_STRCASESTR | |
130 | char* strcasestr(const char* haystack, const char* needle); | |
131 | #endif | |
132 | ||
133 | #if !HAVE_STRLCPY | |
134 | size_t strlcpy(char* dest, const char* src, size_t size); | |
135 | #endif | |
135 | 136 | |
136 | 137 | int set_cloexec(int fd, unsigned char v); |
137 | 138 | int set_nonblock(int fd, unsigned char v); |