summaryrefslogtreecommitdiff
path: root/test_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-09-17 07:39:04 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-09-17 07:39:04 -0400
commit5f867ebf9204b679b71e64c97bbca9ae86112994 (patch)
tree529a6860eee54b454a95c29d88c0e7101dcf0a89 /test_json.c
parent5e33e08d8476eba830850f9cfab06fad19cf2cb4 (diff)
downloadgpsd-5f867ebf9204b679b71e64c97bbca9ae86112994.tar.gz
cppcheck ckeanup. All regression tests pass.
Diffstat (limited to 'test_json.c')
-rw-r--r--test_json.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/test_json.c b/test_json.c
index cf153263..cdae9f3e 100644
--- a/test_json.c
+++ b/test_json.c
@@ -326,16 +326,16 @@ static void jsontest(int i)
int main(int argc UNUSED, char *argv[]UNUSED)
{
- int option, i;
+ int option;
int individual = 0;
- while ((option = getopt(argc, argv, "hnD:?")) != -1) {
+ while ((option = getopt(argc, argv, "hn:D:?")) != -1) {
switch (option) {
case 'D':
gps_enable_debug(atoi(optarg), stdout);
break;
case 'n':
- individual = atoi(0);
+ individual = atoi(optarg);
break;
case '?':
case 'h':
@@ -349,9 +349,11 @@ int main(int argc UNUSED, char *argv[]UNUSED)
if (individual)
jsontest(individual);
- else
+ else {
+ int i;
for (i = 1; i <= MAXTEST; i++)
jsontest(i);
+ }
(void)fprintf(stderr, "succeeded.\n");