flmsg/flamp stream processing

* added parsing of cmd line parameters when opening flmsg
    upon completion of wrap file extraction
  * added parsing of flamp text streams
  * modified socket arq to separate socket i/o from both
    signal processing and main thread.
pull/1/head
David Freese 2012-09-11 15:55:17 -05:00
rodzic 385c33094e
commit 14346a7c51
9 zmienionych plików z 282 dodań i 235 usunięć

Wyświetl plik

@ -3193,13 +3193,6 @@ static void cb_chk_open_flmsg_print(Fl_Check_Button* o, void*) {
progdefaults.changed = true;
}
Fl_Value_Slider *sldr_extract_timeout=(Fl_Value_Slider *)0;
static void cb_sldr_extract_timeout(Fl_Value_Slider* o, void*) {
progdefaults.extract_timeout=o->value();
progdefaults.changed=true;
}
Fl_Input2 *txt_flmsg_pathname=(Fl_Input2 *)0;
static void cb_txt_flmsg_pathname(Fl_Input2* o, void*) {
@ -3213,6 +3206,13 @@ static void cb_btn_select_flmsg(Fl_Button*, void*) {
select_flmsg_pathname();
}
Fl_Value_Slider *sldr_extract_timeout=(Fl_Value_Slider *)0;
static void cb_sldr_extract_timeout(Fl_Value_Slider* o, void*) {
progdefaults.extract_timeout=o->value();
progdefaults.changed=true;
}
Fl_Group *tabPskmail=(Fl_Group *)0;
Fl_Counter2 *cntServerCarrier=(Fl_Counter2 *)0;
@ -7306,7 +7306,7 @@ d frequency"));
} // Fl_Check_Button* chk_open_wrap_folder
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(6, 136, 588, 140, _("Reception of flmsg file"));
{ Fl_Group* o = new Fl_Group(6, 136, 588, 145, _("Reception of flmsg file"));
o->box(FL_ENGRAVED_FRAME);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
{ Fl_Check_Button* o = chk_open_flmsg = new Fl_Check_Button(88, 171, 136, 20, _("Open with flmsg"));
@ -7321,21 +7321,7 @@ d frequency"));
chk_open_flmsg_print->callback((Fl_Callback*)cb_chk_open_flmsg_print);
o->value(progdefaults.open_flmsg_print);
} // Fl_Check_Button* chk_open_flmsg_print
{ Fl_Value_Slider* o = sldr_extract_timeout = new Fl_Value_Slider(40, 207, 364, 21, _("Timeout (secs)"));
sldr_extract_timeout->tooltip(_("Extract times out after NN seconds of inactivity."));
sldr_extract_timeout->type(5);
sldr_extract_timeout->color(FL_LIGHT3);
sldr_extract_timeout->selection_color(FL_FOREGROUND_COLOR);
sldr_extract_timeout->minimum(1);
sldr_extract_timeout->maximum(10);
sldr_extract_timeout->step(0.5);
sldr_extract_timeout->value(4);
sldr_extract_timeout->textsize(14);
sldr_extract_timeout->callback((Fl_Callback*)cb_sldr_extract_timeout);
sldr_extract_timeout->align(Fl_Align(FL_ALIGN_RIGHT));
o->value(progdefaults.extract_timeout);
} // Fl_Value_Slider* sldr_extract_timeout
{ Fl_Input2* o = txt_flmsg_pathname = new Fl_Input2(74, 242, 330, 24, _("flmsg:"));
{ Fl_Input2* o = txt_flmsg_pathname = new Fl_Input2(74, 200, 330, 24, _("flmsg:"));
txt_flmsg_pathname->tooltip(_("Enter full path-filename for flmsg"));
txt_flmsg_pathname->box(FL_DOWN_BOX);
txt_flmsg_pathname->color(FL_BACKGROUND2_COLOR);
@ -7349,10 +7335,24 @@ d frequency"));
txt_flmsg_pathname->when(FL_WHEN_CHANGED);
o->value(progdefaults.flmsg_pathname.c_str());
} // Fl_Input2* txt_flmsg_pathname
{ btn_select_flmsg = new Fl_Button(433, 242, 100, 24, _("Locate flmsg"));
{ btn_select_flmsg = new Fl_Button(411, 200, 100, 24, _("Locate flmsg"));
btn_select_flmsg->tooltip(_("Locate flmsg executable"));
btn_select_flmsg->callback((Fl_Callback*)cb_btn_select_flmsg);
} // Fl_Button* btn_select_flmsg
{ Fl_Value_Slider* o = sldr_extract_timeout = new Fl_Value_Slider(40, 239, 364, 21, _("Timeout (secs)"));
sldr_extract_timeout->tooltip(_("Extract times out after NN seconds of inactivity."));
sldr_extract_timeout->type(5);
sldr_extract_timeout->color(FL_LIGHT3);
sldr_extract_timeout->selection_color(FL_FOREGROUND_COLOR);
sldr_extract_timeout->minimum(1);
sldr_extract_timeout->maximum(10);
sldr_extract_timeout->step(0.5);
sldr_extract_timeout->value(4);
sldr_extract_timeout->textsize(14);
sldr_extract_timeout->callback((Fl_Callback*)cb_sldr_extract_timeout);
sldr_extract_timeout->align(Fl_Align(FL_ALIGN_RIGHT));
o->value(progdefaults.extract_timeout);
} // Fl_Value_Slider* sldr_extract_timeout
o->end();
} // Fl_Group* o
tabNBEMS->end();

Wyświetl plik

@ -3979,7 +3979,7 @@ progdefaults.changed = true;}
}
Fl_Group {} {
label {Reception of flmsg file} open
xywh {6 136 588 140} box ENGRAVED_FRAME align 21
xywh {6 136 588 145} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button chk_open_flmsg {
label {Open with flmsg}
@ -3995,25 +3995,25 @@ progdefaults.changed = true;}
tooltip {Open file with default browser} xywh {322 171 136 20} down_box DOWN_BOX
code0 {o->value(progdefaults.open_flmsg_print);}
}
Fl_Value_Slider sldr_extract_timeout {
label {Timeout (secs)}
callback {progdefaults.extract_timeout=o->value();
progdefaults.changed=true;}
tooltip {Extract times out after NN seconds of inactivity.} xywh {40 207 364 21} type {Horz Knob} color 54 selection_color 0 align 8 minimum 1 maximum 10 step 0.5 value 4 textsize 14
code0 {o->value(progdefaults.extract_timeout);}
}
Fl_Input txt_flmsg_pathname {
label {flmsg:}
callback {progdefaults.flmsg_pathname = o->value();
progdefaults.changed = true;}
tooltip {Enter full path-filename for flmsg} xywh {74 242 330 24} when 1
tooltip {Enter full path-filename for flmsg} xywh {74 200 330 24} when 1
code0 {o->value(progdefaults.flmsg_pathname.c_str());}
class Fl_Input2
}
Fl_Button btn_select_flmsg {
label {Locate flmsg}
callback {select_flmsg_pathname();}
tooltip {Locate flmsg executable} xywh {433 242 100 24}
tooltip {Locate flmsg executable} xywh {411 200 100 24}
}
Fl_Value_Slider sldr_extract_timeout {
label {Timeout (secs)}
callback {progdefaults.extract_timeout=o->value();
progdefaults.changed=true;}
tooltip {Extract times out after NN seconds of inactivity.} xywh {40 239 364 21} type {Horz Knob} color 54 selection_color 0 align 8 minimum 1 maximum 10 step 0.5 value 4 textsize 14
code0 {o->value(progdefaults.extract_timeout);}
}
}
}
@ -4649,7 +4649,7 @@ Function {createConfig()} {open return_type void
decl {class Fl_File_Chooser ;} {public global
}
Function {WefaxDestDirSet(Fl_File_Chooser *w, void *userdata)} {open return_type void
Function {WefaxDestDirSet(Fl_File_Chooser *w, void *userdata)} {return_type void
} {
code {/* http://www.fltk.org/documentation.php/doc-1.1/Fl_File_Chooser.html */
if( ( w->value() != NULL ) && ( ! w->shown() ) ) {
@ -4659,7 +4659,7 @@ if( ( w->value() != NULL ) && ( ! w->shown() ) ) {
}} {}
}
Function {NvtxCatalogSet(Fl_File_Chooser *w, void *userdata)} {open return_type void
Function {NvtxCatalogSet(Fl_File_Chooser *w, void *userdata)} {return_type void
} {
code {/* http://www.fltk.org/documentation.php/doc-1.1/Fl_File_Chooser.html */
if( ( w->value() != NULL ) && ( ! w->shown() ) ) {
@ -4669,5 +4669,4 @@ if( ( w->value() != NULL ) && ( ! w->shown() ) ) {
}} {}
}
Function {make_window()} {open
} {}
Function {make_window()} {} {}

Wyświetl plik

@ -6037,7 +6037,7 @@ static void put_rx_char_flmain(unsigned int data, int style)
asc = ascii2;
if (mode == MODE_RTTY || mode == MODE_CW)
asc = ascii;
if (extracting) {
if (extract_wrap || extract_flamp) {
asc = ascii3;
style = FTextBase::RECV;
}
@ -6051,7 +6051,7 @@ static void put_rx_char_flmain(unsigned int data, int style)
speak(data);
if (extracting) {
if (extract_wrap || extract_flamp) {
add_rx_char(data);
ReceiveText->add(asc[data & 0xFF], style);
} else if ((data & 0x80) == 0x80) {

Wyświetl plik

@ -426,10 +426,10 @@ extern Fl_Check_Button *chkAutoExtract;
extern Fl_Check_Button *chk_open_wrap_folder;
extern Fl_Check_Button *chk_open_flmsg;
extern Fl_Check_Button *chk_open_flmsg_print;
#include <FL/Fl_Value_Slider.H>
extern Fl_Value_Slider *sldr_extract_timeout;
extern Fl_Input2 *txt_flmsg_pathname;
extern Fl_Button *btn_select_flmsg;
#include <FL/Fl_Value_Slider.H>
extern Fl_Value_Slider *sldr_extract_timeout;
extern Fl_Group *tabPskmail;
extern Fl_Counter2 *cntServerCarrier;
extern Fl_Counter2 *cntServerOffset;

Wyświetl plik

@ -47,6 +47,10 @@ extern std::string FLMSG_ICS_dir;
extern std::string FLMSG_ICS_msg_dir;
extern std::string FLMSG_ICS_tmp_dir;
extern std::string FLAMP_dir;
extern std::string FLAMP_rx_dir;
extern std::string FLAMP_tx_dir;
extern std::string xmlfname;
extern std::string scDevice[2];

Wyświetl plik

@ -26,6 +26,7 @@ extern const char *txtWrapInfo;
extern void rx_extract_add(int c);
extern void select_flmsg_pathname();
extern bool extracting;
extern bool extract_wrap;
extern bool extract_flamp;
#endif

Wyświetl plik

@ -42,8 +42,8 @@
using namespace std;
const char *beg = "[WRAP:beg]";
const char *end = "[WRAP:end]";
const char *wrap_beg = "[WRAP:beg]";
const char *wrap_end = "[WRAP:end]";
const char *flmsg = "<flmsg>";
#ifdef __WIN32__
@ -62,7 +62,10 @@ Save tags and all enclosed text to date-time stamped file, ie:\n\
char rx_extract_buff[bufsize + 1];
string rx_buff;
string rx_extract_msg;
bool extracting = false;
bool extract_wrap = false;
bool extract_flamp = false;
bool bInit = false;
char dttm[64];
@ -72,7 +75,8 @@ void rx_extract_reset()
rx_buff.clear();
memset(rx_extract_buff, ' ', bufsize);
rx_extract_buff[bufsize] = 0;
extracting = false;
extract_wrap = false;
extract_flamp = false;
}
void rx_extract_timer(void *)
@ -92,6 +96,180 @@ void rx_remove_timer()
Fl::remove_timeout(rx_extract_timer);
}
void invoke_flmsg()
{
string cmd = progdefaults.flmsg_pathname;
REQ(rx_remove_timer);
struct tm tim;
time_t t;
time(&t);
gmtime_r(&t, &tim);
strftime(dttm, sizeof(dttm), "%Y%m%d-%H%M%S", &tim);
string outfilename = FLMSG_WRAP_recv_dir;
outfilename.append("extract-");
outfilename.append(dttm);
outfilename.append(".wrap");
ofstream extractstream(outfilename.c_str(), ios::binary);
if (extractstream) {
extractstream << rx_buff;
extractstream.close();
}
rx_extract_msg = "File saved in ";
rx_extract_msg.append(FLMSG_WRAP_recv_dir);
put_status(rx_extract_msg.c_str(), 20, STATUS_CLEAR);
if (progdefaults.open_nbems_folder)
open_recv_folder(FLMSG_WRAP_recv_dir.c_str());
if ((progdefaults.open_flmsg || progdefaults.open_flmsg_print) &&
(rx_buff.find(flmsg) != string::npos) &&
!progdefaults.flmsg_pathname.empty()) {
#ifdef __MINGW32__
cmd.append(" -title ").append(dttm);
cmd.append(" --flmsg-dir ").append("\"").append(FLMSG_dir).append("\"");
if (progdefaults.open_flmsg_print && progdefaults.open_flmsg)
cmd.append(" --b");
else if (progdefaults.open_flmsg_print)
cmd.append(" --p");
cmd.append(" \"").append(outfilename).append("\"");
char *cmdstr = strdup(cmd.c_str());
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
if (!CreateProcess( NULL, cmdstr,
NULL, NULL, FALSE,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
LOG_ERROR("CreateProcess failed with error code %ld", GetLastError());
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
free (cmdstr);
#else
string params = "";
static string ap[10];// = cmd;//"";
string param = "";
size_t p = cmd.find(" -");
if (p != string::npos) {
param.assign(cmd.substr(p));
cmd = cmd.substr(0,p);
}
for (int i = 0; i < 10; i++) ap[i].clear();
int n = 0;
ap[n++] = "-title"; ap[n++] = dttm;
ap[n++] = "--flmsg-dir"; ap[n++] = FLMSG_dir;
if (progdefaults.open_flmsg_print && progdefaults.open_flmsg)
ap[n++] = " --b";//params = " --b";
else if (progdefaults.open_flmsg_print)
ap[n++] = " --p";//params = " --p";
ap[n++] = outfilename;
switch (fork()) {
case 0:
# ifndef NDEBUG
unsetenv("MALLOC_CHECK_");
unsetenv("MALLOC_PERTURB_");
# endif
switch (n) {
case 1:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(),
(char*)0);
break;
case 2:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)0);
break;
case 3:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(),
(char*)0);
break;
case 4:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)0);
break;
case 5:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(),
(char*)0);
break;
case 6:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)0);
break;
case 7:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(),
(char*)0);
break;
case 8:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)0);
break;
case 9:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)ap[8].c_str(),
(char*)0);
break;
case 10:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)ap[8].c_str(), (char*)ap[9].c_str(),
(char*)0);
break;
default : ;
}
exit(EXIT_FAILURE);
case -1:
fl_alert2(_("Could not start flmsg"));
}
#endif
}
}
static const char flamp_beg[] = "<FLAMP";
static const char flamp_end[] = "{EOT}";
void rx_extract_add(int c)
{
if (!c) return;
@ -106,186 +284,30 @@ void rx_extract_add(int c)
memmove(rx_extract_buff, &rx_extract_buff[1], bufsize - 1);
rx_extract_buff[bufsize - 1] = ch;
if ( strstr(rx_extract_buff, beg) != NULL ) {
rx_buff = beg;
rx_extract_msg = "Extracting";
if ( strstr(rx_extract_buff, wrap_beg) && !extract_flamp) {
rx_buff.assign(wrap_beg);
rx_extract_msg = "Extract WRAP";
put_status(rx_extract_msg.c_str(), 60, STATUS_CLEAR);
memset(rx_extract_buff, ' ', bufsize);
extracting = true;
extract_wrap = true;
REQ(rx_remove_timer);
REQ(rx_add_timer);
} else if (extracting) {
} else if (extract_wrap) {
rx_buff += ch;
REQ(rx_remove_timer);
REQ(rx_add_timer);
if (strstr(rx_extract_buff, end) != NULL) {
REQ(rx_remove_timer);
struct tm tim;
time_t t;
time(&t);
gmtime_r(&t, &tim);
strftime(dttm, sizeof(dttm), "%Y%m%d-%H%M%S", &tim);
string outfilename = FLMSG_WRAP_recv_dir;
outfilename.append("extract-");
outfilename.append(dttm);
outfilename.append(".wrap");
ofstream extractstream(outfilename.c_str(), ios::binary);
if (extractstream) {
extractstream << rx_buff;
extractstream.close();
}
rx_extract_msg = "File saved in ";
rx_extract_msg.append(FLMSG_WRAP_recv_dir);
put_status(rx_extract_msg.c_str(), 20, STATUS_CLEAR);
if (progdefaults.open_nbems_folder)
open_recv_folder(FLMSG_WRAP_recv_dir.c_str());
if ((progdefaults.open_flmsg || progdefaults.open_flmsg_print) &&
(rx_buff.find(flmsg) != string::npos) &&
!progdefaults.flmsg_pathname.empty()) {
string cmd = progdefaults.flmsg_pathname;
#ifdef __MINGW32__
cmd.append(" -title ").append(dttm);
cmd.append(" --flmsg-dir ").append("\"").append(FLMSG_dir).append("\"");
if (progdefaults.open_flmsg_print && progdefaults.open_flmsg)
cmd.append(" --b");
else if (progdefaults.open_flmsg_print)
cmd.append(" --p");
cmd.append(" \"").append(outfilename).append("\"");
char *cmdstr = strdup(cmd.c_str());
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
memset(&pi, 0, sizeof(pi));
if (!CreateProcess( NULL, cmdstr,
NULL, NULL, FALSE,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi))
LOG_ERROR("CreateProcess failed with error code %ld", GetLastError());
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
free (cmdstr);
#else
string params = "";
static string ap[10];// = cmd;//"";
string param = "";
size_t p = cmd.find(" -");
if (p != string::npos) {
param.assign(cmd.substr(p));
cmd = cmd.substr(0,p);
}
for (int i = 0; i < 10; i++) ap[i].clear();
int n = 0;
ap[n++] = "-title"; ap[n++] = dttm;
ap[n++] = "--flmsg-dir"; ap[n++] = FLMSG_dir;
if (progdefaults.open_flmsg_print && progdefaults.open_flmsg)
ap[n++] = " --b";//params = " --b";
else if (progdefaults.open_flmsg_print)
ap[n++] = " --p";//params = " --p";
ap[n++] = outfilename;
switch (fork()) {
case 0:
# ifndef NDEBUG
unsetenv("MALLOC_CHECK_");
unsetenv("MALLOC_PERTURB_");
# endif
switch (n) {
case 1:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(),
(char*)0);
break;
case 2:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)0);
break;
case 3:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(),
(char*)0);
break;
case 4:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)0);
break;
case 5:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(),
(char*)0);
break;
case 6:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)0);
break;
case 7:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(),
(char*)0);
break;
case 8:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)0);
break;
case 9:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)ap[8].c_str(),
(char*)0);
break;
case 10:
execlp(
(char*)cmd.c_str(), (char*)cmd.c_str(),
(char*)ap[0].c_str(), (char*)ap[1].c_str(),
(char*)ap[2].c_str(), (char*)ap[3].c_str(),
(char*)ap[4].c_str(), (char*)ap[5].c_str(),
(char*)ap[6].c_str(), (char*)ap[7].c_str(),
(char*)ap[8].c_str(), (char*)ap[9].c_str(),
(char*)0);
break;
default : ;
}
exit(EXIT_FAILURE);
case -1:
fl_alert2(_("Could not start flmsg"));
}
#endif
}
if (strstr(rx_extract_buff, wrap_end) != NULL) {
invoke_flmsg();
rx_extract_reset();
}
} else if (strstr(rx_extract_buff, flamp_beg) && ! extract_wrap) {
extract_flamp = true;
} else if (extract_flamp == true) {
REQ(rx_remove_timer);
REQ(rx_add_timer);
if (strstr(rx_extract_buff, flamp_end) != NULL) {
rx_extract_reset();
}
}
@ -313,3 +335,4 @@ void select_flmsg_pathname()
}
#endif
}

Wyświetl plik

@ -272,11 +272,6 @@ int main(int argc, char ** argv)
}
#endif
}
generate_option_help();
int arg_idx;
if (Fl::args(argc, argv, arg_idx, parse_args) != argc)
arg_error(argv[0], NULL, false);
{
#ifdef __WOE32__
@ -291,6 +286,11 @@ int main(int argc, char ** argv)
if (FLMSG_dir.empty()) FLMSG_dir_default = NBEMS_dir;
#endif
}
generate_option_help();
int arg_idx;
if (Fl::args(argc, argv, arg_idx, parse_args) != argc)
arg_error(argv[0], NULL, false);
if (main_window_title.empty())
main_window_title = PACKAGE_TARNAME;

Wyświetl plik

@ -68,7 +68,7 @@ using namespace std;
//======================================================================
// test code for pskmail eol issues
const char *asc[256] = {
static const char *asc[128] = {
"<NUL>", "<SOH>", "<STX>", "<ETX>",
"<EOT>", "<ENQ>", "<ACK>", "<BEL>",
"<BS>", "<TAB>", "<LF>", "<VT>",
@ -107,7 +107,7 @@ string noctrl(string src)
{
static string retstr;
retstr.clear();
for (size_t i = 0; i < src.length(); i++) retstr.append(asc[(int)src[i]]);
for (size_t i = 0; i < src.length(); i++) retstr.append(asc[(int)src[i] & 0x7F]);
return retstr;
}
@ -653,14 +653,6 @@ void WriteARQSysV(unsigned char data)
}
#endif
void WriteARQ(unsigned char data)
{
WriteARQsocket(&data, 1);
#if !defined(__WOE32__) && !defined(__APPLE__)
WriteARQSysV(data);
#endif
}
//-----------------------------------------------------------------------------
// Write End of Transmit character to ARQ client
//-----------------------------------------------------------------------------
@ -684,6 +676,22 @@ static void *arq_loop(void *args);
static bool arq_exit = false;
static bool arq_enabled;
string tosend = "";
string enroute = "";
void WriteARQ(unsigned char data)
{
pthread_mutex_lock (&arq_mutex);
tosend += data;
pthread_mutex_unlock (&arq_mutex);
return;
// WriteARQsocket(&data, 1);
//#if !defined(__WOE32__) && !defined(__APPLE__)
// WriteARQSysV(data);
//#endif
}
static void *arq_loop(void *args)
{
SET_THREAD_ID(ARQ_TID);
@ -695,6 +703,18 @@ static void *arq_loop(void *args)
pthread_mutex_lock (&arq_mutex);
if (!tosend.empty()) {
enroute = tosend;
tosend.clear();
pthread_mutex_unlock (&arq_mutex);
WriteARQsocket((unsigned char*)enroute.c_str(), enroute.length());
#if !defined(__WOE32__) && !defined(__APPLE__)
for (size_t i = 0; i < enroute.length(); i++)
WriteARQSysV((unsigned char)enroute[i]);
#endif
} else
pthread_mutex_unlock (&arq_mutex);
if (bSend0x06)
send0x06();
@ -709,8 +729,8 @@ static void *arq_loop(void *args)
if (!Socket_arqRx())
WRAP_auto_arqRx();
#endif
pthread_mutex_unlock (&arq_mutex);
MilliSleep(50);
// pthread_mutex_unlock (&arq_mutex);
MilliSleep(100);
}
// exit the arq thread