int parse_logcfg(char *inputbuffer) { extern int use_rxvt; extern char message[][80]; extern char ph_message[14][80]; extern char sp_return[]; extern char cq_return[]; extern char call[]; extern char whichcontest[]; extern char logfile[]; extern int keyerport; extern int recall_mult; extern int one_point; extern int two_point; extern int three_point; extern int exchange_serial; extern int country_mult; extern int wysiwyg_multi; extern int wysiwyg_once; extern float fixedmult; extern int portable_x2; extern int trx_control; extern int rit; extern int shortqsonr; extern int cluster; extern int clusterlog; extern int showscore_flag; extern int searchflg; extern int demode; extern int contest; extern int weight; extern int txdelay; extern char tonestr[]; extern int showfreq; extern int editor; extern int partials; extern int use_part; extern int mixedmode; extern char pr_hostaddress[]; extern int portnum; extern int packetinterface; extern int tncport; extern int tnc_serial_rate; extern char lastwwv[]; extern int serial_rate; #ifdef HAVE_LIBHAMLIB extern rig_model_t myrig_model; #endif extern char rigportname[]; extern int rignumber; extern char rigconf[]; extern char exchange_list[40]; extern char tncportname[]; extern int netkeyer_port; extern char netkeyer_hostaddress[]; extern char bc_hostaddress[MAXNODES][16]; extern char bc_hostservice[MAXNODES][16]; extern int lan_active; extern char thisnode; extern int nodes; extern int node; extern int cqwwm2; extern int landebug; extern int call_update; extern int timeoffset; extern int time_master; extern int ctcomp; extern char multsfile[]; extern int multlist; extern int universal; extern int serial_section_mult; extern int serial_grid4_mult; extern int sectn_mult; extern int dx_arrlsections; extern int pfxmult; extern int exc_cont; extern int wpx; extern char markerfile[]; extern int xplanet; extern int nob4; extern int noautocq; extern int show_time; extern char keyer_device[10]; extern int wazmult; extern int itumult; extern int cqdelay; extern int trxmode; extern int use_bandoutput; extern int no_arrows; extern int bandindexarray[]; extern int ssbpoints; extern int cwpoints; extern int lowband_point_mult; extern int sc_sidetone; extern char sc_volume[]; extern char modem_mode[]; extern int no_rst; extern int serial_or_section; /* LZ3NY mods */ extern int mult_side; extern int my_country_points; extern int my_cont_points; extern int dx_cont_points; extern int countrylist_points; extern int countrylist_only; extern int continentlist_points; extern int continentlist_only; char c_temp[11]; extern int my_cont_points; extern int dx_cont_points; extern int mult_side; extern char countrylist[][6]; extern char continent_multiplier_list[7][3]; extern int exclude_multilist_type; /* end LZ3NY mods */ extern int tlfcolors[8][2]; extern char synclogfile[]; extern int scale_values[]; extern char sc_device[40]; extern char controllerport[80]; // port for multi-mode controller extern char clusterlogin[]; extern int cw_bandwidth; extern int change_rst; extern char rttyoutput[]; extern int logfrequency; extern int ignoredupe; extern char myqra[7]; extern int bandweight_points[NBANDS]; extern int bandweight_multis[NBANDS]; extern t_pfxnummulti pfxnummulti[MAXPFXNUMMULT]; extern int pfxnummultinr; extern int pfxmultab; extern int bmautoadd; extern int bmautograb; extern int sprint_mode; char commands[MAX_COMMANDS][30] = { "enable", /* 0 */ /* deprecated */ "disable", /* deprecated */ "F1", "F2", "F3", "F4", /* 5 */ "F5", "F6", "F7", "F8", "F9", /* 10 */ "F10", "F11", "F12", "S&P_TU_MSG", "CQ_TU_MSG", /* 15 */ "CALL", "CONTEST", "LOGFILE", "KEYER_DEVICE", "BANDOUTPUT", /* 20 */ "RECALL_MULTS", "ONE_POINT", "THREE_POINTS", "WYSIWYG_MULTIBAND", "WYSIWYG_ONCE", /* 25 */ "RADIO_CONTROL", "RIT_CLEAR", "SHORT_SERIAL", "LONG_SERIAL", "CONTEST_MODE", /* 30 */ "CLUSTER", "BANDMAP", "SPOTLIST", /* deprecated */ "SCOREWINDOW", "CHECKWINDOW", /* 35 */ "FILTER", /* deprecated */ "SEND_DE", "CWSPEED", "CWTONE", "WEIGHT", /* 40 */ "TXDELAY", "SUNSPOTS", "SFI", "SHOW_FREQUENCY", "EDITOR", /* 45 */ "PARTIALS", "USEPARTIALS", "POWERMULT_5", /* deprecated */ "POWERMULT_2", /* deprecated */ "POWERMULT_1", /* 50 */ /* deprecated */ "MANY_CALLS", /* deprecated */ "SERIAL_EXCHANGE", "COUNTRY_MULT", "2EU3DX_POINTS", "PORTABLE_MULT_2", /* 55 */ "MIXED", "TELNETHOST", "TELNETPORT", "TNCPORT", "FIFO_INTERFACE", /* 60 */ "RIGMODEL", "RIGSPEED", "TNCSPEED", "RIGPORT", "NETKEYER", /* 65 */ "NETKEYERPORT", "NETKEYERHOST", "ADDNODE", "THISNODE", "CQWW_M2", /* 70 */ "LAN_DEBUG", "ALT_0", "ALT_1", "ALT_2", "ALT_3", /* 75 */ "ALT_4", "ALT_5", "ALT_6", "ALT_7", "ALT_8", /* 80 */ "ALT_9", "CALLUPDATE", "TIME_OFFSET", "TIME_MASTER", "CTCOMPATIBLE", /* 85 */ "TWO_POINTS", "MULT_LIST", "SERIAL+SECTION", "SECTION_MULT", "MARKERS", /* 90 */ "DX_&_SECTIONS", "MARKERDOTS", "MARKERCALLS", "NOB4", /*LZ3NY */ "COUNTRYLIST", //by lz3ny /* 95 */ "COUNTRY_LIST_POINTS", //by lz3ny "USE_COUNTRYLIST_ONLY", //by lz3ny "MY_COUNTRY_POINTS", //by lz3ny "MY_CONTINENT_POINTS", //by lz3ny "DX_POINTS", //by lz3ny /* 100 */ "SHOW_TIME", "RXVT", "VKM1", "VKM2", "VKM3", /* 105 */ "VKM4", "VKM5", "VKM6", "VKM7", "VKM8", /* 110 */ "VKM9", "VKM10", "VKM11", "VKM12", "VKSPM", /* 115 */ "VKCQM", "WAZMULT", "ITUMULT", "CQDELAY", "PFX_MULT", /* 120 */ "CONTINENT_EXCHANGE", "RULES", "NOAUTOCQ", "SSBMODE", "NO_BANDSWITCH_ARROWKEYS", /* 125 */ "RIGCONF", "TLFCOLOR1", "TLFCOLOR2", "TLFCOLOR3", "TLFCOLOR4", /* 130 */ "TLFCOLOR5", "TLFCOLOR6", "SYNCFILE", "SSBPOINTS", "CWPOINTS", /* 135 */ "SOUNDCARD", "SIDETONE_VOLUME", "S_METER", "SC_DEVICE", "MFJ1278_KEYER", /* 140 */ "CLUSTERLOGIN", "ORION_KEYER", "INITIAL_EXCHANGE", "CWBANDWIDTH", "LOWBAND_DOUBLE", /* 145 */ "CLUSTER_LOG", "SERIAL+GRID4", "CHANGE_RST", "GMFSK", "RTTYMODE", /* 150 */ "DIGIMODEM", "LOGFREQUENCY", "IGNOREDUPE", "CABRILLO", "CW_TU_MSG", /* 155 */ /* deprecated */ "VKCWR", /* deprecated */ "VKSPR", /* deprecated */ "NO_RST", "MYQRA", "POWERMULT", /* 160 */ "SERIAL_OR_SECTION", "QTC", "CONTINENTLIST", "CONTINENT_LIST_POINTS", "USE_CONTINENTLIST_ONLY", /* 165 */ "BANDWEIGHT_POINTS", "BANDWEIGHT_MULTIS", "PFX_NUM_MULTIS", "PFX_MULT_MULTIBAND", "QR_F1", /* 170 */ "QR_F2", "QR_F3", "QR_F4", "QR_F5", "QR_F6", /* 175 */ "QR_F7", "QR_F8", "QR_F9", "QR_F10", "QR_F11", /* 180 */ "QR_F12", "QS_F1", "QS_F2", "QS_F3", "QS_F4", "QS_F5", "QS_F6", "QS_F7", "QS_F8", "QS_F9", /* 190 */ "QS_F10", "QS_F11", "QS_F12", "QR_VKM1", "QR_VKM2", "QR_VKM3", "QR_VKM4", "QR_VKM5", "QR_VKM6", "QR_VKM7", /* 200 */ "QR_VKM8", "QR_VKM9", "QR_VKM10", "QR_VKM11", "QR_VKM12", "QR_VKSPM", "QR_VKCQM", "QS_VKM1", "QS_VKM2", "QS_VKM3", /* 210 */ "QS_VKM4", "QS_VKM5", "QS_VKM6", "QS_VKM7", "QS_VKM8", "QS_VKM9", "QS_VKM10", "QS_VKM11", "QS_VKM12", "QS_VKSPM", /* 220 */ "QS_VKCQM", "QTCREC_RECORD", "QTCREC_RECORD_COMMAND", "EXCLUDE_MULTILIST", "S&P_CALL_MSG", "QTC_CAP_CALLS", "QTC_AUTO_FILLTIME", "BMAUTOGRAB", "BMAUTOADD", "QTC_RECV_LAZY", /* 230 */ "SPRINTMODE" }; char **fields; char teststring[80]; char buff[40]; char outputbuff[80]; int ii; char *j; int jj, hh; char *tk_ptr; /* split the inputline at '=' to max 2 elements * * leave the components in fields[0] (keyword) and * fields[1] for the parameters * * if only 1 component (no '='), it is only a keyword * g_strstrip it and test for keywordlist * * if 2 components (there is a '=' in the line) * g_strstrip first component and test for keywordlist * g_strchug second component -> strip leading space from parameters * * That allows plain keywords and also keywords with parameters (which * follows a '=' sign */ confirmation_needed = PARSE_OK; fields = g_strsplit( inputbuffer, "=", 2); g_strstrip( fields[0] ); if ( *fields[0] == '\0' ) { /* only whitespace found? */ g_strfreev( fields ); return( PARSE_OK ); } if (g_strv_length( fields ) == 2) { /* strip leading whitespace */ g_strchug( fields[1] ); /* from parameters */ } g_strlcpy( teststring, fields[0], sizeof(teststring) ); for (ii = 0; ii < MAX_COMMANDS; ii++) { if (strcmp(teststring, commands[ii]) == 0) { break; } } switch (ii) { case 0:{ KeywordNotSupported(teststring); break; } case 1:{ KeywordNotSupported(teststring); break; } case 2 ... 10:{ /* messages */ PARAMETER_NEEDED(teststring); strcpy(message[ii - 2], fields[1]); break; } case 11 ... 13:{ PARAMETER_NEEDED(teststring); strcpy(message[ii - 2], fields[1]); break; } case 14:{ PARAMETER_NEEDED(teststring); strcpy(message[SP_TU_MSG], fields[1]); strcpy(sp_return, message[SP_TU_MSG]); break; } case 15:{ PARAMETER_NEEDED(teststring); strcpy(message[CQ_TU_MSG], fields[1]); strcpy(cq_return, message[CQ_TU_MSG]); break; /* end messages */ } case 16:{ char *tmpcall; PARAMETER_NEEDED(teststring); if (strlen(fields[1]) > 20) { mvprintw(6,0, "WARNING: Defined call sign too long! exiting...\n"); refreshp(); exit(1); } if (strlen(fields[1]) == 0) { mvprintw(6, 0, "WARNING: No callsign defined in logcfg.dat! exiting...\n"); refreshp(); exit(1); } /* strip NL and trailing whitespace, convert to upper case */ tmpcall = g_ascii_strup(g_strchomp(fields[1]), -1); g_strlcpy( call, tmpcall, 20 ); g_free(tmpcall); /* as other code parts rely on a trailing NL on the call * we add back such a NL for now */ strcat( call, "\n"); // check that call sign can be found in cty database !! break; } case 17: case 122:{ PARAMETER_NEEDED(teststring); strcpy(whichcontest, g_strchomp(fields[1])); if (strlen(whichcontest) > 40) { showmsg ("WARNING: contest name is too long! exiting..."); exit(1); } setcontest(); break; } case 18:{ PARAMETER_NEEDED(teststring); strcpy(logfile, g_strchomp(fields[1])); break; } case 19:{ PARAMETER_NEEDED(teststring); g_strlcpy(keyer_device, g_strchomp(fields[1]), sizeof(keyer_device)); break; } case 20:{ // Use the bandswitch output on parport0 /* \todo add message if parameter too short */ use_bandoutput = 1; if ((fields[1] != NULL) && (strlen(fields[1]) >= 10)) { for (jj = 0; jj <= 9; jj++) // 10x { hh = ((int) (fields[1][jj])) - 48; if (hh >= 0 && hh <= 9) bandindexarray[jj] = hh; else bandindexarray[jj] = 0; } } break; } case 21:{ recall_mult = 1; break; } case 22:{ one_point = 1; universal = 1; break; } case 23:{ three_point = 1; universal = 1; break; } case 24:{ wysiwyg_multi = 1; break; } case 25:{ wysiwyg_once = 1; break; } case 26:{ trx_control = 1; break; } case 27:{ rit = 1; break; } case 28:{ shortqsonr = 1; break; } case 29:{ shortqsonr = 0; break; } case 30:{ contest = 1; break; } case 31:{ cluster = CLUSTER; break; } case 32:{ cluster = MAP; /* init bandmap filtering */ bm_config.allband = 1; bm_config.allmode = 1; bm_config.showdupes = 1; bm_config.skipdupes = 0; bm_config.livetime = 900; /* Allow configuration of bandmap display if keyword * is followed by a '=' * Parameter format is BANDMAP=<xxx>,<number> * <xxx> - string parsed for the letters B, M, D and S * <number> - spot livetime in seconds (>=30) */ if (fields[1] != NULL) { char **bm_fields; bm_fields = g_strsplit(fields[1], ",", 2); if (bm_fields[0] != NULL) { char *ptr = bm_fields[0]; while (*ptr != '\0') { switch (*ptr++) { case 'B': bm_config.allband = 0; break; case 'M': bm_config.allmode = 0; break; case 'D': bm_config.showdupes = 0; break; case 'S': bm_config.skipdupes = 1; break; default: break; } } } if (bm_fields[1] != NULL) { int livetime; g_strstrip(bm_fields[1]); livetime = atoi(bm_fields[1]); if (livetime >= 30) /* aging called each second */ bm_config.livetime = livetime; } g_strfreev(bm_fields); } break; } case 33:{ KeywordNotSupported(teststring); break; } case 34:{ showscore_flag = 1; break; } case 35:{ searchflg = 1; break; } case 36:{ KeywordNotSupported(teststring); break; } case 37:{ demode = 1; break; } case 38:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strncat(buff, fields[1], 2); SetCWSpeed(atoi(buff)); break; } case 39:{ int tone; PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); tone = atoi(buff); if ((tone > -1) && (tone < 1000)) { sprintf(tonestr, "%d", tone); } break; } case 40:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); weight = atoi(buff); if (weight < -50) weight = -50; if (weight > 50) weight = 50; break; } case 41:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); txdelay = atoi(buff); if (txdelay > 50) txdelay = 50; if (txdelay < 0) txdelay = 0; break; } case 42:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); outputbuff[0] = '\0'; sprintf(outputbuff, "WWV R=%d\n", atoi(buff)); strcpy(lastwwv, outputbuff); break; } case 43:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); outputbuff[0] = '\0'; sprintf(outputbuff, "WWV SFI=%d\n", atoi(buff)); strcpy(lastwwv, outputbuff); break; } case 44:{ showfreq = 1; break; } case 45:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); if ((strncmp(buff, "mcedit", 6) == 0) || (strncmp(buff, "mc", 2) == 0) || (strncmp(buff, "MC", 2) == 0)) { editor = EDITOR_MC; break; } j = strstr(fields[1], "joe"); if (j != NULL) { editor = EDITOR_JOE; break; } j = strstr(fields[1], "vi"); if (j != NULL) { editor = EDITOR_VI; break; } else { editor = EDITOR_E3; break; } } case 46:{ partials = 1; break; } case 47:{ use_part = 1; break; } /*case 48:{ fixedmult = 5; break; } case 49:{ fixedmult = 2; break; } case 50:{ fixedmult = 1; break; } */ case 51:{ KeywordNotSupported(teststring); break; } case 52:{ exchange_serial = 1; break; } case 53:{ country_mult = 1; break; } case 54:{ KeywordNotSupported(teststring); break; } case 55:{ portable_x2 = 1; break; } case 56:{ mixedmode = 1; break; } case 57:{ PARAMETER_NEEDED(teststring); g_strlcpy(pr_hostaddress, g_strchomp(fields[1]), 48); break; } case 58:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strncat(buff, fields[1], 5); portnum = atoi(buff); packetinterface = TELNET_INTERFACE; break; } case 59:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); if (strlen(buff) > 2) { strncpy(tncportname, buff, 39); } else tncport = atoi(buff) + 1; packetinterface = TNC_INTERFACE; break; } case 60:{ packetinterface = FIFO_INTERFACE; break; } case 61:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); if (strncmp(buff, "ORION", 5) == 0) rignumber = 2000; else rignumber = atoi(buff); #ifdef HAVE_LIBHAMLIB myrig_model = (rig_model_t) rignumber; #endif break; } case 62:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); serial_rate = atoi(buff); break; } case 63:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); tnc_serial_rate = atoi(buff); break; } case 64:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strcat(buff, fields[1]); strncpy(rigportname, buff, 39); break; } case 65:{ keyerport = NET_KEYER; break; } case 66:{ PARAMETER_NEEDED(teststring); netkeyer_port = atoi(fields[1]); break; } case 67:{ PARAMETER_NEEDED(teststring); g_strlcpy(netkeyer_hostaddress, g_strchomp(fields[1]), 16); break; } case 68:{ PARAMETER_NEEDED(teststring); if (node < MAXNODES) { /* split host name and port number, separated by colon */ char **an_fields; an_fields = g_strsplit(fields[1], ":", 2); /* copy host name */ g_strlcpy(bc_hostaddress[node], g_strchomp(an_fields[0]), sizeof(bc_hostaddress[0])); if (an_fields[1] != NULL) { /* copy host port, if found */ g_strlcpy(bc_hostservice[node], g_strchomp(an_fields[1]), sizeof(bc_hostservice[0])); } g_strfreev(an_fields); if (node++ < MAXNODES) nodes++; } lan_active = 1; break; } case 69:{ char c; PARAMETER_NEEDED(teststring); c = toupper(fields[1][0]); if (c >= 'A' && c <= 'H') thisnode = c; else WrongFormat(teststring); break; } case 70:{ cqwwm2 = 1; break; } case 71:{ landebug = 1; break; } case 72 ... 81:{ /* messages */ PARAMETER_NEEDED(teststring); strcpy(message[ii - 58], fields[1]); break; } case 82:{ call_update = 1; break; } case 83:{ PARAMETER_NEEDED(teststring); buff[0] = '\0'; strncat(buff, fields[1], 3); timeoffset = atoi(buff); if (timeoffset > 23) timeoffset = 23; if (timeoffset < -23) timeoffset = -23; break; } case 84:{ time_master = 1; break; } case 85:{ ctcomp = 1; break; } case 86:{ two_point = 1; universal = 1; break; } case 87:{ PARAMETER_NEEDED(teststring); g_strlcpy(multsfile, g_strchomp(fields[1]), 80); multlist = 1; universal = 1; break; } case 88:{ serial_section_mult = 1; break; } case 89:{ sectn_mult = 1; break; } case 90:{ PARAMETER_NEEDED(teststring); strcpy(markerfile, g_strchomp(fields[1])); xplanet = 1; break; } case 91:{ dx_arrlsections = 1; setcontest(); break; } case 92:{ PARAMETER_NEEDED(teststring); strcpy(markerfile, g_strchomp(fields[1])); xplanet = 2; break; } case 93:{ PARAMETER_NEEDED(teststring); strcpy(markerfile, g_strchomp(fields[1])); xplanet = 3; break; } case 94:{ nob4 = 1; break; } case 95:{ /* COUNTRYLIST (in file or listed in logcfg.dat) LZ3NY */ int counter = 0; static char country_list_raw[50] = ""; /* use only first COUNTRY_LIST definition */ char temp_buffer[255] = ""; char buffer[255] = ""; FILE *fp; PARAMETER_NEEDED(teststring); if (strlen(country_list_raw) == 0) {/* only if first definition */ /* First of all we are checking if the parameter <xxx> in COUNTRY_LIST=<xxx> is a file name. If it is we start parsing the file. If we find a line starting with our case insensitive contest name, we copy the countries from that line into country_list_raw. If the input was not a file name we directly copy it into country_list_raw (must not have a preceeding contest name). */ g_strlcpy(temp_buffer, fields[1], sizeof(temp_buffer)); g_strchomp(temp_buffer); /* drop trailing whitespace */ if ((fp = fopen(temp_buffer, "r")) != NULL) { while ( fgets(buffer, sizeof(buffer), fp) != NULL ) { g_strchomp( buffer ); /* no trailing whitespace*/ /* accept only a line starting with the contest name * (CONTEST=) followed by ':' */ if (strncasecmp (buffer, whichcontest, strlen(whichcontest) - 1) == 0) { strncpy(country_list_raw, buffer + strlen(whichcontest) + 1, strlen(buffer) - 1); } } fclose(fp); } else { /* not a file */ if (strlen(temp_buffer) > 0) strcpy(country_list_raw, temp_buffer); } } /* parse the country_list_raw string into an array * (countrylist) for future use. */ tk_ptr = strtok(country_list_raw, ":,.- \t"); counter = 0; if (tk_ptr != NULL) { while (tk_ptr) { strcpy(countrylist[counter], tk_ptr); tk_ptr = strtok(NULL, ":,.-_\t "); counter++; } } /* on which multiplier side of the rules we are */ getpx(call); mult_side = exist_in_country_list(); setcontest(); break; } case 96:{ // COUNTRY_LIST_POINTS PARAMETER_NEEDED(teststring); g_strlcpy(c_temp, fields[1], sizeof(c_temp)); if (countrylist_points == -1) countrylist_points = atoi(c_temp); break; } case 97:{ // COUNTRY_LIST_ONLY countrylist_only = 1; if (mult_side == 1) countrylist_only = 0; break; } case 98:{ //HOW Many points scores my country lz3ny PARAMETER_NEEDED(teststring); g_strlcpy(c_temp, fields[1], sizeof(c_temp)); if (my_country_points == -1) my_country_points = atoi(c_temp); break; } case 99:{ //MY_CONTINENT_POINTS lz3ny PARAMETER_NEEDED(teststring); g_strlcpy(c_temp, fields[1], sizeof(c_temp)); if (my_cont_points == -1) my_cont_points = atoi(c_temp); break; } case 100:{ //DX_CONTINENT_POINTS lz3ny PARAMETER_NEEDED(teststring); g_strlcpy(c_temp, fields[1], sizeof(c_temp)); if (dx_cont_points == -1) dx_cont_points = atoi(c_temp); break; } /* end LZ3NY mod */ case 101:{ // show time in searchlog window show_time = 1; break; } case 102:{ // use rxvt colours use_rxvt = 1; break; } case 103 ... 116:{ // get phone messages PARAMETER_NEEDED(teststring); g_strlcpy(ph_message[ii - 103], g_strchomp(fields[1]), 71); mvprintw(15, 5, "A: Phone message #%d is %s", ii - 103, ph_message[ii - 103]); // (W9WI) refreshp(); // system ("sleep 2"); break; } case 117:{ // WAZ Zone is a Multiplier wazmult = 1; break; } case 118:{ // ITU Zone is a Multiplier itumult = 1; break; } case 119:{ // CQ Delay (0.5 sec) PARAMETER_NEEDED(teststring); buff[0] = '\0'; strncpy(buff, fields[1], 3); cqdelay = atoi(buff); if ((cqdelay < 3) || (cqdelay > 60)) cqdelay = 20; break; } case 120:{ // wpx style prefixes mult pfxmult = 1; // enable set points wpx = 1; // handle like wpx break; } case 121:{ // exchange continent abbrev exc_cont = 1; break; } case 123:{ // don't use auto_cq noautocq = 1; break; } case 124:{ // start in SSB mode trxmode = SSBMODE; break; } case 125:{ // arrow keys don't switch bands... no_arrows = 1; break; } case 126:{ // Hamlib rig conf parameters PARAMETER_NEEDED(teststring); if (strlen(fields[1]) >= 80) { showmsg ("WARNING: rigconf parameters too long! exiting..."); sleep(5); exit(1); } g_strlcpy(rigconf, g_strchomp(fields[1]), 80); // RIGCONF= break; } case 127:{ // define color GREEN (header) PARAMETER_NEEDED(teststring); if (strlen(fields[1]) >= 2 && isdigit(fields[1][0]) && isdigit(fields[1][1])) { tlfcolors[1][0] = fields[1][0] - 48; tlfcolors[1][1] = fields[1][1] - 48; } else { WrongFormat(teststring); } break; } case 128 ... 132:{ // define color CYAN (windows), WHITE (log win) // MAGENTA (Marker / dupes), BLUE (input field) // and YELLOW (Window frames) PARAMETER_NEEDED(teststring); if (strlen(fields[1]) >= 2 && isdigit(fields[1][0]) && isdigit(fields[1][1])) { tlfcolors[ii - 128 + 3][0] = fields[1][0] - 48; tlfcolors[ii - 128 + 3][1] = fields[1][1] - 48; } else { WrongFormat(teststring); } break; } case 133:{ // define name of synclogfile PARAMETER_NEEDED(teststring); strcpy(synclogfile, g_strchomp(fields[1])); break; } case 134:{ //SSBPOINTS= PARAMETER_NEEDED(teststring); strcpy(buff, fields[1]); ssbpoints = atoi(buff); break; } case 135:{ //CWPOINTS= PARAMETER_NEEDED(teststring); strcpy(buff, fields[1]); cwpoints = atoi(buff); break; } case 136:{ // SOUNDCARD, use soundcard for cw sidetone sc_sidetone = 1; break; } case 137:{ // sound card volume (default = 70) int volume; PARAMETER_NEEDED(teststring); volume = atoi(fields[1]); if (volume > -1 && volume < 101) sprintf(sc_volume, "%d", volume); else strcpy(sc_volume, "70"); break; } case 138:{ int i = 0; PARAMETER_NEEDED(teststring); tk_ptr = strtok(fields[1], ":,.-_\t "); if (tk_ptr != NULL) { while (tk_ptr) { if (i < 20) scale_values[i] = atoi(tk_ptr); tk_ptr = strtok(NULL, ":,.-_\t "); i++; } } break; } case 139:{ // dsp for s-meter PARAMETER_NEEDED(teststring); g_strlcpy(sc_device, g_strchomp(fields[1]), sizeof(sc_device)); break; } case 140:{ PARAMETER_NEEDED(teststring); keyerport = MFJ1278_KEYER; g_strlcpy(controllerport, g_strchomp(fields[1]), sizeof(controllerport)); break; } case 141:{ PARAMETER_NEEDED(teststring); strcpy(clusterlogin, fields[1]); break; } case 142:{ KeywordNotSupported(teststring); break; } case 143:{ PARAMETER_NEEDED(teststring); g_strlcpy(exchange_list, g_strchomp(fields[1]), sizeof(exchange_list)); break; } case 144:{ PARAMETER_NEEDED(teststring); cw_bandwidth = atoi(fields[1]); break; } case 145:{ lowband_point_mult = 1; break; } case 146:{ clusterlog = 1; break; } case 147:{ serial_grid4_mult = 1; break; } case 148:{ change_rst = 1; break; } case 149:{ PARAMETER_NEEDED(teststring); keyerport = GMFSK; g_strlcpy(controllerport, g_strchomp(fields[1]), sizeof(controllerport)); break; } case 150:{ // start in digital mode trxmode = DIGIMODE; strcpy(modem_mode, "RTTY"); break; } case 151:{ PARAMETER_NEEDED(teststring); g_strlcpy(rttyoutput, g_strchomp(fields[1]), 111); break; } case 152:{ logfrequency = 1; break; } case 153:{ ignoredupe = 1; break; } case 154:{ /* read name of cabrillo format to use */ if (cabrillo != NULL) { free(cabrillo); /* free old string if already set */ cabrillo = NULL; } cabrillo = strdup(g_strchomp(fields[1])); break; } case 155: case 156: case 157:{ KeywordNotSupported(teststring); break; } case 158:{ no_rst = 1; break; } case 159:{ PARAMETER_NEEDED(teststring); strcpy(myqra, fields[1]); if (check_qra(myqra) > 0) { showmsg ("WARNING: Invalid MYQRA parameters! exiting..."); sleep(5); exit(1); } break; } case 160:{ PARAMETER_NEEDED(teststring); if (fixedmult == 0.0 && atof(fields[1]) > 0.0) { fixedmult = atof(fields[1]); } break; } case 161:{ serial_or_section = 1; break; } case 162:{ PARAMETER_NEEDED(teststring); if (strncmp(fields[1], "RECV", 4) == 0) { qtcdirection = RECV; } if (strncmp(fields[1], "SEND", 4) == 0) { qtcdirection = SEND; } else if (strcmp(fields[1], "BOTH")) { qtcdirection = RECV | SEND; } if (qtcdirection == 0) { KeywordNotSupported(teststring); } else { int q; for(q=0; q<QTC_RY_LINE_NR; q++) { qtc_ry_lines[q].content[0] = '\0'; qtc_ry_lines[q].attr = 0; } } break; } case 163:{ /* based on LZ3NY code, by HA2OS CONTINENT_LIST (in file or listed in logcfg.dat), First of all we are checking if inserted data in CONTINENT_LIST= is a file name. If it is we start parsing the file. If we got our case insensitive contest name, we copy the multipliers from it into multipliers_list. If the input was not a file name we directly copy it into cont_multiplier_list (must not have a preceeding contest name). The last step is to parse the multipliers_list into an array (continent_multiplier_list) for future use. */ int counter = 0; static char cont_multiplier_list[50] = ""; /* use only first CONTINENT_LIST definition */ char temp_buffer[255] = ""; char buffer[255] = ""; FILE *fp; PARAMETER_NEEDED(teststring); if (strlen(cont_multiplier_list) == 0) { /* if first definition */ g_strlcpy(temp_buffer, fields[1], sizeof(temp_buffer)); g_strchomp(temp_buffer); /* drop trailing whitespace */ if ((fp = fopen(temp_buffer, "r")) != NULL) { while ( fgets(buffer, sizeof(buffer), fp) != NULL ) { g_strchomp( buffer ); /* no trailing whitespace*/ /* accept only a line starting with the contest name * (CONTEST=) followed by ':' */ if (strncasecmp (buffer, whichcontest, strlen(whichcontest) - 1) == 0) { strncpy(cont_multiplier_list, buffer + strlen(whichcontest) + 1, strlen(buffer) - 1); } } fclose(fp); } else { /* not a file */ if (strlen(temp_buffer) > 0) strcpy(cont_multiplier_list, temp_buffer); } } /* creating the array */ tk_ptr = strtok(cont_multiplier_list, ":,.- \t"); counter = 0; if (tk_ptr != NULL) { while (tk_ptr) { strncpy(continent_multiplier_list[counter], tk_ptr, 2); tk_ptr = strtok(NULL, ":,.-_\t "); counter++; } } setcontest(); break; } case 164:{ // CONTINENT_LIST_POINTS PARAMETER_NEEDED(teststring); g_strlcpy(c_temp, fields[1], sizeof(c_temp)); if (continentlist_points == -1) { continentlist_points = atoi(c_temp); } break; } case 165:{ // CONTINENT_LIST_ONLY continentlist_only = 1; break; } case 166:{ // BANDWEIGHT_POINTS PARAMETER_NEEDED(teststring); static char bwp_params_list[50] = ""; int bandindex = -1; if (strlen(bwp_params_list) == 0) { g_strlcpy(bwp_params_list, fields[1], sizeof(bwp_params_list)); g_strchomp(bwp_params_list); } tk_ptr = strtok(bwp_params_list, ";:,"); if (tk_ptr != NULL) { while (tk_ptr) { bandindex = getidxbybandstr(g_strchomp(tk_ptr)); tk_ptr = strtok(NULL, ";:,"); if (tk_ptr != NULL && bandindex >= 0) { bandweight_points[bandindex] = atoi(tk_ptr); } tk_ptr = strtok(NULL, ";:,"); } } break; } case 167:{ // BANDWEIGHT_MULTIS PARAMETER_NEEDED(teststring); static char bwm_params_list[50] = ""; int bandindex = -1; if (strlen(bwm_params_list) == 0) { g_strlcpy(bwm_params_list, fields[1], sizeof(bwm_params_list)); g_strchomp(bwm_params_list); } tk_ptr = strtok(bwm_params_list, ";:,"); if (tk_ptr != NULL) { while (tk_ptr) { bandindex = getidxbybandstr(g_strchomp(tk_ptr)); tk_ptr = strtok(NULL, ";:,"); if (tk_ptr != NULL && bandindex >= 0) { bandweight_multis[bandindex] = atoi(tk_ptr); } tk_ptr = strtok(NULL, ";:,"); } } break; } case 168:{ /* based on LZ3NY code, by HA2OS PFX_NUM_MULTIS (in file or listed in logcfg.dat), We directly copy it into pfxnummulti_str, then parse the prefixlist and fill the pfxnummulti array. */ int counter = 0; int pfxnum; static char pfxnummulti_str[50] = ""; char parsepfx[15] = ""; PARAMETER_NEEDED(teststring); g_strlcpy(pfxnummulti_str, fields[1], sizeof(pfxnummulti_str)); g_strchomp(pfxnummulti_str); /* creating the array */ tk_ptr = strtok(pfxnummulti_str, ","); counter = 0; if (tk_ptr != NULL) { while (tk_ptr) { parsepfx[0] = '\0'; if (isdigit(tk_ptr[strlen(tk_ptr)-1])) { sprintf(parsepfx, "%sAA", tk_ptr); } else { sprintf(parsepfx, "%s0AA", tk_ptr); } pfxnummulti[counter].countrynr = getctydata(parsepfx); for(pfxnum=0; pfxnum<10; pfxnum++) { pfxnummulti[counter].qsos[pfxnum] = 0; } tk_ptr = strtok(NULL, ","); counter++; } } pfxnummultinr = counter; setcontest(); break; } case 169:{ /* wpx style prefixes mult */ pfxmultab = 1; /* enable pfx on all band */ break; } case 170 ... 181: { PARAMETER_NEEDED(teststring); strcpy(qtc_recv_msgs[ii - 170], fields[1]); break; } case 182 ... 193: { PARAMETER_NEEDED(teststring); strcpy(qtc_send_msgs[ii - 182], fields[1]); break; } case 194 ... 207:{ // get QTC recv phone messages PARAMETER_NEEDED(teststring); g_strlcpy(qtc_phrecv_message[ii - 194], g_strchomp(fields[1]), 71); mvprintw(15, 5, "A: QTC RECV phone message #%d is %s", ii - 194, qtc_phrecv_message[ii - 194]); refreshp(); break; } case 208 ... 221:{ // get QTC send phone messages PARAMETER_NEEDED(teststring); g_strlcpy(qtc_phsend_message[ii - 208], g_strchomp(fields[1]), 71); mvprintw(15, 5, "A: QTC SEND phone message #%d is %s", ii - 208, qtc_phrecv_message[ii - 208]); refreshp(); break; } case 222: { qtcrec_record = 1; break; } case 223: { PARAMETER_NEEDED(teststring); int p, q = 0, i = 0, s = 0; for(p=0; p<strlen(fields[1]); p++) { if (p > 0 && fields[1][p] == ' ') { s = 1; qtcrec_record_command_shutdown[p] = '\0'; } if (s == 0) { qtcrec_record_command_shutdown[p] = fields[1][p]; } if (fields[1][p] == '$') { qtcrec_record_command[i][q] = '\0'; i=1; p++; q=0; } if (fields[1][p] != '\n') { qtcrec_record_command[i][q] = fields[1][p]; } q++; qtcrec_record_command[i][q] = ' '; } if (qtcrec_record_command[i][q-1] != '&') { qtcrec_record_command[i][q++] = ' '; qtcrec_record_command[i][q++] = '&'; } qtcrec_record_command[i][q] = '\0'; break; } case 224: { PARAMETER_NEEDED(teststring); if (strcmp(fields[1], "CONTINENTLIST")) { if (strlen(continent_multiplier_list[0]) == 0) { showmsg ("WARNING: you need to set the CONTINENTLIST parameter..."); sleep(5); exit(1); } exclude_multilist_type = 1; } else if (strcmp(fields[1], "COUNTRYLIST")) { if (strlen(countrylist[0]) == 0) { showmsg ("WARNING: you need to set the COUNTRYLIST parameter..."); sleep(5); exit(1); } exclude_multilist_type = 2; } else { showmsg ("WARNING: choose one of these for EXCLUDE_MULTILIST: CONTINENTLIST, COUNTRYLIST"); sleep(5); exit(1); } break; } case 225:{ PARAMETER_NEEDED(teststring); strcpy(message[SP_CALL_MSG], fields[1]); break; /* end messages */ } case 226:{ PARAMETER_NEEDED(teststring); g_strlcpy(qtc_cap_calls, g_strchomp(fields[1]), sizeof(exchange_list)); break; } case 227: { qtc_auto_filltime = 1; break; } case 228: { bmautograb = 1; break; } case 229: { bmautoadd = 1; break; } case 230: { qtc_recv_lazy = 1; break; } case 231: { sprint_mode = 1; break; } default: { KeywordNotSupported(g_strstrip(inputbuffer)); break; } } g_strfreev( fields ); return( confirmation_needed ); }
void checklogfile(void) { extern char logfile[26]; extern char backgrnd_str[]; int lfile; int qsobytes; int qsolines; int errbytes; int rc; struct stat statbuf; char inputbuffer[800]; char *rp; FILE *infile; FILE *outfile; FILE *fp; if ((fp = fopen(logfile, "a")) == NULL) { fprintf(stdout, "Opening logfile not possible.\n"); exit(1); } else { fstat(fileno(fp), &statbuf); qsobytes = statbuf.st_size; qsolines = qsobytes / LOGLINELEN; errbytes = qsobytes % LOGLINELEN; if (errbytes != 0) { fclose(fp); if ((infile = fopen(logfile, "r")) == NULL) { mvprintw(24, 0, "Unable to open logfile..."); refreshp(); sleep(2); } else { if ((outfile = fopen("./cpyfile", "w")) == NULL) { mvprintw(24, 0, "Unable to open cpyfile..."); refreshp(); fclose(infile); sleep(2); } else { while (!(feof(infile))) { rp = fgets(inputbuffer, 160, infile); if (strlen(inputbuffer) != LOGLINELEN) { strcat(inputbuffer, backgrnd_str); inputbuffer[LOGLINELEN] = '\0'; } fputs(inputbuffer, outfile); } fclose(infile); fclose(outfile); } if ((lfile = open("./cpyfile", O_RDWR)) < 0) { mvprintw(24, 0, "I can not find the copy file..."); refreshp(); sleep(2); } else { fstat(lfile, &statbuf); if (statbuf.st_size > 80) { rc = ftruncate(lfile, statbuf.st_size - LOGLINELEN); fsync(lfile); } close(lfile); } rename("./cpyfile", logfile); remove("./cpyfile"); } } else fclose(fp); } }
int keyer(void) { extern int cqmode; extern char mode[20]; extern char message[][80]; extern char wkeyerbuffer[]; extern int data_ready; extern int keyerport; extern int weight; WINDOW *win = NULL; PANEL *panel = NULL; int x = 0, j = 0; int cury, curx; char nkbuffer[2]; char keyerstring[KEYER_LINE_WIDTH+1] = ""; int keyerstringpos = 0; char weightbuf[15]; const char txcontrolstring[2] = { 20, '\0' }; // ^t const char rxcontrolstring[2] = { 18, '\0' }; // ^r const char crcontrolstring[2] = { 13, '\0' }; // cr const char ctl_c_controlstring[2] = { 92, '\0' }; // '\' if (keyerport == NO_KEYER) /* no keyer present */ return 1; strcpy(mode, "Keyboard"); clear_display(); attron(COLOR_PAIR(C_LOG) | A_STANDOUT); if (panel == NULL) { win = newwin(KEYER_WIN_HEIGHT, KEYER_WIN_WIDTH, KEYER_Y, KEYER_Y ); if (win == NULL) return 1; panel = new_panel(win); if (panel == NULL) { delwin(win); return 1; } } show_panel(panel); werase(win); wnicebox(win, 0, 0, 1, KEYER_LINE_WIDTH, "CW Keyer"); if (keyerport == MFJ1278_KEYER) { if (data_ready != 1) { /* switch to tx */ strcat(wkeyerbuffer, txcontrolstring); data_ready = 1; } } while (1) { wattron(win, COLOR_PAIR(C_LOG) | A_STANDOUT); wmove (win, 1, 1); for (j = 0; j < KEYER_LINE_WIDTH; j++) { waddch (win, ' '); } mvwprintw(win, 1, 1, "%s", keyerstring); refreshp(); x = key_get(); // Send space instead of double quote. if (x == 34) { x = 32; } // Send space instead of newline or return. if (x == '\n' || x == KEY_ENTER) x = 32; // <Escape>, Ctrl-K (^K), Alt-k (M-k) if (x == 27 || x == 11 || x == 235) { if (keyerport == MFJ1278_KEYER) { if (data_ready != 1) { /* switch back to rx */ strcat(wkeyerbuffer, rxcontrolstring); data_ready = 1; } } else { stoptx(); } break; } // Promote lower case to upper case. if (x > 96 && x < 123) x = x - 32; if (x > 9 && x < 91) { /* drop all other control char... */ if (x > 31 || x == 10) { if (keyerport == MFJ1278_KEYER) { mfj1278_control(x); } else if (keyerport == NET_KEYER) { nkbuffer[0] = x; // 1 char at the time ! nkbuffer[1] = '\0'; netkeyer(K_MESSAGE, nkbuffer); } /* if display field is full move text one left */ if (keyerstringpos == KEYER_LINE_WIDTH - 1) { for (j = 0; j < KEYER_LINE_WIDTH - 1; j++) { keyerstring[j] = keyerstring[j + 1]; } keyerstringpos--; } /* add new character for display */ keyerstring[keyerstringpos++] = x; keyerstring[keyerstringpos] = '\0'; } } else { switch (x) { case '\n': case 13: case KEY_ENTER: { if (keyerport == MFJ1278_KEYER) { sendmessage(crcontrolstring); } break; } case 123: /* { */ { if (keyerport == MFJ1278_KEYER) { sendmessage(txcontrolstring); } break; } case 125: /* } */ { if (keyerport == MFJ1278_KEYER) { sendmessage(rxcontrolstring); } break; } case 92: /* \ */ { if (keyerport == MFJ1278_KEYER) { sendmessage(ctl_c_controlstring); } break; } case 247: // Alt-w, set weight { mvprintw(1, 0, "Weight= "); mvprintw(1, 7, ""); refreshp(); echo(); getnstr(weightbuf, 2); noecho(); weight = atoi(weightbuf); netkeyer(K_WEIGHT, weightbuf); break; } // <Page-Up>, increase CW speed. case KEY_PPAGE: { speedup(); clear_display(); break; } // <Page-Down>, decrease CW speed. case KEY_NPAGE: { speeddown(); clear_display(); break; } case KEY_F(1): { getyx(stdscr, cury, curx); mvprintw(5, 0, ""); sendmessage(message[0]); /* F1 */ mvprintw(cury, curx, ""); break; } case KEY_F(2): { sendmessage(message[1]); /* F2 */ break; } case KEY_F(3): { sendmessage(message[2]); /* F3 */ break; } case KEY_F(4): { sendmessage(message[3]); /* F4 */ break; } case KEY_F(5): { sendmessage(message[4]); /* F5 */ break; } case KEY_F(6): { sendmessage(message[5]); /* F6 */ break; } case KEY_F(7): { sendmessage(message[6]); /* F7 */ break; } case KEY_F(8): { sendmessage(message[7]); /* F8 */ break; } case KEY_F(9): { sendmessage(message[8]); /* F9 */ break; } case KEY_F(10): { sendmessage(message[9]); /* F10 */ break; } case KEY_F(11): { sendmessage(message[10]); /* F11 */ break; } case KEY_F(12): { sendmessage(message[11]); /* F12 */ break; } default: x = x; } } } hide_panel(panel); if (cqmode == CQ) strcpy(mode, "Log "); else strcpy(mode, "S&P "); clear_display(); return 0; /* show end of keyer routine */ }
void *background_process(void *ptr) { extern int landebug; extern struct tm *time_ptr; static int i, t; static char prmessage[256]; static int lantimesync = 0; static int fldigi_rpc_cnt = 0; int n; char debugbuffer[160]; FILE *fp; i = 1; while (i) { while (stop_backgrnd_process == 1) { sleep(1); } usleep(10000); if (packetinterface != 0) { receive_packet(); } if (trxmode == DIGIMODE && digikeyer != NO_KEYER) rx_rtty(); /* * calling Fldigi XMLRPC method, which reads the Fldigi's carrier * this function helps to show the correct freq of the RIG: reads * the carrier value from Fldigi, and stores in a variable; then * it readable by fldigi_get_carrier() * only need at every 2nd cycle * see fldigixmlrpc.[ch] */ if (trxmode == DIGIMODE && (digikeyer == GMFSK || digikeyer == FLDIGI) && trx_control == 1) { if (fldigi_rpc_cnt == 0) { fldigi_xmlrpc_get_carrier(); } fldigi_rpc_cnt = 1 - fldigi_rpc_cnt; } if (stop_backgrnd_process == 0) { write_keyer(); cw_simulator(); } if (lan_active == 1) { if (lan_message[0] == '\0') { if (lan_recv() < 0) { recv_error++; } else { lan_message[strlen(lan_message) - 1] = '\0'; } } if (landebug == 1) { if ((fp = fopen("debuglog", "a")) == NULL) { fprintf(stdout, "store_qso.c: Error opening debug file.\n"); } else { get_time(); strftime(debugbuffer, 80, "%H:%M:%S-", time_ptr); if (strlen(lan_message) > 2) { strcat(debugbuffer, lan_message); strcat(debugbuffer, "\n"); fputs(debugbuffer, fp); } fclose(fp); } } if ((*lan_message != '\0') && (lan_message[0] == thisnode)) { mvprintw(24, 0, "Warning: NODE ID CONFLICT ?! You should use another ID! "); refreshp(); sleep(5); } if ((*lan_message != '\0') && (lan_message[0] != thisnode) && (stop_backgrnd_process != 1)) { switch (lan_message[1]) { case LOGENTRY: log_to_disk(true); break; case QTCRENTRY: store_recv_qtc(lan_message+2); break; case QTCSENTRY: store_sent_qtc(lan_message+2); break; case QTCFLAG: parse_qtc_flagline(lan_message+2); break; case CLUSTERMSG: strncpy(prmessage, lan_message + 2, 80); if (strstr(prmessage, call) != NULL) // alert for cluster messages { mvprintw(24, 0, " "); mvprintw(24, 0, "%s", prmessage); refreshp(); } addtext(prmessage); break; case TLFSPOT: strncpy(prmessage, lan_message + 2, 80); lanspotflg = 1; addtext(prmessage); lanspotflg = 0; break; case TLFMSG: for (t = 0; t < 4; t++) strcpy(talkarray[t], talkarray[t + 1]); talkarray[4][0] = lan_message[0]; talkarray[4][1] = ':'; talkarray[4][2] = '\0'; strncat(talkarray[4], lan_message + 2, 60); mvprintw(24, 0, " "); mvprintw(24, 0, " MSG from %s", talkarray[4]); refreshp(); break; case FREQMSG: if ((lan_message[0] >= 'A') && (lan_message[0] <= 'A' + MAXNODES)) { node_frequencies[lan_message[0] - 'A'] = atof(lan_message + 2); break; } case INCQSONUM: n = atoi(lan_message + 2); if (highqsonr < n) highqsonr = n; if ((qsonum <= n) && (n > 0)) { qsonum = highqsonr + 1; qsonr_to_str(); } lan_message[0] = '\0'; case TIMESYNC: if ((lan_message[0] >= 'A') && (lan_message[0] <= 'A' + MAXNODES)) { lantime = atoi(lan_message + 2); if (lantimesync == 1) timecorr = ((4 * timecorr) + lantime - (time(0) + (timeoffset * 3600L))) / 5; else { timecorr = lantime - (time(0) + (timeoffset * 3600L)); lantimesync = 1; } break; } } lan_message[0] = '\0'; lan_message[1] = '\0'; } } gettxinfo(); /* get freq info from TRX */ } return (NULL); }
int cw_simulator(void) { extern int simulator; extern int simulator_mode; extern int simulator_seed; extern char simulator_tone[5]; extern char tonestr[5]; extern char tonecpy[5]; extern int system_secs; extern int this_second; static int callnumber; char callcpy[80]; static int x; if (simulator == 0) return (-1); if (simulator_mode == 1) { attron(COLOR_PAIR(C_HEADER) | A_STANDOUT); mvprintw(0, 3, "Sim"); refreshp(); strcpy(tonecpy, tonestr); switch (this_second) { case 48: strcpy(simulator_tone, "625"); break; case 49: strcpy(simulator_tone, "800"); break; case 50: strcpy(simulator_tone, "650"); break; case 51: strcpy(simulator_tone, "750"); break; case 52: strcpy(simulator_tone, "700"); break; case 53: strcpy(simulator_tone, "725"); break; case 54: strcpy(simulator_tone, "675"); break; case 55: strcpy(simulator_tone, "775"); break; case 56: strcpy(simulator_tone, "600"); break; case 57: strcpy(simulator_tone, "640"); break; default: strcpy(simulator_tone, "750"); break; } strcpy(tonestr, simulator_tone); write_tone(); callnumber = callnumber + simulator_seed + system_secs - (60 * (int) (system_secs / 60)); if (callnumber >= 27000) callnumber -= 27000; sendmessage(CALLMASTERARRAY(callnumber)); write_keyer(); simulator_mode = 0; strcpy(tonestr, tonecpy); write_tone(); } if (simulator_mode == 2) { char *str; strcpy(tonecpy, tonestr); strcpy(tonestr, simulator_tone); write_tone(); strcpy(callcpy, CALLMASTERARRAY(callnumber)); x = getctydata(callcpy); str = g_strdup_printf("TU 5NN %2s", zone_export); sendmessage(str); g_free(str); simulator_mode = 0; write_keyer(); strcpy(tonestr, tonecpy); write_tone(); } if (simulator_mode == 3) { char *str; strcpy(tonecpy, tonestr); strcpy(tonestr, simulator_tone); write_tone(); strcpy(callcpy, CALLMASTERARRAY(callnumber)); x = getctydata(callcpy); str = g_strdup_printf("DE %s TU 5NN %s", CALLMASTERARRAY(callnumber), zone_export); sendmessage(str); g_free(str); simulator_mode = 0; write_keyer(); strcpy(tonestr, tonecpy); write_tone(); } return (0); }
/** \brief Recall former exchange or lookup initial exchange file * * First search 'hiscall' in already worked stations (callarray). If not found * there lookup 'hiscall' in initial exchange file. If found somewhere copy * the according exchange into the 'comment' field. * * \return 1 - found, -1 - not found, 0 - call field was empty */ int recall_exchange(void) { extern int nr_worked; extern struct worked_t worked[]; extern char hiscall[]; extern char comment[]; extern struct ie_list *main_ie_list; int i, l; int found = -1; char *loc, *loc2; struct ie_list *current_ie; if (strlen(hiscall) == 0) return (0); l = strlen(hiscall); /* search backwards through list of worked stations */ for (i = nr_worked - 1; i >= 0; i--) { /* first search call in already worked stations */ /* call has to be exact -> la/dl1jbe/p must be the same again */ if ((strstr(worked[i].call, hiscall) == worked[i].call) && (*(worked[i].call + l) == '\0' || *(worked[i].call + l) == ' ')) { found = 1; strcpy(comment, worked[i].exchange); break; } } if (found == -1) { /* if no exchange could be recycled and no comment available * search initial exchange list (if available) */ if (strlen(comment) == 0 && main_ie_list != NULL) { current_ie = main_ie_list; while (current_ie) { /* call from IE_List has to be a substring of hiscall * but must be delimited on both sides by '/' or eos */ if ((loc = strstr(hiscall, current_ie->call)) != NULL) { loc2 = loc + strlen(current_ie->call); if (((loc == hiscall) || (*(loc-1) == '/')) && ((*loc2 == '\0') || (*loc2 == '/'))) { found = 1; strcpy(comment, current_ie->exchange); break; } } current_ie = current_ie->next; } } } if (found) { mvprintw(12, 54, comment); refreshp(); } return found; }