AmendHub

Download:

jcs

/

subtext

/

amendments

/

549

fidopkt: Set proper product code and major version number

According to FTSC docs, we're supposed to set a product code (low)
of 0xfe if we haven't been assigned a number, which are now 16-bit.
Once that happens, low will be set to 0xff and high will become our
assigned number.

jcs made amendment 549 8 months ago
--- fidopkt.c Thu Nov 16 13:22:58 2023 +++ fidopkt.c Thu Nov 16 14:16:18 2023 @@ -524,8 +524,9 @@ fidopkt_encode_message(struct fidopkt_message *msg, ch { static char scratch[64]; struct tm *tm; - char *buf; + char *buf, *vers, *versdot; size_t len, off, buf_size, subject_len, n; + short versnum; subject_len = strlen(msg->subject); @@ -564,8 +565,16 @@ fidopkt_encode_message(struct fidopkt_message *msg, ch buf[FIDOPKT_CWVALIDCOPY + 1] = 1; buf[FIDOPKT_CAPABILWORD] = 1; - buf[FIDOPKT_PRODCODELOW] = 0; - buf[FIDOPKT_PRODCODEHIGH] = 0xfe; /* FTA-1005.003 */ + vers = get_version(false); + versdot = strchr(vers, '.'); + if (versdot) { + versdot[0] = '\0'; + versnum = atoi(vers); + buf[FIDOPKT_REVMAJOR] = versnum; + } + + buf[FIDOPKT_PRODCODELOW] = 0xfe; /* FTA-1005.003 */ + buf[FIDOPKT_PRODCODEHIGH] = 0; /* until we get a product code */ PUT_U16(buf + FIDOPKT_HEADER_SIZE + FIDOPKT_MSG_PKTTYPE, 2);