Codebase list flmsg / 3f2e88b
Import Upstream version 2.0.1 Christoph Berg 5 years ago
10 changed file(s) with 176 addition(s) and 76 deletion(s). Raw diff Collapse all Expand all
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
08
19
210 =Version 2.0=
3
4 2014-03-22 David Freese <w1hkj@w1hkj.com>
511
612 c1c2ca3: Radiogram
713 0c420d1: CUSTOM Editable
00 #! /bin/sh
11 # 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.
33 #
44 # Report bugs to <w1hkj AT w1hkj DOT com>.
55 #
561561 # Identity of this package.
562562 PACKAGE_NAME='FLMSG'
563563 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'
566566 PACKAGE_BUGREPORT='w1hkj AT w1hkj DOT com'
567567 PACKAGE_URL=''
568568
13341334 # Omit some internal or obsolete options to make the list less imposing.
13351335 # This message is too long to be a string in the A/UX 3.1 sh.
13361336 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.
13381338
13391339 Usage: $0 [OPTION]... [VAR=VALUE]...
13401340
14051405
14061406 if test -n "$ac_init_help"; then
14071407 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:";;
14091409 esac
14101410 cat <<\_ACEOF
14111411
15231523 test -n "$ac_init_help" && exit $ac_status
15241524 if $ac_init_version; then
15251525 cat <<\_ACEOF
1526 FLMSG configure 2.0.0
1526 FLMSG configure 2.0.1
15271527 generated by GNU Autoconf 2.68
15281528
15291529 Copyright (C) 2010 Free Software Foundation, Inc.
20322032 This file contains any messages produced by compilers while
20332033 running configure, to aid debugging if configure makes a mistake.
20342034
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
20362036 generated by GNU Autoconf 2.68. Invocation command line was
20372037
20382038 $ $0 $@
23852385
23862386 FLMSG_VERSION_MINOR=0
23872387
2388 FLMSG_VERSION_PATCH=.0
2389
2390 FLMSG_VERSION=2.0.0
2388 FLMSG_VERSION_PATCH=.1
2389
2390 FLMSG_VERSION=2.0.1
23912391
23922392
23932393
23972397 $as_echo "#define FLMSG_VERSION_MINOR 0" >>confdefs.h
23982398
23992399
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
24042404
24052405
24062406 AC_CONFIG_ARGS=$ac_configure_args
29872987
29882988 # Define the identity of the package.
29892989 PACKAGE='flmsg'
2990 VERSION='2.0.0'
2990 VERSION='2.0.1'
29912991
29922992
29932993 cat >>confdefs.h <<_ACEOF
70747074 # report actual input values of CONFIG_FILES etc. instead of their
70757075 # values after options handling.
70767076 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
70787078 generated by GNU Autoconf 2.68. Invocation command line was
70797079
70807080 CONFIG_FILES = $CONFIG_FILES
71407140 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
71417141 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
71427142 ac_cs_version="\\
7143 FLMSG config.status 2.0.0
7143 FLMSG config.status 2.0.1
71447144 configured by $0, generated by GNU Autoconf 2.68,
71457145 with options \\"\$ac_cs_config\\"
71467146
1111 dnl contain other characters or be empty
1212 m4_define(FLMSG_MAJOR, [2])
1313 m4_define(FLMSG_MINOR, [0])
14 m4_define(FLMSG_PATCH, [.0])
14 m4_define(FLMSG_PATCH, [.1])
1515
1616 AC_INIT([FLMSG], FLMSG_MAJOR.FLMSG_MINOR[]FLMSG_PATCH, [w1hkj AT w1hkj DOT com])
1717
1010 #define BUILD_CONFIGURE_ARGS ""
1111
1212 /* 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"
1414
1515 /* Build host */
1616 #define BUILD_HOST "dave-acer"
4040 #define FLMSG_FLTK_API_PATCH 1
4141
4242 /* version string */
43 #define FLMSG_VERSION "2.0.0"
43 #define FLMSG_VERSION "2.0.1"
4444
4545 /* major version number */
4646 #define FLMSG_VERSION_MAJOR 2
4949 #define FLMSG_VERSION_MINOR 0
5050
5151 /* patch/alpha version string */
52 #define FLMSG_VERSION_PATCH ".0"
52 #define FLMSG_VERSION_PATCH ".1"
5353
5454 /* FLTK version */
5555 #define FLTK_BUILD_VERSION "1.3.1"
190190 #define PACKAGE_NAME "FLMSG"
191191
192192 /* 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"
194194
195195 /* Define to the one symbol short name of this package. */
196196 #define PACKAGE_TARNAME "flmsg"
199199 #define PACKAGE_URL ""
200200
201201 /* Define to the version of this package. */
202 #define PACKAGE_VERSION "2.0.0"
202 #define PACKAGE_VERSION "2.0.1"
203203
204204 /* Define to 1 if you have the ANSI C header files. */
205205 #define STDC_HEADERS 1
230230 #define USE_X 1
231231
232232 /* Version number of package */
233 #define VERSION "2.0.0"
233 #define VERSION "2.0.1"
234234
235235 /* x version */
236236 #define X_BUILD_VERSION "1.4.99.1"
433433 .append(name_values[n].value);
434434 }
435435 edit_txt.append(line).append("\n");
436 //printf("%s\n", line.c_str());
437436 }
438437 Fl::awake(refresh_txt_custom_msg);
439438 }
444443 size_t p, p0, p1, p2, p3;
445444
446445 for (size_t n = 0; n < name_values.size(); n++) {
447 //printf("#%02d, %s, ", n, name_values[n].name.c_str());
448446 switch (name_values[n].id) {
449447 case T_TEXT : case T_PASSWORD :
450448 nm.assign("NAME=\"").append(name_values[n].name).append("\"");
458456 p1 += value_str.length();
459457 p2 = html.find("\"", p1);
460458 html.replace(p1, p2 - p1, val);
461 //printf("replace %s", name_values[n].value.c_str());
462459 } else {
463460 temp.assign(" VALUE=\"").append(val).append("\"");
464461 html.insert(p2, temp);
465 //printf("insert %s", temp.c_str());
466462 }
467463 }
468464 break;
484480 // found name and value pair
485481 p1 += val.length();
486482 if (name_values[n].value == checked) {
487 //printf("%s", val.c_str());
488483 html.replace(p1, p2 - p1, string(" ").append(checked));
489484 } else if (p2 - p1 > 0) {
490485 html.erase(p1, p2 - p1);
501496 p1 = p + nm.length();
502497 p2 = html.find(">", p1);
503498 if (name_values[n].value == "ON") {
504 //printf("%s", "checked");
505499 html.replace(p1, p2 - p1, string(" ").append("CHECKED"));
506500 } else {
507501 html.replace(p1, p2 - p1, "");
518512 if (val[0] == '"') val.erase(0,1);
519513 if (val[val.length() -1] == '"') val.erase(val.length()-1, 1);
520514 html.replace(p0+1, p1-p0-1, val);
521 //printf("%s", val.c_str());
522515 }
523516 break;
524517 case T_SELECT :
534527 p3 = html.find(">", p1);
535528 if (html.substr(p0, p1 - p0) == name_values[n].value) {
536529 html.replace(p1+1, p3 - p1 - 1, " SELECTED");
537 //printf("%s", string(name_values[n].value.c_str()).append(" selected").c_str());
538530 } else
539531 html.replace(p1+1, p3 - p1 - 1, "");
540532 }
545537 default :
546538 break;
547539 }
548 //printf("\n");
549540 }
550541 }
551542
11231114 fclose(html_file);
11241115
11251116 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());
11271120 }
11281121 }
11291122 }
3434 static void cb_btn_custom_edit(Fl_Button*, void*) {
3535 if (custom_select < 0) return;
3636 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());
3840 }
3941
4042 static void cb_btn_custom_view(Fl_Button*, void*) {
4143 if (custom_select < 0) return;
4244 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());
4448 }
4549
4650 static void custom_changed(FTextEdit *, void *)
8787 void *poll_server(void *);
8888 void start_web_server();
8989 void close_server();
90
90 void get_next_port_number();
91
92 int flmsg_webserver_portnbr = 8080;
93 char flmsg_webserver_szportnbr[5];
9194 //------------------------------------------------------------------------------
9295
9396 const char *options[] = {\
15561559 catch (...) {
15571560 }
15581561 close_xmlrpc();
1562 close_server();
15591563 debug::stop();
15601564 exit(0);
15611565 }
17511755 {
17521756 check_mycall();
17531757
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
17711758 def_203_filename = ICS_msg_dir;
17721759 def_203_filename.append("default"F203_EXT);
17731760 def_203_TemplateName = ICS_tmp_dir;
18321819 def_rg_filename.append("default"RGFILE_EXT);
18331820 def_rg_TemplateName = ICS_tmp_dir;
18341821 def_rg_TemplateName.append("default"RGTEMP_EXT);
1835 set_rg_choices();
18361822
18371823 iaru_def_filename = ICS_msg_dir;
18381824 iaru_def_filename.append("default"IARU_FILE_EXT);
18391825 iaru_def_template_name = ICS_tmp_dir;
18401826 iaru_def_template_name.append("default"IARU_TEMP_EXT);
1841 iaru_set_choices();
18421827
18431828 cap105_def_filename = ICS_msg_dir;
18441829 cap105_def_filename.append("default"CAP105_FILE_EXT);
19511936 }
19521937 catch (...) {
19531938 }
1954 start_web_server();
19551939 }
19561940
19571941 int main(int argc, char *argv[])
20352019
20362020 mainwindow = flmsg_dialog();
20372021 mainwindow->callback(exit_main);
2022 set_rg_choices();
2023 iaru_set_choices();
20382024
20392025 #if FLMSG_FLTK_API_MAJOR == 1 && FLMSG_FLTK_API_MINOR == 3
20402026 Fl::add_handler(default_handler);
20662052
20672053 checkdirectories();
20682054 load_custom_menu();
2055 get_next_port_number();
20692056
20702057 string debug_file = FLMSG_dir;
2071 debug_file.append("debug_log.txt");
2058 debug_file.append("debug_log_").append(flmsg_webserver_szportnbr).append(".txt");
20722059 debug::start(debug_file.c_str());
20732060
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
20742078 LOG_INFO("%s", parse_info.c_str());
2079
2080 start_web_server();
20752081
20762082 if (printme) {
20772083 #ifdef __APPLE_
20782084 fl_open_display();
20792085 #endif
20802086 print_and_exit();
2081 if (exit_after_print)
2087 if (exit_after_print && selected_form != CUSTOM)
20822088 return 0;
20832089 }
20842090
26262632
26272633 int handle_type = HANDLE_WAITING;
26282634
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
26292709 static const char *html_waiting =
26302710 "<html><body>\n\
26312711 Custom form not posted<br>\n\
26602740 pthread_mutex_lock(&mutex_web_server);
26612741 exit_server = true;
26622742 pthread_mutex_unlock(&mutex_web_server);
2743 remove_port_number();
26632744 MilliSleep(200);
26642745 }
26652746
26892770 fl_alert2("%s", "Failed to start web server");
26902771 return;
26912772 }
2773
26922774 const char *msg = mg_set_option(server, "document_root", CUSTOM_dir.c_str());
2693 if (msg != NULL) {
2775
2776 if (msg != NULL) {
26942777 fl_alert2("%s", "Failed to set file server root directory");
26952778 return;
26962779 }
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);
27012785 return;
27022786 }
2787
27032788 mg_set_request_handler(server, web_handler);
27042789
27052790 web_server_thread = new pthread_t;
27072792 perror("pthread_create");
27082793 exit(EXIT_FAILURE);
27092794 }
2710 }
2795
2796 LOG_INFO("Web server on localhost:%s", flmsg_webserver_szportnbr);
2797
2798 }
2828 #include "flmsg.h"
2929 #include "fileselect.h"
3030 #include "debug.h"
31 #include "util.h"
3132
3233 #include "transfer.h"
3334 #include "time_table.h"
862863 while (in.get(cin))
863864 contents += cin;
864865 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();
866869 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();
868873 if (p != string::npos) {
869874 p += key2.length() + 1;
870875 contents.erase(0, p);
597597 extern int custom_select;
598598 extern int handle_type;
599599
600 extern int flmsg_webserver_portnbr;
601 extern char flmsg_webserver_szportnbr[];
602
600603 extern pthread_t *web_server_thread;
601604 extern pthread_mutex_t mutex_web_server;
602605
2121 #define UTIL_H
2222
2323 #include <string>
24 #include "config.h"
2425
2526 #ifdef __cplusplus
2627 extern "C" {
125126 const__ uint32_t ceil2(uint32_t n);
126127 const__ uint32_t floor2(uint32_t n);
127128
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
135136
136137 int set_cloexec(int fd, unsigned char v);
137138 int set_nonblock(int fd, unsigned char v);