/* SM1 */ static int sm_rx_sendnak(s_rx_emsidat *d) { if( ++d->tries > 6 ) { log("too many tries resyncing with remote"); return(SME); } DEB((D_HSHAKE, "sm_rx_sendnak: try number %d", d->tries)); if( !d->caller ) { if( conf_boolean(cf_emsi_slave_sends_nak) && PUTSTR("**EMSI_NAKEEC3\r") < 0 ) return SME; if( PUTSTR("**EMSI_REQA77E\r") < 0 ) return SME; } else if( d->tries > 1 ) { if( PUTSTR("**EMSI_NAKEEC3\r") < 0 ) return SME; } if( FLUSHOUT() < 0 ) return SME; return SM2; }
void send_nntp(const char *format, ...) { char *out, p[4]; va_list va_ptr; out = calloc(4096, sizeof(char)); va_start(va_ptr, format); vsnprintf(out, 4096, format, va_ptr); va_end(va_ptr); /* * Only log responses */ if (out[3] == ' ') { memset(&p, 0, sizeof(p)); strncpy(p, out, 3); if (atoi(p) > 0) { Syslog('n', "> \"%s\"", printable(out, 0)); } } PUTSTR(out); PUTSTR((char *)"\r\n"); FLUSHOUT(); sentbytes += (strlen(out) + 2); free(out); }
static void garmin_pack_d110 ( D110 * wpt, uint8 ** pos ) { PUTU8(wpt->dtyp); PUTU8(wpt->wpt_class); PUTU8(wpt->dspl_color); PUTU8(wpt->attr); PUTU16(wpt->smbl); PUTSTR(wpt->subclass); PUTPOS(wpt->posn); PUTF32(wpt->alt); PUTF32(wpt->dpth); PUTF32(wpt->dist); PUTSTR(wpt->state); PUTSTR(wpt->cc); PUTU32(wpt->ete); PUTF32(wpt->temp); PUTU32(wpt->time); PUTU16(wpt->wpt_cat); PUTVST(wpt->ident); PUTVST(wpt->comment); PUTVST(wpt->facility); PUTVST(wpt->city); PUTVST(wpt->addr); PUTVST(wpt->cross_road); }
static void garmin_pack_d100 ( D100 * wpt, uint8 ** pos ) { PUTSTR(wpt->ident); PUTPOS(wpt->posn); SKIP(4); PUTSTR(wpt->cmnt); }
void Show_Ins(void) { locate(1, 70); colour(YELLOW, BLUE); if (InsMode) PUTSTR((char *)"INS"); else PUTSTR((char *)"OVR"); }
static void garmin_pack_d103 ( D103 * wpt, uint8 ** pos ) { PUTSTR(wpt->ident); PUTPOS(wpt->posn); SKIP(4); PUTSTR(wpt->cmnt); PUTU8(wpt->smbl); PUTU8(wpt->dspl); }
static void garmin_pack_d102 ( D102 * wpt, uint8 ** pos ) { PUTSTR(wpt->ident); PUTPOS(wpt->posn); SKIP(4); PUTSTR(wpt->cmnt); PUTF32(wpt->dst); PUTU16(wpt->smbl); }
void Chg_Address() { int i; char temp[41]; ReadExitinfo(); Syslog('+', "Old address \"%s\"", exitinfo.address[0]); Syslog('+', " \"%s\"", exitinfo.address[1]); Syslog('+', " \"%s\"", exitinfo.address[2]); while (TRUE) { Enter(1); /* Old address: */ pout(WHITE, BLACK, (char *) Language(476)); Enter(1); colour(LIGHTBLUE, BLACK); PUTSTR(exitinfo.address[0]); Enter(1); PUTSTR(exitinfo.address[1]); Enter(1); PUTSTR(exitinfo.address[2]); Enter(2); /* Your address, maximum 3 lines (only visible for the sysop): */ pout(YELLOW, BLACK, (char *) Language(474)); Enter(1); for (i = 0; i < 3; i++ ) { colour(YELLOW, BLACK); printf("%d: ", i+1); colour(CFG.InputColourF, CFG.InputColourB); alarm_on(); GetstrC(temp, 40); if (strcmp(temp, "")) Setup(exitinfo.address[i], temp); } if (strlen(exitinfo.address[0]) || strlen(exitinfo.address[1]) || strlen(exitinfo.address[2])) break; Enter(1); /* You need to enter your address here */ pout(LIGHTRED, BLACK, (char *)Language(475)); Enter(1); } Syslog('+', "New address \"%s\"", exitinfo.address[0]); Syslog('+', " \"%s\"", exitinfo.address[1]); Syslog('+', " \"%s\"", exitinfo.address[2]); WriteExitinfo(); }
/* * Choose Message Editor */ void Chg_FsMsged() { int z; char temp[81]; ReadExitinfo(); Enter(2); /* Now using the */ pout(LIGHTMAGENTA, BLACK, (char *)Language(372)); /* Line/Fullscreen/External */ colour(LIGHTCYAN, BLACK); snprintf(temp, 81, " %s ", Language(387 + (exitinfo.MsgEditor & 3))); PUTSTR(temp); /* Editor */ pout(LIGHTMAGENTA, BLACK, (char *)Language(390)); Enter(1); if (strlen(CFG.externaleditor)) /* Select: 1) Fullscreen editor, 2) External editor */ pout(WHITE, BLACK, (char *)Language(373)); else /* Select: 1) Fullscreen editor */ pout(WHITE, BLACK, (char *)Language(438)); alarm_on(); z = toupper(Readkey()); if (z == Keystroke(373, 0)) { exitinfo.MsgEditor = FSEDIT; Syslog('+', "User selected fullscreen editor"); } else if ((z == Keystroke(373, 1) && strlen(CFG.externaleditor))) { exitinfo.MsgEditor = EXTEDIT; Syslog('+', "User selected external editor"); } Enter(2); /* Now using the */ pout(LIGHTMAGENTA, BLACK, (char *)Language(372)); /* Line/Fullscreen/External */ colour(LIGHTCYAN, BLACK); snprintf(temp, 81, " %s ", Language(387 + (exitinfo.MsgEditor & 3))); PUTSTR(temp); /* Editor */ pout(LIGHTMAGENTA, BLACK, (char *)Language(390)); Enter(2); sleep(2); WriteExitinfo(); }
/* * Function will initialize language variables and load them into * memory for speed */ void InitLanguage() { FILE *pLang; int iLang = 0; char *temp; temp = calloc(PATH_MAX, sizeof(char)); snprintf(temp, PATH_MAX, "%s/share/int/language.%s", getenv("FTND_ROOT"), current_language); if ((pLang = fopen(temp, "rb")) == NULL) { WriteError("$FATAL: Can't open %s", temp); ExitClient(FTNERR_INIT_ERROR); } while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) { *(mLanguage + iLang) = (char *) calloc(strlen(ldata.sString) + 1, sizeof(char)); *(mKeystroke + iLang) = (char *) calloc(strlen(ldata.sKey) + 1, sizeof(char)); strcpy(mLanguage[iLang], ldata.sString); strcpy(mKeystroke[iLang], ldata.sKey); iLang++; if (iLang >= LANG) { Enter(1); PUTSTR((char *)"FATAL: Language file has to many lines in it"); Enter(2); ExitClient(FTNERR_INIT_ERROR); } } fclose(pLang); Syslog('b', "%d language lines read (%s)", iLang, current_language); free(temp); }
/* * Function will set up the necessary language paths and names */ void Set_Language(int iLanguage) { FILE *pLang; char *temp; temp = calloc(PATH_MAX, sizeof(char)); snprintf(temp, PATH_MAX, "%s/etc/language.data", getenv("FTND_ROOT")); if ((pLang = fopen(temp, "rb")) == NULL) { WriteError("Language: Can't open file: %s", temp); Enter(1); PUTSTR((char *)"Language: Can't open language file"); Enter(2); free(temp); Pause(); return; } fread(&langhdr, sizeof(langhdr), 1, pLang); while (fread(&lang, langhdr.recsize, 1, pLang) == 1) { if ((lang.LangKey[0] == iLanguage) && (lang.Available)) { strcpy(current_language, lang.lc); break; } } free(temp); fclose(pLang); }
static void garmin_pack_d210 ( D210 * link, uint8 ** pos ) { PUTU16(link->link_class); PUTSTR(link->subclass); PUTVST(link->ident); }
static void garmin_pack_d1004 ( D1004 * prof, uint8 ** pos ) { int i; int j; for ( i = 0; i < 3; i++ ) { for ( j = 0; j < 5; j++ ) { PUTU8(prof->activities[i].heart_rate_zones[j].low_heart_rate); PUTU8(prof->activities[i].heart_rate_zones[j].high_heart_rate); SKIP(2); } for ( j = 0; j < 10; j++ ) { PUTF32(prof->activities[i].speed_zones[j].low_speed); PUTF32(prof->activities[i].speed_zones[j].high_speed); PUTSTR(prof->activities[i].speed_zones[j].name); } PUTF32(prof->activities[i].gear_weight); PUTU8(prof->activities[i].max_heart_rate); SKIP(3); } PUTF32(prof->weight); PUTU16(prof->birth_year); PUTU8(prof->birth_month); PUTU8(prof->birth_day); PUTU8(prof->gender); }
void Hl(int y, char *txt) { Ls(y); strncat(hstr, colour_str(WHITE, BLUE), 80); strncat(hstr, padleft(txt, 58, ' '), 80); Rs(); PUTSTR(chartran(hstr)); }
static void garmin_pack_d1006 ( D1006 * course, uint8 ** pos ) { PUTU16(course->index); SKIP(2); PUTSTR(course->course_name); PUTU16(course->track_index); }
void Top_Menu(void) { char temp[81]; locate(1,1); colour(WHITE, RED); snprintf(temp, 81, "%s", padleft((char *)"(A)bort (H)elp (S)ave - Any other key is continue edit", 79, ' ')); PUTSTR(temp); }
static void garmin_pack_d106 ( D106 * wpt, uint8 ** pos ) { PUTU8(wpt->wpt_class); PUTSTR(wpt->subclass); PUTPOS(wpt->posn); PUTU16(wpt->smbl); PUTVST(wpt->wpt_ident); PUTVST(wpt->lnk_ident); }
static void garmin_pack_d1012 ( D1012 * point, uint8 ** pos ) { PUTSTR(point->name); SKIP(1); PUTU16(point->course_index); SKIP(2); PUTU32(point->track_point_time); PUTU8(point->point_type); }
void Top_Help() { char temp[81]; locate(1,1); colour(YELLOW, BLUE); snprintf(temp, 81, "%s", padleft((char *)"Press ESC for menu, other keys is edit text", 79, ' ')); PUTSTR(temp); Show_Ins(); }
static void garmin_pack_d1002 ( D1002 * wkt, uint8 ** pos ) { int i; PUTU32(wkt->num_valid_steps); for ( i = 0; i < 20; i++ ) { PUTSTR(wkt->steps[i].custom_name); PUTF32(wkt->steps[i].target_custom_zone_low); PUTF32(wkt->steps[i].target_custom_zone_high); PUTU16(wkt->steps[i].duration_value); PUTU8(wkt->steps[i].intensity); PUTU8(wkt->steps[i].duration_type); PUTU8(wkt->steps[i].target_type); PUTU8(wkt->steps[i].target_value); SKIP(2); } PUTSTR(wkt->name); PUTU8(wkt->sport_type); }
/* * Print global string sOneliner centered on the screen */ void Oneliner_Print() { int i, x, z, Strlen, Maxlen = 80; char sNewOneliner[81] = ""; /* * Select a new colour */ if (iColour < 8) iColour = 8; else if (iColour == 15) iColour = 8; else iColour++; /* * Get a random oneliner */ strcpy(sOneliner, Oneliner_Get()); /* * Now display it on screen */ Strlen = strlen(sOneliner); if (Strlen == Maxlen) { PUTSTR(sOneliner); Enter(1); } else { x = Maxlen - Strlen; z = x / 2; for(i = 0; i < z; i++) strcat(sNewOneliner," "); strcat(sNewOneliner, sOneliner); colour(iColour, 0); PUTSTR(sNewOneliner); Enter(1); } }
/* * Refresh and rebuild screen in editing mode. */ void Refresh(void) { int i, j = 2; clear(); Top_Help(); locate(j,1); colour(CFG.TextColourF, CFG.TextColourB); for (i = 1; i <= Line; i++) { if ((i >= TopVisible) && (i < (TopVisible + rows -1))) { locate(j, 1); j++; PUTSTR(Message[i]); } } Setcursor(); }
static void garmin_pack_d150 ( D150 * wpt, uint8 ** pos ) { PUTSTR(wpt->ident); PUTSTR(wpt->cc); PUTU8(wpt->wpt_class); PUTPOS(wpt->posn); PUTS16(wpt->alt); PUTSTR(wpt->city); PUTSTR(wpt->state); PUTSTR(wpt->name); PUTSTR(wpt->cmnt); }
/* SM1 */ static int sm_tx_senddat(s_tx_emsidat *d) { char *emsi_dat = NULL; char buf[8]; if( ++d->tries > 6 ) { log("too many tries sending emsi data"); return(SME); } if( d->tries > 1 ) log("emsi data send - retry %d", d->tries - 1); DEB((D_HSHAKE, "sm_tx_senddat: try number %d", d->tries)); if( (emsi_dat = emsi_createdat(d->local_emsi)) == NULL ) { log("cannot create emsi data packet"); return(SME); } DEB((D_HSHAKE, "sm_tx_senddat: emsi: \"%s\"", emsi_dat)); if( tty_puts(emsi_dat, 60) < 0 ) { free(emsi_dat); return SME; } /* * Calculate and send CRC-16 of our emsi packet */ sprintf(buf, "%04hX\r", (short unsigned)getcrc16xmodem(emsi_dat+2, strlen(emsi_dat+2))); free(emsi_dat); emsi_dat = NULL; if( PUTSTR(buf) < 0 || FLUSHOUT() < 0 ) return SME; return SM2; }
void Chg_Location() { char temp[81]; ReadExitinfo(); Syslog('+', "Old location \"%s\"", exitinfo.sLocation); while (TRUE) { /* Old Location: */ Enter(1); /* Old location: */ pout(WHITE, BLACK, (char *) Language(73)); pout(9, 0, exitinfo.sLocation); Enter(2); /* Please enter your location: */ pout(YELLOW, BLACK, (char *) Language(49)); colour(CFG.InputColourF, CFG.InputColourB); if (CFG.iCapLocation) { GetnameNE(temp, 24); } else { GetstrC(temp, 80); } if((strcmp(temp, "")) == 0) break; if(( strlen(temp)) < CFG.CityLen) { Enter(1); /* Please enter a longer location (min */ colour(LIGHTRED, BLACK); snprintf(temp, 81, "%s%d)", (char *) Language(74), CFG.CityLen); PUTSTR(temp); Enter(1); } else { Setup(exitinfo.sLocation,temp); break; } } Syslog('+', "New location \"%s\"", exitinfo.sLocation); WriteExitinfo(); }
void Full_Help(void) { strcpy(hstr, colour_str(LIGHTGREEN, BLUE)); /* Top row */ strncat(hstr, locate_str(1, 10), 80); strncat(hstr, (char *)"\xDA", 80); strncat(hstr, hLine_str(58), 80); strncat(hstr, (char *)"\xBF", 80); PUTSTR(chartran(hstr)); Ws(2); PUTSTR(chartran(hstr)); Ls(3); strncat(hstr, colour_str(YELLOW, BLUE), 80); strncat(hstr, padleft((char *)" Editor Help", 58, ' '), 80); Rs(); PUTSTR(chartran(hstr)); Ws(4); PUTSTR(chartran(hstr)); Hl( 5, (char *)"Ctrl-S or LeftArrow - Cursor left"); Hl( 6, (char *)"Ctrl-D or RightArrow - Cursor right"); Hl( 7, (char *)"Ctrl-E or UpArrow - Cursor up"); Hl( 8, (char *)"Ctrl-X or DownArrow - Cursor down"); Hl( 9, (char *)"Ctrl-V or Insert - Insert or Overwrite"); Hl(10, (char *)"Ctrl-N - Insert line"); Hl(11, (char *)"Ctrl-Y - Delete line"); Ws(12); PUTSTR(chartran(hstr)); Hl(13, (char *)"Ctrl-L - Refresh screen"); Hl(14, (char *)"Ctrl-R - Read from file"); Ws(15); PUTSTR(chartran(hstr)); strcpy(hstr, locate_str(16,10)); strncat(hstr, (char *)"\xC0", 80); strncat(hstr, hLine_str(58), 80); strncat(hstr, (char *)"\xD9", 80); PUTSTR(chartran(hstr)); }
/* * Check BBS open status, return FALSE if the bbs is closed. * Display the reason why to the user. */ int CheckStatus() { static char buf[81], msg[81]; snprintf(buf, 81, "SBBS:0;"); if (socket_send(buf) == 0) { strncpy(buf, socket_receive(), 80); if (strncmp(buf, "100:2,0", 7) == 0) return TRUE; if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh)) return TRUE; buf[strlen(buf) -1] = '\0'; Enter(2); PUTCHAR('\007'); snprintf(msg, 81, "*** %s ***", cldecode(buf+8)); PUTSTR(msg); Syslog('+', "Send user message \"%s\"", cldecode(buf+8)); Enter(3); } return FALSE; }
static void garmin_pack_d152 ( D152 * wpt, uint8 ** pos ) { PUTSTR(wpt->ident); PUTPOS(wpt->posn); SKIP(4); PUTSTR(wpt->cmnt); PUTF32(wpt->dst); PUTSTR(wpt->name); PUTSTR(wpt->city); PUTSTR(wpt->state); PUTS16(wpt->alt); PUTSTR(wpt->cc); SKIP(1); PUTU8(wpt->wpt_class); }
void DisplayLogo() { FILE *pLogo; char *sString, *temp; temp = calloc(PATH_MAX, sizeof(char)); sString = calloc(1024, sizeof(char)); snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/%s", getenv("FTND_ROOT"), CFG.deflang, CFG.welcome_logo); if ((pLogo = fopen(temp,"rb")) == NULL) WriteError("$DisplayLogo: Can't open %s", temp); else { while (Fgets(sString, 1023, pLogo) != NULL) { PUTSTR(chartran(sString)); Enter(1); } fclose(pLogo); } free(sString); free(temp); }
/* * Clear to End Of Line */ void clrtoeol(void) { PUTSTR((char *)ANSI_CLREOL); }