kopia lustrzana https://github.com/Hamlib/Hamlib
Add check for -s switch on all utils to ensure integer is entered
rodzic
c332036efe
commit
f454cff0b7
|
@ -142,6 +142,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc,
|
c = getopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
|
@ -191,7 +192,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -185,6 +185,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
||||||
|
|
||||||
|
@ -230,7 +231,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -158,6 +158,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc,
|
c = getopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
|
@ -353,7 +354,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -4085,9 +4085,9 @@ declare_proto_rig(dump_state)
|
||||||
// backward compatible as new values will just generate warnings
|
// backward compatible as new values will just generate warnings
|
||||||
if (chk_vfo_executed) // for 3.3 compatiblility
|
if (chk_vfo_executed) // for 3.3 compatiblility
|
||||||
{
|
{
|
||||||
fprintf(fout, "vfo_ops=0x%x\n", rig->caps->vfo_ops);
|
fprintf(fout, "vfo_ops=0x%x\n", rig->caps->vfo_ops);
|
||||||
fprintf(fout, "ptt_type=0x%x\n", rig->state.pttport.type.ptt);
|
fprintf(fout, "ptt_type=0x%x\n", rig->state.pttport.type.ptt);
|
||||||
fprintf(fout, "done\n");
|
fprintf(fout, "done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 // why isn't this implemented? Does anybody care?
|
#if 0 // why isn't this implemented? Does anybody care?
|
||||||
|
|
|
@ -227,6 +227,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc,
|
c = getopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
|
@ -393,7 +394,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
|
|
|
@ -265,6 +265,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc,
|
c = getopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
|
@ -442,7 +443,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -115,6 +115,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
||||||
|
|
||||||
|
@ -170,7 +171,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -99,6 +99,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
||||||
|
|
||||||
|
@ -154,7 +155,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -89,6 +89,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
||||||
|
|
||||||
|
@ -144,7 +145,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -147,6 +147,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc,
|
c = getopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
|
@ -196,7 +197,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
|
@ -179,6 +179,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
char dummy[2];
|
||||||
|
|
||||||
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
c = getopt_long(argc, argv, SHORT_OPTIONS, long_options, &option_index);
|
||||||
|
|
||||||
|
@ -224,7 +225,12 @@ int main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_rate = atoi(optarg);
|
if (sscanf(optarg, "%d%1s", &serial_rate, dummy) != 1)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Invalid baud rate of %s\n", optarg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
|
|
Ładowanie…
Reference in New Issue