From 222995312581c9e9f620c3441965ae27ea72df40 Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Mon, 1 Jul 2024 09:56:02 -0400 Subject: [PATCH] 'mergetle' sorted NORAD numbers lexicographically rather than numerically. Leading zeroes could cause confusion (e.g., '03141' wasn't considered equal to ' 3141'). --- mergetle.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mergetle.cpp b/mergetle.cpp index b747f15..1a28eb3 100644 --- a/mergetle.cpp +++ b/mergetle.cpp @@ -114,8 +114,7 @@ int tle_compare( const TLE *tle1, const TLE *tle2, const char sort_method) switch( sort_method) { case 'n': case 'N': /* sort by NORAD number */ - for( i = 2; !rval && i < 8; i++) - rval = tle1->line1[i] - tle2->line1[i]; + rval = atoi( tle1->line1 + 2) - atoi( tle2->line1 + 2); break; case 'c': case 'C': /* sort by COSPAR (international) desig */ if( tle1->line1[9] >= '5' && tle2->line1[9] < '5')