acarsdec

an ACARS decoder
git clone git://r-36.net/acarsdec
Log | Files | Refs | README

commit 55d126e9a6f958e00e9f6196786f213ee9d7f643
parent 45bafeee14982a9d10e1e3dd33b08beeb93eee6f
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 13 Jun 2012 15:26:15 +0200

Applying some changes to the decoding and copyright.

Diffstat:
getmesg.c | 14++++++++++++--
input.c | 2+-
main.c | 20++++++++++----------
3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/getmesg.c b/getmesg.c @@ -66,8 +66,18 @@ static int build_mesg(char *txt, int len, msg_t * msg) /* remove special chars */ for (i = 0; i < len; i++) { r = txt[i]; - if (r < ' ' && r != 0x0d && r != 0x0a) - r = 0xa4; + switch(r) { + case 0x0d: + r = 176; + break; + case 0x0a: + r = 178; + break; + default: + if (r < ' ') + r = 0xa4; + break; + }; txt[i] = r; } txt[i] = '\0'; diff --git a/input.c b/input.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2007 by Thierry Leconte (F4DWV) - * (c) 2010 by Christoph Lohmann <20h@r-36.net> + * (c) 2010-12 by Christoph Lohmann <20h@r-36.net> * * $Id: input.c,v 1.3 2007/03/29 16:21:49 f4dwv Exp $ * diff --git a/main.c b/main.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2007 by Thierry Leconte (F4DWV) - * (c) 2010 by Christoph Lohmann <20h@r-36.net> + * (c) 2010-12 by Christoph Lohmann <20h@r-36.net> * * $Id: main.c,v 1.5 2007/04/22 16:14:41 f4dwv Exp $ * @@ -69,10 +69,11 @@ void print_mesg(msg_t * msg) printf("Flight id: %s\n", msg->fid); printf("Message content:-\n%s", msg->txt); - if (posconv(msg->txt, msg->label, pos)==0) - printf("\nAPRS : Addr:%s Fid:%s Lbl:%s pos:%s\n", msg->addr, - msg->fid,msg->label,pos); - + if (posconv(msg->txt, msg->label, pos)==0) { + printf("\nAPRS : Addr:%s Fid:%s Lbl:%s pos:%s\n", + msg->addr, msg->fid, msg->label, pos); + } + t = time(NULL); tmp = gmtime(&t); printf("\n--------------------------------------------" @@ -80,7 +81,6 @@ void print_mesg(msg_t * msg) tmp->tm_mday, tmp->tm_mon + 1, tmp->tm_year + 1900, tmp->tm_hour, tmp->tm_min); fflush(stdout); - } void print_proto(msg_t * msg) @@ -182,14 +182,14 @@ int main(int argc, char **argv) exit(1); } - if (port) { + if (port) { if (init_serv(port)) exit(1); - if (debug) + if (debug) fprintf(stderr, "Server initialized.\n"); } - -/* main loop */ + + /* main loop */ init_bits(); init_mesg();