From 24b463104d183755b540f966ee2fee4d891589e2 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 10 Sep 2009 16:53:28 +0000 Subject: ax25_ntoa: Don't emit SSID suffix if the SSID is zero. From: Matti Aarnio OH2MQK --- axutils.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'axutils.c') diff --git a/axutils.c b/axutils.c index 3fbaa3e..f6e8713 100644 --- a/axutils.c +++ b/axutils.c @@ -198,14 +198,17 @@ char *ax25_ntoa(const ax25_address *a) if (c != ' ') *s++ = c; } - *s++ = '-'; + /* Convention is: -0 suffixes are NOT printed */ + if (a->ax25_call[6] & 0x1E) { + *s++ = '-'; - if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { - *s++ = '1'; - n -= 10; + if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { + *s++ = '1'; + n -= 10; + } + *s++ = n + '0'; } - - *s++ = n + '0'; + *s++ = '\0'; return buf; -- cgit v1.2.3