void grab_next(void) { extern char hiscall[]; extern char mode[]; extern int cqmode; extern int trx_control; extern float mem; extern float freq; #ifdef HAVE_LIBHAMLIB extern freq_t outfreq; #else extern int outfreq; #endif static int dir = 1; /* start scanning up */ spot *data; if (trx_control == 0) return; data = bandmap_next( dir, (unsigned int)(freq*1000) ); if (data == NULL) { /* nothing in that direction */ /* try other one */ dir = 1 - dir; data = bandmap_next( dir, (unsigned int)(freq*1000)); } if (data != NULL) { outfreq = data -> freq; outfreq -= fldigi_get_carrier(); send_bandswitch( (int) outfreq ); strcpy( hiscall, data->call ); showinfo( getctydata( hiscall ) ); searchlog( hiscall ); /* if in CQ mode switch to S&P and remember QRG */ if (cqmode == CQ) { cqmode = S_P; strcpy(mode, "S&P "); mem = freq; mvprintw(14, 68, "MEM: %7.1f", mem); } refreshp(); g_free( data->call ); g_free( data ); } }
void grabspot(void) { extern char hiscall[]; extern char mode[]; extern int cqmode; extern int trx_control; extern float mem; extern float freq; #ifdef HAVE_LIBHAMLIB extern freq_t outfreq; #else extern int outfreq; #endif spot *data; if (trx_control == 0) return; if (hiscall[0] != '\0') { data = bandmap_lookup( hiscall ); if (data != NULL) { outfreq = data -> freq; outfreq -= fldigi_get_carrier(); send_bandswitch( (int) outfreq ); strcpy( hiscall, data->call ); showinfo( getctydata( hiscall ) ); searchlog( hiscall ); /* if in CQ mode switch to S&P and remember QRG */ if (cqmode == CQ) { cqmode = S_P; strcpy(mode, "S&P "); mem = freq; mvprintw(14, 68, "MEM: %7.1f", mem); } refreshp(); g_free( data->call ); g_free( data ); } } }
int setcontest(void) { extern int focm; extern int wpx; extern int pfxmult; extern int cqww; extern int dxped; extern int sprint; extern int arrldx_usa; extern int dx_arrlsections; extern int arrl_fd; extern int arrlss; extern int multlist; extern int pacc_pa_flg; extern int stewperry_flg; extern int universal; extern int other_flg; extern int exchange_serial; extern int wysiwyg_multi; extern int w_cty; extern int ve_cty; extern int zl_cty; extern int ja_cty; extern int py_cty; extern int ce_cty; extern int lu_cty; extern int vk_cty; extern int zs_cty; extern int ua9_cty; extern int contest; extern int showscore_flag; extern int searchflg; extern char whichcontest[]; extern int one_point; extern int two_point; extern int three_point; extern int qso_once; extern int sectn_mult; extern int recall_mult; extern int noleadingzeros; char wcall[] = "W1AW"; char vecall[] = "VE1AA"; char zlcall[] = "ZL1AA"; char jacall[] = "JA1AA"; char pycall[] = "PY1AA"; char cecall[] = "CE1AA"; char lucall[] = "LU1AA"; char vkcall[] = "VK1AA"; char zscall[] = "ZS6AA"; char ua9call[] = "UA9AA"; if (pfxmult == 0 && wpx == 1) wpx = 0; cqww = 0; dxped = 0; sprint = 0; arrldx_usa = 0; pacc_pa_flg = 0; focm = 0; universal = 0; contest = 0; showscore_flag = 0; searchflg = 0; one_point = 0; two_point = 0; three_point = 0; recall_mult = 0; sectn_mult = 0; noleadingzeros = 0; if (strcmp(whichcontest, "wpx") == 0) { wpx = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "cqww") == 0) { cqww = 1; recall_mult = 1; contest = 1; showscore_flag = 1; searchflg = 1; w_cty = getctydata(wcall); ve_cty = getctydata(vecall); } if (strcmp(whichcontest, "dxped") == 0) { dxped = 1; recall_mult = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "sprint") == 0) { sprint = 1; contest = 1; showscore_flag = 1; searchflg = 1; one_point = 1; } if (strcmp(whichcontest, "arrldx_usa") == 0) { arrldx_usa = 1; recall_mult = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "arrldx_dx") == 0) { // other_flg = 1; three_point = 1; recall_mult = 1; sectn_mult = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "arrl_ss") == 0) { arrlss = 1; other_flg = 1; two_point = 1; qso_once = 1; exchange_serial = 1; multlist = 1; recall_mult = 0; // sectn_mult = 1; noleadingzeros = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "arrl_fd") == 0) { // other_flg = 1; recall_mult = 1; contest = 1; showscore_flag = 1; searchflg = 1; arrl_fd = 1; } if (strcmp(whichcontest, "pacc_pa") == 0) { pacc_pa_flg = 1; one_point = 1; contest = 1; showscore_flag = 1; searchflg = 1; ve_cty = getctydata(vecall); w_cty = getctydata(wcall); zl_cty = getctydata(zlcall); ja_cty = getctydata(jacall); py_cty = getctydata(pycall); ce_cty = getctydata(cecall); lu_cty = getctydata(lucall); vk_cty = getctydata(vkcall); zs_cty = getctydata(zscall); ua9_cty = getctydata(ua9call); } if (strcmp(whichcontest, "stewperry") == 0) { stewperry_flg = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "focmarathon") == 0) { foc_init(); } if (strcmp(whichcontest, "other") == 0) { other_flg = 1; one_point = 1; recall_mult = 1; wysiwyg_multi = 1; contest = 1; showscore_flag = 1; searchflg = 1; } if (strcmp(whichcontest, "universal") == 0) { contest = 1; showscore_flag = 1; searchflg = 1; } if (dx_arrlsections == 1) { contest = 1; // universal = 1; showscore_flag = 1; searchflg = 1; w_cty = getctydata(wcall); ve_cty = getctydata(vecall); } if (strcmp(whichcontest, "qso") == 0) { contest = 0; searchflg = 1; } else { searchflg = 1; //dxpedition contest = 1; showscore_flag = 1; universal = 1; } return (0); }
void calledit(void) { extern char hiscall[]; extern int block_part; int i = 0, l, b = 0; int j = 0; int x = 0; int cnt = 0, insertflg = 0; char dupecall[20]; char call1[30], call2[10]; l = strlen(hiscall); b = l - 1; while ((i != 27) && (b <= strlen(hiscall))) { attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, " "); mvprintw(12, 29, hiscall); mvprintw(12, 29 + b, ""); /* no refreshp() here as getch() calls wrefresh() for the * panel with last output (whre the cursor should go */ i = onechar(); if ((i == 161) || (i == 160)) // Ins / Del cnt++; else { if (i != 27) cnt = 0; } if (i == 9) block_part = 1; else block_part = 0; if (i == 1) // ctrl-A, home { b = 0; x = 0; } if (i == 5) // ctrl-E, End { b = strlen(hiscall) - 1; x = 0; } if (i == 155) { // left if (b > 0) b--; } else if (i == 154) { // right if (b < strlen(hiscall) - 1) { b++; } else break; /* stop edit */ } else if (i == 161) { /* delete */ l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; /* move to left incl. \0 */ } strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); if (cnt > 1) searchlog(hiscall); } else if (i == 127) { /* backspace */ if (b > 0) { b--; l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; } strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); if (cnt > 1) searchlog(hiscall); } } else if (i == 160) { /* insert */ if (insertflg == 0) insertflg = 1; else insertflg = 0; } else if (i != 27) { if ((i >= 97) && (i <= 122)) i = i - 32; if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { if (b <= 12) { strncpy(call1, hiscall, b); } if (b <= 12) { strncpy(call2, hiscall + b, strlen(hiscall) - (b - 1)); } if (strlen(hiscall) + 1 == 12) break; // leave insert mode if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { call1[b] = i; call1[b + 1] = '\0'; if ((strlen(call1) + strlen(call2)) < 12) { strcat(call1, call2); // if (strlen(call1) + strlen(hiscall) >= 12) break; if (strlen(call1) >= 12) break; strcpy(hiscall, call1); } } if ((b < strlen(hiscall) - 1) && (b <= 12)) b++; else break; strncpy(dupecall, hiscall, 16); /* update cty info */ x = getctydata(dupecall); showinfo(x); searchlog(hiscall); } else if (x != 0) i = 27; } else i = 27; } attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, hiscall); mvprintw(12, 29, " "); refreshp(); attron(A_STANDOUT); searchlog(hiscall); }
int readcalls(void) { extern char continent_multiplier_list[7][3]; extern int continentlist_only; extern int pfxnummultinr; extern t_pfxnummulti pfxnummulti[]; extern int exclude_multilist_type; extern char countrylist[][6]; char inputbuffer[160]; char tmpbuf[20]; char bndbuf[20]; char zonebuf[3]; char checkcall[20]; int i = 0, l = 0, n = 0, r = 0, s = 0; unsigned int k = 0; int m = 0; int t = 0, tt = 0; int z = 0; int add_ok; char multbuffer[40]; char presentcall[20]; // copy of call.. char *tmpptr; int points; int pfxnumcntidx; int pxnr; int excl_add_veto; FILE *fp; clear(); mvprintw(4, 0, "Reading logfile...\n"); refreshp(); /* reset counter and score anew */ for (s = 0; s < MAX_QSOS; s++) qsos[s][0] = '\0'; for (i = 0; i < MAX_CALLS; i++) { *worked[i].exchange = '\0'; *worked[i].call = '\0'; worked[i].band = 0; worked[i].country = -1; } for (i = 1; i <= MAX_DATALINES - 1; i++) countries[i] = 0; for (i = 0; i < NBANDS; i++) band_score[i] = 0; for (i = 0; i < NBANDS; i++) countryscore[i] = 0; for (n = 1; n < MAX_ZONES; n++) zones[n] = 0; for (n = 0; n < NBANDS; n++) zonescore[n] = 0; for (n = 0; n < NBANDS; n++) //F6CFE multscore[n] = 0; InitPfx(); if (pfxnummultinr > 0) { for(i=0; i<pfxnummultinr; i++) { for(n=0; n<NBANDS; n++) { pfxnummulti[i].qsos[n] = 0; } } } init_mults(); if ((fp = fopen(logfile, "r")) == NULL) { mvprintw(5, 0, "Error opening logfile.\n"); refreshp(); sleep(2); exit(1); } i = 0; k = 0; l = 0; s = 0; t = 0; while (fgets(inputbuffer, 90, fp) != NULL) { pfxnumcntidx = -1; pxnr = 0; excl_add_veto = 0; r++; if (r >= 100) { r = 0; printw("*"); refreshp(); } strcat(inputbuffer, " "); /* repair the logfile */ inputbuffer[LOGLINELEN-1] = '\0'; for (t = 0; t <= strlen(inputbuffer); t++) { if (inputbuffer[t] == '\n') inputbuffer[t] = ' '; } strncpy(qsos[s], inputbuffer, LOGLINELEN); s++; if (inputbuffer[0] == ';') continue; /* note in log */ strncpy(presentcall, inputbuffer + 29, 13); presentcall[13] = '\0'; strncpy(bndbuf, inputbuffer + 1, 2); bndbuf[2] = '\0'; if (bndbuf[0] == '1' && bndbuf[1] == '0') bandinx = BANDINDEX_10; if (bndbuf[0] == '1' && bndbuf[1] == '5') bandinx = BANDINDEX_15; if (bndbuf[0] == '2') bandinx = BANDINDEX_20; if (bndbuf[0] == '4') bandinx = BANDINDEX_40; if (bndbuf[0] == '8') bandinx = BANDINDEX_80; if (bndbuf[0] == '6') bandinx = BANDINDEX_160; if (bndbuf[0] == '1' && bndbuf[1] == '2') bandinx = BANDINDEX_12; if (bndbuf[0] == '1' && bndbuf[1] == '7') bandinx = BANDINDEX_17; if (bndbuf[0] == '3') bandinx = BANDINDEX_30; /* get the country number, not known at this point */ tmpptr = strchr(presentcall, ' '); if (tmpptr) *tmpptr = '\0'; strcpy(tmpbuf, presentcall); countrynr = getctydata(tmpbuf); if (continentlist_only == 1) { int ci = 0; int cont_in_list = 0; while(strlen(continent_multiplier_list[ci]) != 0) { if(strcmp(continent, continent_multiplier_list[ci]) == 0) { cont_in_list = 1; } ci++; } if (cont_in_list == 0) { band_score[bandinx]++; continue; } } if (contest == 1) { strncpy(tmpbuf, inputbuffer + 76, 2); /* get the points */ tmpbuf[2] = '\0'; points = atoi(tmpbuf); total = total + points; if ((cqww == 1) || (itumult == 1) || (wazmult == 1)) { strncpy(zonebuf, inputbuffer + 54, 2); /* get the zone */ zonebuf[2] = '\0'; z = zone_nr(zonebuf); } if (wysiwyg_once == 1 || wysiwyg_multi == 1 || arrlss == 1 || serial_section_mult == 1 || serial_grid4_mult == 1 || sectn_mult == 1 || ((dx_arrlsections == 1) && ((countrynr == w_cty) || (countrynr == ve_cty)))) { multbuffer[0] = '\0'; if (arrlss == 1) { other_flg = 0; if (inputbuffer[63] == ' ') strncpy(multbuffer, inputbuffer + 64, 3); else strncpy(multbuffer, inputbuffer + 63, 3); multbuffer[3] = '\0'; } else if (serial_section_mult == 1) { tt = 0; memset(multbuffer, 0, 39); for (t = 54; t < 64; t++) { if (inputbuffer[t] >= 'A' && inputbuffer[t] <= 'Z') { multbuffer[tt] = inputbuffer[t]; tt++; } } } else if (serial_grid4_mult == 1) { memset(multbuffer, 0, 39); for (t = 0; t < 4; t++) { multbuffer[t] = inputbuffer[t + 59]; } } else { strncpy(multbuffer, inputbuffer + 54, 10); // normal case multbuffer[10] = '\0'; g_strchomp(multbuffer); } remember_multi( multbuffer, bandinx, 0 ); } // end wysiwig if (other_flg == 1) { /* mult = max 3 characters */ strncpy(multbuffer, inputbuffer + 54, 3); multbuffer[3] = '\0'; if (multbuffer[3] == ' ') multbuffer[3] = '\0'; if (multbuffer[2] == ' ') multbuffer[2] = '\0'; if (multbuffer[1] == ' ') multbuffer[1] = '\0'; remember_multi( multbuffer, bandinx, 0 ); } } /* once per call ! */ for (k = 0; k < i; k++) { // changed k=< i m = strcmp(worked[k].call, presentcall); if (m == 0) { l = k; break; } else l = i; } strncpy(worked[l].call, inputbuffer + 29, 19); worked[l].call[19] = 0; strtok(worked[l].call, " \r"); /* delimit first word */ worked[l].country = countrynr; g_strlcpy(worked[l].exchange, inputbuffer + 54, 12); g_strchomp(worked[l].exchange); /* strip trailing spaces */ add_ok = 1; /* look if calls are excluded */ if ((arrldx_usa == 1) && ((countrynr == w_cty) || (countrynr == ve_cty))) add_ok = 0; if (pacc_pa_flg == 1) { strcpy(hiscall, presentcall); add_ok = pacc_pa(); if (add_ok == 0) { band_score[bandinx]++; } hiscall[0] = '\0'; } if (pfxmultab == 1) { getpx(presentcall); add_pfx(pxstr); } if (pfxnummultinr > 0) { getpx(presentcall); pxnr = pxstr[strlen(pxstr) - 1] - 48; getctydata(presentcall); int pfxi = 0; while(pfxi < pfxnummultinr) { if (pfxnummulti[pfxi].countrynr == countrynr) { pfxnumcntidx = pfxi; break; } pfxi++; } add_ok = 1; } if (continentlist_only == 0 && exclude_multilist_type == 1) { int ci = 0; int cont_in_list = 0; while(strlen(continent_multiplier_list[ci]) != 0) { if(strcmp(continent, continent_multiplier_list[ci]) == 0) { cont_in_list = 1; } ci++; } if (cont_in_list == 1 && continentlist_only == 0 && exclude_multilist_type == 1) { excl_add_veto = 1; } } if (exclude_multilist_type == 2) { int ci = 0; while (strlen(countrylist[ci]) != 0) { if (getctydata(countrylist[ci]) == countrynr) { excl_add_veto = 1; break; } ci++; } } if (add_ok == 1) { worked[l].band |= inxes[bandinx]; /* mark band as worked */ band_score[bandinx]++; /* qso counter per band */ if ((cqww == 1) || (itumult == 1) || (wazmult == 1)) zones[z] |= inxes[bandinx]; if (pfxnumcntidx < 0) { if (excl_add_veto == 0) { countries[countrynr] |= inxes[bandinx]; } } else { pfxnummulti[pfxnumcntidx].qsos[pxnr] |= inxes[bandinx]; } } /* end add_ok */ if (l == i) i++; } fclose(fp); /* remember nuber of callarray entries */ nr_worked = i; if (wpx == 1) { /* build prefixes_worked array from list of worked stations */ InitPfx(); for (n = 0; n < i; n++) { strcpy(checkcall, worked[n].call); getpx(checkcall); add_pfx(pxstr); } } if ((cqww == 1) || (itumult == 1) || (wazmult == 1)) { for (n = 1; n < MAX_ZONES; n++) { if ((zones[n] & BAND160) != 0) zonescore[BANDINDEX_160]++; if ((zones[n] & BAND80) != 0) zonescore[BANDINDEX_80]++; if ((zones[n] & BAND40) != 0) zonescore[BANDINDEX_40]++; if ((zones[n] & BAND20) != 0) zonescore[BANDINDEX_20]++; if ((zones[n] & BAND15) != 0) zonescore[BANDINDEX_15]++; if ((zones[n] & BAND10) != 0) zonescore[BANDINDEX_10]++; } } if (cqww == 1) { for (n = 1; n <= MAX_DATALINES - 1; n++) { if ((countries[n] & BAND160) != 0) countryscore[BANDINDEX_160]++; if ((countries[n] & BAND80) != 0) countryscore[BANDINDEX_80]++; if ((countries[n] & BAND40) != 0) countryscore[BANDINDEX_40]++; if ((countries[n] & BAND20) != 0) countryscore[BANDINDEX_20]++; if ((countries[n] & BAND15) != 0) countryscore[BANDINDEX_15]++; if ((countries[n] & BAND10) != 0) countryscore[BANDINDEX_10]++; } } /* end cqww */ if (dx_arrlsections == 1) { int cntr; for (cntr = 1; cntr < MAX_DATALINES; cntr++) { if (cntr != w_cty && cntr != ve_cty) // W and VE don't count here... { if ((countries[cntr] & BAND160) != 0) countryscore[BANDINDEX_160]++; if ((countries[cntr] & BAND80) != 0) countryscore[BANDINDEX_80]++; if ((countries[cntr] & BAND40) != 0) countryscore[BANDINDEX_40]++; if ((countries[cntr] & BAND20) != 0) countryscore[BANDINDEX_20]++; if ((countries[cntr] & BAND15) != 0) countryscore[BANDINDEX_15]++; if ((countries[cntr] & BAND10) != 0) countryscore[BANDINDEX_10]++; } } } // end dx_arrlsections if ((arrldx_usa == 1) && (countrynr != w_cty) && (countrynr != ve_cty)) { int cntr; for (cntr = 1; cntr < MAX_DATALINES; cntr++) { if ((countries[cntr] & BAND160) != 0) countryscore[BANDINDEX_160]++; if ((countries[cntr] & BAND80) != 0) countryscore[BANDINDEX_80]++; if ((countries[cntr] & BAND40) != 0) countryscore[BANDINDEX_40]++; if ((countries[cntr] & BAND20) != 0) countryscore[BANDINDEX_20]++; if ((countries[cntr] & BAND15) != 0) countryscore[BANDINDEX_15]++; if ((countries[cntr] & BAND10) != 0) countryscore[BANDINDEX_10]++; } } /* end arrldx_usa */ if (pacc_pa_flg == 1) { for (n = 1; n < MAX_DATALINES; n++) { if ((countries[n] & BAND160) != 0) countryscore[BANDINDEX_160]++; if ((countries[n] & BAND80) != 0) countryscore[BANDINDEX_80]++; if ((countries[n] & BAND40) != 0) countryscore[BANDINDEX_40]++; if ((countries[n] & BAND20) != 0) countryscore[BANDINDEX_20]++; if ((countries[n] & BAND15) != 0) countryscore[BANDINDEX_15]++; if ((countries[n] & BAND10) != 0) countryscore[BANDINDEX_10]++; } } if (country_mult == 1 || pfxnummultinr > 0) { for (n = 1; n <= MAX_DATALINES - 1; n++) { // first, check pfxnummultinr array, the country 'n' exists int pfxnumcntnr = -1; // pfxnummultinr is length of pfxnummulti array if (pfxnummultinr > 0) { int pcntnr; // find the current country // n is the country in the external loop // pfxnummulti[I].countrynr contains the country codes, I:=[0..pfxnummultinr] // it depends from the order of prefixes in rules, eg: // PFX_NUM_MULTIS=W,VE,VK,ZL,ZS,JA,PY,UA9 // pfxnummulti[0].countrynr will be nr of USA // pfxnummulti[1].countrynr will be nr of Canada for(pcntnr=0; pcntnr<pfxnummultinr; pcntnr++) { if (pfxnummulti[pcntnr].countrynr == n) { pfxnumcntnr = pcntnr; pcntnr = pfxnummultinr; // end loop } } } if (pfxnummultinr > 0 && pfxnumcntnr >= 0) { int pfxnum; // walking pfxnummulti[N].qsos, which is a 10 element array // each element represent a number of the country code // eg: K0, K1, K2, ..., K9 for(pfxnum=0; pfxnum<10; pfxnum++) { if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND160) != 0) { countryscore[BANDINDEX_160]++; } if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND80) != 0) { countryscore[BANDINDEX_80]++; } if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND40) != 0) { countryscore[BANDINDEX_40]++; } if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND20) != 0) { countryscore[BANDINDEX_20]++; } if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND15) != 0) { countryscore[BANDINDEX_15]++; } if ((pfxnummulti[pfxnumcntnr].qsos[pfxnum] & BAND10) != 0) { countryscore[BANDINDEX_10]++; } } } else { // simple 'country_mult', but it's works together with pfxnummultinr if ((countries[n] & BAND160) != 0) countryscore[BANDINDEX_160]++; if ((countries[n] & BAND80) != 0) countryscore[BANDINDEX_80]++; if ((countries[n] & BAND40) != 0) countryscore[BANDINDEX_40]++; if ((countries[n] & BAND20) != 0) countryscore[BANDINDEX_20]++; if ((countries[n] & BAND15) != 0) countryscore[BANDINDEX_15]++; if ((countries[n] & BAND10) != 0) countryscore[BANDINDEX_10]++; } } } if (qsonum == 1) { InitPfx(); total = 0; for (i = 0; i < NBANDS; i++) band_score[i] = 0; for (i = 0; i < NBANDS; i++) countryscore[i] = 0; for (i = 0; i < NBANDS; i++) multscore[i] = 0; } return (s); // nr of lines in log }
void calledit(void) { extern char hiscall[]; extern int block_part; int i = 0, l, b = 0; int j = 0; int x = 0; int cnt = 0, insertflg = 0; char call1[30], call2[10]; l = strlen(hiscall); b = l - 1; while ((i != 27) && (b <= strlen(hiscall))) { attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, " "); mvprintw(12, 29, hiscall); mvprintw(12, 29 + b, ""); /* no refreshp() here as getch() calls wrefresh() for the * panel with last output (whre the cursor should go */ i = key_get(); // <Delete> or <Insert> if ((i == KEY_DC) || (i == KEY_IC)) cnt++; else { if (i != 27) cnt = 0; } // <Tab> if (i == 9) block_part = 1; else block_part = 0; // Ctrl-A (^A) or <Home>, move to head of callsign field. if (i == 1 || i == KEY_HOME) { b = 0; x = 0; } // Ctrl-E (^E) or <End>, move to end of callsign field, exit edit mode. if (i == 5 || i == KEY_END) { b = strlen(hiscall); break; } // Left arrow if (i == KEY_LEFT) { if (b > 0) b--; // Right arrow } else if (i == KEY_RIGHT) { if (b < strlen(hiscall) - 1) { b++; } else break; /* stop edit */ // <Delete> } else if (i == KEY_DC) { l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; /* move to left incl. \0 */ } showinfo( getctydata(hiscall) ); if (cnt > 1) searchlog(hiscall); // <Backspace> } else if (i == KEY_BACKSPACE) { if (b > 0) { b--; l = strlen(hiscall); for (j = b; j <= l; j++) { hiscall[j] = hiscall[j + 1]; } showinfo( getctydata(hiscall) ); if (cnt > 1) searchlog(hiscall); } // <Insert> } else if (i == KEY_IC) { if (insertflg == 0) insertflg = 1; else insertflg = 0; // Any character left other than <Escape>. } else if (i != 27) { // Promote lower case to upper case. if ((i >= 97) && (i <= 122)) i = i - 32; // Accept A-Z or / and 1-9 if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { call2[0] = '\0'; if (b <= 12) { strncpy(call1, hiscall, b); strncpy(call2, hiscall + b, strlen(hiscall) - (b - 1)); } if (strlen(hiscall) + 1 == 12) break; // leave insert mode if (((i >= 65) && (i <= 90)) || ((i >= 47) && (i <= 57))) { call1[b] = i; call1[b + 1] = '\0'; if ((strlen(call1) + strlen(call2)) < 12) { strcat(call1, call2); // if (strlen(call1) + strlen(hiscall) >= 12) break; if (strlen(call1) >= 12) break; strcpy(hiscall, call1); } } if ((b < strlen(hiscall) - 1) && (b <= 12)) b++; else break; showinfo( getctydata(hiscall) ); searchlog(hiscall); } else if (x != 0) i = 27; } else i = 27; } attroff(A_STANDOUT); attron(COLOR_PAIR(C_HEADER)); mvprintw(12, 29, hiscall); mvprintw(12, 29, " "); refreshp(); attron(A_STANDOUT); searchlog(hiscall); }
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 ); }
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); }