Change sprintf to snprint in tests

https://github.com/Hamlib/Hamlib/issues/857
pull/928/head
Mike Black W9MDB 2022-01-11 00:00:44 -06:00
rodzic 416144b62b
commit c2cb94e412
8 zmienionych plików z 76 dodań i 76 usunięć

Wyświetl plik

@ -395,7 +395,7 @@ int main(int argc, char *argv[])
hist_path_size = sizeof(char) * (strlen(hist_dir) + strlen(hist_file) + 1);
hist_path = (char *)calloc(hist_path_size, sizeof(char));
snprintf(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
SNPRINTF(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
}

Wyświetl plik

@ -235,11 +235,11 @@ void hash_add_model(int id,
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
s->id = id;
snprintf(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
snprintf(s->model_name, sizeof(s->model_name), "%s", model_name);
snprintf(s->version, sizeof(s->version), "%s", version);
snprintf(s->status, sizeof(s->status), "%s", status);
snprintf(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
SNPRINTF(s->model_name, sizeof(s->model_name), "%s", model_name);
SNPRINTF(s->version, sizeof(s->version), "%s", version);
SNPRINTF(s->status, sizeof(s->status), "%s", status);
SNPRINTF(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
HASH_ADD_INT(models, id, s); /* id: name of key field */
}
@ -968,7 +968,7 @@ int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
/* The starting position of the source string is the first
* character past the initial '\'.
*/
snprintf(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
SNPRINTF(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
/* Sanity check as valid multiple character commands consist of
* alphanumeric characters and the underscore ('_') character.

Wyświetl plik

@ -136,11 +136,11 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->bank_num)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.bank_num);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.bank_num);
xmlNewProp(node, (unsigned char *) "bank_num", (unsigned char *) attrbuf);
}
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.channel_num);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.channel_num);
xmlNewProp(node, (unsigned char *) "num", (unsigned char *) attrbuf);
if (mem_caps->channel_desc && chan.channel_desc[0] != '\0')
@ -152,13 +152,13 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->vfo)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.vfo);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.vfo);
xmlNewProp(node, (unsigned char *) "vfo", (unsigned char *) attrbuf);
}
if (mem_caps->ant && chan.ant != RIG_ANT_NONE)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.ant);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.ant);
xmlNewProp(node, (unsigned char *) "ant", (unsigned char *) attrbuf);
}
@ -166,7 +166,7 @@ int dump_xml_chan(RIG *rig,
{
// cppcheck-suppress *
char *fmt = "%"PRIll;
snprintf(attrbuf, sizeof(attrbuf), fmt, (int64_t)chan.freq);
SNPRINTF(attrbuf, sizeof(attrbuf), fmt, (int64_t)chan.freq);
xmlNewProp(node, (unsigned char *) "freq", (unsigned char *) attrbuf);
}
@ -178,13 +178,13 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->width && chan.width != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.width);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.width);
xmlNewProp(node, (unsigned char *) "width", (unsigned char *) attrbuf);
}
if (mem_caps->tx_freq && chan.tx_freq != RIG_FREQ_NONE)
{
snprintf(attrbuf, sizeof(attrbuf), "%"PRIll, (int64_t)chan.tx_freq);
SNPRINTF(attrbuf, sizeof(attrbuf), "%"PRIll, (int64_t)chan.tx_freq);
xmlNewProp(node, (unsigned char *) "tx_freq", (unsigned char *) attrbuf);
}
@ -197,7 +197,7 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->tx_width && chan.tx_width != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.tx_width);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.tx_width);
xmlNewProp(node, (unsigned char *) "tx_width", (unsigned char *) attrbuf);
}
@ -207,7 +207,7 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->tx_vfo)
{
snprintf(attrbuf, sizeof(attrbuf), "%x", chan.tx_vfo);
SNPRINTF(attrbuf, sizeof(attrbuf), "%x", chan.tx_vfo);
xmlNewProp(node,
(unsigned char *) "tx_vfo",
(unsigned char *) attrbuf);
@ -222,7 +222,7 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->rptr_offs && (int)chan.rptr_offs != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.rptr_offs);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.rptr_offs);
xmlNewProp(node,
(unsigned char *) "rptr_offs",
(unsigned char *) attrbuf);
@ -231,61 +231,61 @@ int dump_xml_chan(RIG *rig,
if (mem_caps->tuning_step && chan.tuning_step != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.tuning_step);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.tuning_step);
xmlNewProp(node, (unsigned char *) "tuning_step", (unsigned char *) attrbuf);
}
if (mem_caps->rit && chan.rit != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.rit);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.rit);
xmlNewProp(node, (unsigned char *) "rit", (unsigned char *) attrbuf);
}
if (mem_caps->xit && chan.xit != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", (int)chan.xit);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", (int)chan.xit);
xmlNewProp(node, (unsigned char *) "xit", (unsigned char *) attrbuf);
}
if (mem_caps->funcs)
{
snprintf(attrbuf, sizeof(attrbuf), "%lx", chan.funcs);
SNPRINTF(attrbuf, sizeof(attrbuf), "%lx", chan.funcs);
xmlNewProp(node, (unsigned char *) "funcs", (unsigned char *) attrbuf);
}
if (mem_caps->ctcss_tone && chan.ctcss_tone != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.ctcss_tone);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.ctcss_tone);
xmlNewProp(node, (unsigned char *) "ctcss_tone", (unsigned char *) attrbuf);
}
if (mem_caps->ctcss_sql && chan.ctcss_sql != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.ctcss_sql);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.ctcss_sql);
xmlNewProp(node, (unsigned char *) "ctcss_sql", (unsigned char *) attrbuf);
}
if (mem_caps->dcs_code && chan.dcs_code != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.dcs_code);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.dcs_code);
xmlNewProp(node, (unsigned char *) "dcs_code", (unsigned char *) attrbuf);
}
if (mem_caps->dcs_sql && chan.dcs_sql != 0)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.dcs_sql);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.dcs_sql);
xmlNewProp(node, (unsigned char *) "dcs_sql", (unsigned char *) attrbuf);
}
if (mem_caps->scan_group)
{
snprintf(attrbuf, sizeof(attrbuf), "%d", chan.scan_group);
SNPRINTF(attrbuf, sizeof(attrbuf), "%d", chan.scan_group);
xmlNewProp(node, (unsigned char *) "scan_group", (unsigned char *) attrbuf);
}
if (mem_caps->flags)
{
snprintf(attrbuf, sizeof(attrbuf), "%x", chan.flags);
SNPRINTF(attrbuf, sizeof(attrbuf), "%x", chan.flags);
xmlNewProp(node, (unsigned char *) "flags", (unsigned char *) attrbuf);
}

Wyświetl plik

@ -413,11 +413,11 @@ void hash_add_model(int id,
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
s->id = id;
snprintf(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
snprintf(s->model_name, sizeof(s->model_name), "%s", model_name);
snprintf(s->version, sizeof(s->version), "%s", version);
snprintf(s->status, sizeof(s->status), "%s", status);
snprintf(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
SNPRINTF(s->model_name, sizeof(s->model_name), "%s", model_name);
SNPRINTF(s->version, sizeof(s->version), "%s", version);
SNPRINTF(s->status, sizeof(s->status), "%s", status);
SNPRINTF(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
HASH_ADD_INT(models, id, s); /* id: name of key field */
}
@ -1224,7 +1224,7 @@ readline_repeat:
/* The starting position of the source string is the first
* character past the initial '\'.
*/
snprintf(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
SNPRINTF(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
/* Sanity check as valid multiple character commands consist of
* alphanumeric characters and the underscore ('_') character.
@ -2393,14 +2393,14 @@ declare_proto_rig(get_mode_bandwidths)
}
// sprintf_freq(freqbuf, sizeof(freqbuf), pbnorm);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", pbnorm);
SNPRINTF(freqbuf, sizeof(freqbuf), "%ldHz", pbnorm);
fprintf(fout, "Mode=%s\n", rig_strrmode(i));
fprintf(fout, "Normal=%s\n", freqbuf);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_narrow(rig, i));
SNPRINTF(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_narrow(rig, i));
fprintf(fout, "Narrow=%s\n", freqbuf);
snprintf(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_wide(rig, i));
SNPRINTF(freqbuf, sizeof(freqbuf), "%ldHz", rig_passband_wide(rig, i));
fprintf(fout, "Wide=%s", freqbuf);
}
@ -4198,15 +4198,15 @@ int dump_chan(FILE *fout, RIG *rig, channel_t *chan)
break;
case RIG_CONF_COMBO:
snprintf(lstr, sizeof(lstr), "%d", chan->ext_levels[idx].val.i);
SNPRINTF(lstr, sizeof(lstr), "%d", chan->ext_levels[idx].val.i);
break;
case RIG_CONF_NUMERIC:
snprintf(lstr, sizeof(lstr), "%f", chan->ext_levels[idx].val.f);
SNPRINTF(lstr, sizeof(lstr), "%f", chan->ext_levels[idx].val.f);
break;
case RIG_CONF_CHECKBUTTON:
snprintf(lstr, sizeof(lstr), "%s", chan->ext_levels[idx].val.i ? "ON" : "OFF");
SNPRINTF(lstr, sizeof(lstr), "%s", chan->ext_levels[idx].val.i ? "ON" : "OFF");
break;
case RIG_CONF_BUTTON:
@ -4705,16 +4705,16 @@ declare_proto_rig(send_cmd)
{
rig_debug(RIG_DEBUG_TRACE, "%s: we're netrigctl#2\n", __func__);
//snprintf(bufcmd, sizeof(bufcmd), "%s %s\n", cmd->cmd, arg1);
//SNPRINTF(bufcmd, sizeof(bufcmd), "%s %s\n", cmd->cmd, arg1);
if (cmd->cmd == 'w')
{
snprintf(bufcmd, sizeof(bufcmd), "%c %s\n", cmd->cmd, arg1);
SNPRINTF(bufcmd, sizeof(bufcmd), "%c %s\n", cmd->cmd, arg1);
}
else
{
int nbytes = 0;
sscanf(arg2, "%d", &nbytes);
snprintf(bufcmd, sizeof(bufcmd), "%c %s %d\n", cmd->cmd, arg1, nbytes);
SNPRINTF(bufcmd, sizeof(bufcmd), "%c %s %d\n", cmd->cmd, arg1, nbytes);
}
cmd_len = strlen(bufcmd);
@ -4738,7 +4738,7 @@ declare_proto_rig(send_cmd)
eom_buf[2] = send_cmd_term;
snprintf(tmpbuf, sizeof(tmpbuf), "0x%02x 0x%02x 0x%02x", eom_buf[0], eom_buf[1],
SNPRINTF(tmpbuf, sizeof(tmpbuf), "0x%02x 0x%02x 0x%02x", eom_buf[0], eom_buf[1],
eom_buf[2]);
rig_debug(RIG_DEBUG_TRACE, "%s: text protocol, send_cmd_term=%s\n", __func__,
@ -4814,7 +4814,7 @@ declare_proto_rig(send_cmd)
for (i = 0; i < retval; ++i)
{
snprintf(hex, sizeof(hex), "\\0x%02X", (unsigned char)buf[i]);
SNPRINTF(hex, sizeof(hex), "\\0x%02X", (unsigned char)buf[i]);
if ((strlen(hexbuf) + strlen(hex) + 1) >= hexbufbytes)
{

Wyświetl plik

@ -799,7 +799,7 @@ static int handle_ts2000(void *arg)
rig_debug(RIG_DEBUG_ERR, "%s: unexpected vfo=%d\n", __func__, vfo);
}
snprintf(response,
SNPRINTF(response,
sizeof(response),
fmt,
(uint64_t)freq,
@ -824,14 +824,14 @@ static int handle_ts2000(void *arg)
rmode_t mode = ts2000_get_mode();
char response[32];
snprintf(response, sizeof(response), "MD%1d;", (int)mode);
SNPRINTF(response, sizeof(response), "MD%1d;", (int)mode);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "AG0;") == 0)
{
char response[32];
snprintf(response, sizeof(response), "AG0000;");
SNPRINTF(response, sizeof(response), "AG0000;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "FA;") == 0)
@ -849,7 +849,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "FA%011"PRIll";", (uint64_t)freq);
SNPRINTF(response, sizeof(response), "FA%011"PRIll";", (uint64_t)freq);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "FB;") == 0)
@ -866,14 +866,14 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "FB%011"PRIll";", (uint64_t)freq);
SNPRINTF(response, sizeof(response), "FB%011"PRIll";", (uint64_t)freq);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "SA;") == 0)
{
char response[32];
snprintf(response, sizeof(response), "SA0;");
SNPRINTF(response, sizeof(response), "SA0;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "RX;") == 0)
@ -881,7 +881,7 @@ static int handle_ts2000(void *arg)
char response[32];
rig_set_ptt(my_rig, vfo_fixup(my_rig, RIG_VFO_A, my_rig->state.cache.split), 0);
snprintf(response, sizeof(response), "RX0;");
SNPRINTF(response, sizeof(response), "RX0;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
// Now some commands to set things
@ -957,7 +957,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "FR%c;", nvfo + '0');
SNPRINTF(response, sizeof(response), "FR%c;", nvfo + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
return retval;
@ -986,7 +986,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "FT%c;", nvfo + '0');
SNPRINTF(response, sizeof(response), "FT%c;", nvfo + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
return retval;
@ -1004,7 +1004,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "TN%02d;", val);
SNPRINTF(response, sizeof(response), "TN%02d;", val);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "TN", 2) == 0)
@ -1059,7 +1059,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "PA%c%c;", valA + '0', valB + '0');
SNPRINTF(response, sizeof(response), "PA%c%c;", valA + '0', valB + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "PA", 2) == 0)
@ -1118,7 +1118,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "XT%c;", val + '0');
SNPRINTF(response, sizeof(response), "XT%c;", val + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "XT", 2) == 0)
@ -1162,7 +1162,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "NR%c;", val + '0');
SNPRINTF(response, sizeof(response), "NR%c;", val + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "NR", 2) == 0)
@ -1207,7 +1207,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "NB%c;", val + '0');
SNPRINTF(response, sizeof(response), "NB%c;", val + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "NB", 2) == 0)
@ -1254,7 +1254,7 @@ static int handle_ts2000(void *arg)
}
level = val.f * 255;
snprintf(response, sizeof(response), "AG0%03d;", level);
SNPRINTF(response, sizeof(response), "AG0%03d;", level);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "AG", 2) == 0)
@ -1305,7 +1305,7 @@ static int handle_ts2000(void *arg)
}
speechLevel = val.f * 255;
snprintf(response, sizeof(response), "PR%03d;", speechLevel);
SNPRINTF(response, sizeof(response), "PR%03d;", speechLevel);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "PR", 2) == 0)
@ -1363,7 +1363,7 @@ static int handle_ts2000(void *arg)
}
agcLevel = val.f * 255;
snprintf(response, sizeof(response), "GT%03d;", agcLevel);
SNPRINTF(response, sizeof(response), "GT%03d;", agcLevel);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "GT", 2) == 0)
@ -1414,7 +1414,7 @@ static int handle_ts2000(void *arg)
}
sqlev = val.f * 255;
snprintf(response, sizeof(response), "SQ%03d;", sqlev);
SNPRINTF(response, sizeof(response), "SQ%03d;", sqlev);
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "SQ", 2) == 0)
@ -1463,7 +1463,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "DC%c;", split + '0');
SNPRINTF(response, sizeof(response), "DC%c;", split + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
return retval;
@ -1494,7 +1494,7 @@ static int handle_ts2000(void *arg)
return retval;
}
snprintf(response, sizeof(response), "DC%c;", split + '0');
SNPRINTF(response, sizeof(response), "DC%c;", split + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
return retval;
@ -1558,7 +1558,7 @@ static int handle_ts2000(void *arg)
case 9: mode = RIG_MODE_RTTYR; break;
}
snprintf(response, sizeof(response), "MD%c;", mode + '0');
SNPRINTF(response, sizeof(response), "MD%c;", mode + '0');
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strcmp(arg, "PS1;") == 0)
@ -1573,7 +1573,7 @@ static int handle_ts2000(void *arg)
{
char response[32];
snprintf(response, sizeof(response), "PS1;");
SNPRINTF(response, sizeof(response), "PS1;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else if (strncmp(arg, "SB", 2) == 0
@ -1606,7 +1606,7 @@ static int handle_ts2000(void *arg)
{
char response[32];
snprintf(response, sizeof(response), "?;");
SNPRINTF(response, sizeof(response), "?;");
return write_block2((void *)__func__, &my_com, response, strlen(response));
}
else

Wyświetl plik

@ -593,7 +593,7 @@ int main(int argc, char *argv[])
rig_set_debug(verbose);
snprintf(rigstartup, sizeof(rigstartup), "%s(%d) Startup:", __FILE__, __LINE__);
SNPRINTF(rigstartup, sizeof(rigstartup), "%s(%d) Startup:", __FILE__, __LINE__);
for (i = 0; i < argc; ++i) { strcat(rigstartup, " "); strcat(rigstartup, argv[i]); }

Wyświetl plik

@ -438,7 +438,7 @@ int main(int argc, char *argv[])
hist_path_size = sizeof(char) * (strlen(hist_dir) + strlen(hist_file) + 1);
hist_path = (char *)calloc(hist_path_size, sizeof(char));
snprintf(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
SNPRINTF(hist_path, hist_path_size, "%s%s", hist_dir, hist_file);
}

Wyświetl plik

@ -296,11 +296,11 @@ void hash_add_model(int id,
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
s->id = id;
snprintf(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
snprintf(s->model_name, sizeof(s->model_name), "%s", model_name);
snprintf(s->version, sizeof(s->version), "%s", version);
snprintf(s->status, sizeof(s->status), "%s", status);
snprintf(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
SNPRINTF(s->model_name, sizeof(s->model_name), "%s", model_name);
SNPRINTF(s->version, sizeof(s->version), "%s", version);
SNPRINTF(s->status, sizeof(s->status), "%s", status);
SNPRINTF(s->macro_name, sizeof(s->macro_name), "%s", macro_name);
HASH_ADD_INT(models, id, s); /* id: name of key field */
}
@ -1031,7 +1031,7 @@ int rotctl_parse(ROT *my_rot, FILE *fin, FILE *fout, char *argv[], int argc,
/* The starting position of the source string is the first
* character past the initial '\'.
*/
snprintf(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
SNPRINTF(cmd_name, sizeof(cmd_name), "%s", parsed_input[0] + 1);
/* Sanity check as valid multiple character commands consist of
* alphanumeric characters and the underscore ('_') character.
@ -2342,7 +2342,7 @@ declare_proto_rot(inter_set_conf)
return -RIG_EINVAL;
}
snprintf(buf, sizeof(buf), "%s=%s", arg1, arg2);
SNPRINTF(buf, sizeof(buf), "%s=%s", arg1, arg2);
return set_conf(rot, buf);
}