int main (int argc, char **argv) { progname = *argv; for (;;) { switch (getopt (argc, argv, "dw:t:")) { case EOF: break; case 'w': wpm = strtol (optarg, 0, 0); continue; case 't': tone = strtol (optarg, 0, 0); continue; case 'd': ++paddle_debug; continue; default: usage (); } break; } argc -= optind; argv += optind; if (argc != 0 || wpm == 0) usage (); keyer_init (tone, wpm); paddle_open(); atexit (quit); signal (SIGINT, sigint); printf ("Speed: %d wpm\n", wpm); printf ("Tone: %d Hz\n", tone); printf ("Keyer ready.\n"); audio_start(); for (;;) { int daah = 0, dit = 0; const char *c; paddle_poll (&daah, &dit); c = keyer_decode (daah, dit); if (c) { printf ("%s", c); fflush (stdout); } } }
int main(int argc, char *argv[]) { int j; int ret; char tlfversion[80] = ""; parse_options(argc, argv); ui_init(); strcat(logline0, backgrnd_str); strcat(logline1, backgrnd_str); strcat(logline2, backgrnd_str); strcat(logline3, backgrnd_str); strcat(logline4, backgrnd_str); strcat(terminal1, backgrnd_str); strcat(terminal2, backgrnd_str); strcat(terminal3, backgrnd_str); strcat(terminal4, backgrnd_str); termbuf[0] = '\0'; hiscall[0] = '\0'; sprintf(tlfversion, " Welcome to tlf-%s by PA0R!!", VERSION); showmsg(tlfversion); showmsg(""); total = 0; if (databases_load() == EXIT_FAILURE) { sleep(2); endwin(); exit(EXIT_FAILURE); } if (convert_cabrillo == 1) { char tstring[100] = ""; sprintf(tstring, "Converting cabrillo for contest %s from file %s.cbr", whichcontest, g_strstrip(call)); showmsg(tstring); showmsg(""); getstationinfo(); if (0 != readcabrillo(READCAB_MODE_CLI)) showmsg("Sorry. Conversion failed...."); else showmsg("Done..."); sleep(2); endwin(); exit(EXIT_SUCCESS); } /* now setup colors */ ui_color_init(); // if (strlen(synclogfile) > 0) // synclog(synclogfile); hamlib_init(); fldigi_init(); lan_init(); keyer_init(); clear(); mvprintw(0, 0, " Welcome to tlf-%s by PA0R!!\n\n", VERSION); refreshp(); checkparameters(); /* check .paras file */ getmessages(); /* read .paras file */ packet_init(); getwwv(); /* get the latest wwv info from packet */ scroll_log(); /* read the last 5 log lines and set the qso number */ nr_qsos = readcalls(); /* read the logfile for score and dupe */ clear_display(); /* tidy up the display */ attron(COLOR_PAIR(C_LOG) | A_STANDOUT); for (j = 13; j <= 23; j++) { /* wipe lower window */ mvprintw(j, 0, backgrnd_str); } refreshp(); bm_init(); /* initialize bandmap */ atexit(tlf_cleanup); /* register cleanup function */ /* Create the background thread */ ret = pthread_create(&background_thread, NULL, background_process, NULL); if (ret) { perror("pthread_create: backgound_process"); endwin(); exit(EXIT_FAILURE); } /* now start logging !! Does never return */ logit(); return 0; }