summaryrefslogtreecommitdiff
path: root/cgpxlogger.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2005-09-28 16:49:15 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2005-09-28 16:49:15 +0000
commit542c74c987da03f80352dc208622158e1186d51c (patch)
tree1a18b79c25a4c67be449e47f4e97e5eca4dcb6e9 /cgpxlogger.c
parenta922b9b373a5fcd251a1e054056fcc45e0424a41 (diff)
downloadgpsd-542c74c987da03f80352dc208622158e1186d51c.tar.gz
Why did I ever think it was necessary to jump through that convoluted hoop.
As I'm reading numbers, I'll just let scanf() sort it out, then I don't need to worry about string read lengths. Also, why did I comment out the test around the timestamp?
Diffstat (limited to 'cgpxlogger.c')
-rw-r--r--cgpxlogger.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/cgpxlogger.c b/cgpxlogger.c
index d4361a15..3b27d3e8 100644
--- a/cgpxlogger.c
+++ b/cgpxlogger.c
@@ -196,7 +196,7 @@ void bye(int signum){ want_exit = signum; }
void process(char *buf){
char *answers[NUM + 2], **ap;
int i, j;
- char c, junk1[16], junk2[16];
+ char c;
if (strncmp("GPSD,", buf, 5) != 0)
return; /* lines should start with "GPSD," */
@@ -228,10 +228,7 @@ void process(char *buf){
gps_ctx.status = j;
break;
case 'P':
- bzero( &junk1, 16);
- bzero( &junk2, 16);
- sscanf(answers[i], "P=%12s %12s", (char *)&junk1, (char *)&junk2);
- gps_ctx.latitude = atof((char *)&junk1); gps_ctx.longitude = atof((char *)&junk2);
+ sscanf(answers[i], "P=%lf %lf", &gps_ctx.latitude, &gps_ctx.longitude);
break;
case 'A':
sscanf(answers[i], "A=%f", &gps_ctx.altitude);
@@ -291,7 +288,7 @@ void write_record(){
if ((gps_ctx.svs > 0) && (gps_ctx.mode >= 2))
printf(" <sat>%d</sat>\n", gps_ctx.svs);
-// if (strlen(gps_ctx.time)) /* plausible timestamp */
+ if (strlen(gps_ctx.time)) /* plausible timestamp */
printf(" <time>%s</time>\n", gps_ctx.time);
printf(" </trkpt>\n");
fflush(stdout);