--- wwl-1.1.orig/wwl.c +++ wwl-1.1/wwl.c @@ -17,9 +17,9 @@ #include #include -void main (int argc, char **argv) { +int main (int argc, char **argv) { int l, p; - float z, y, n, h, x, w, f, t, s, v, u, c, d, e, lx; + double z, y, n, h, x, w, f, t, s, v, u, c, d, e, lx; char my_wwl[6], dx_wwl[6]; if (argc != 3) { @@ -40,70 +40,73 @@ strcpy(my_wwl, argv[1]); strcpy(dx_wwl, argv[2]); - if (my_wwl[0] > 97 && my_wwl[0] < 122) { my_wwl[0] = my_wwl[0] - 32; } + my_wwl[0] = toupper(my_wwl[0]); z = my_wwl[0] - 65; - if (my_wwl[1] > 97 && my_wwl[1] < 122) { my_wwl[1] = my_wwl[1] - 32; } + my_wwl[1] = toupper(my_wwl[1]); y = my_wwl[1] - 65; n = my_wwl[2] - 48; h = my_wwl[3] - 48; - if (my_wwl[4] > 97 && my_wwl[4] < 122) { my_wwl[4] = my_wwl[4] - 32; } + my_wwl[4] = toupper(my_wwl[4]); x = my_wwl[4] - 65; - if (my_wwl[5] > 97 && my_wwl[5] < 122) { my_wwl[5] = my_wwl[5] - 32; } + my_wwl[5] = toupper(my_wwl[5]); w = my_wwl[5] - 65; - if (my_wwl[0] < 65 || my_wwl[0] > 90 || - my_wwl[1] < 65 || my_wwl[1] > 90 || + if (my_wwl[0] < 65 || my_wwl[0] > 88 || + my_wwl[1] < 65 || my_wwl[1] > 88 || my_wwl[2] < 48 || my_wwl[2] > 57 || my_wwl[3] < 48 || my_wwl[3] > 57 || - my_wwl[4] < 65 || my_wwl[4] > 90 || - my_wwl[5] < 65 || my_wwl[5] > 90 ) { + my_wwl[4] < 65 || my_wwl[4] > 88 || + my_wwl[5] < 65 || my_wwl[5] > 88 ) { printf("%s: not a valid locator\n", my_wwl); exit(1); } - t = z * 20 - 180 + n * 2 + x / 12 + 1; + t = z * 20 - 180 + n * 2 + x / 12 + 1.0 / 24; t = t * 3.1415926 / 180; - s = y * 10 - 90 + h + w / 24 + 1 / 48; + s = y * 10 - 90 + h + w / 24 + 1.0 / 48; s = s * 3.1415926 / 180; - if (dx_wwl[0] > 97 && dx_wwl[0] < 122) { dx_wwl[0] = dx_wwl[0] - 32; } + dx_wwl[0] = toupper(dx_wwl[0]); z = dx_wwl[0] - 65; - if (dx_wwl[1] > 97 && dx_wwl[1] < 122) { dx_wwl[1] = dx_wwl[1] - 32; } + dx_wwl[1] = toupper(dx_wwl[1]); y = dx_wwl[1] - 65; n = dx_wwl[2] - 48; h = dx_wwl[3] - 48; - if (dx_wwl[4] > 97 && dx_wwl[4] < 122) { dx_wwl[4] = dx_wwl[4] - 32; } + dx_wwl[4] = toupper(dx_wwl[4]); x = dx_wwl[4] - 65; - if (dx_wwl[5] > 97 && dx_wwl[5] < 122) { dx_wwl[5] = dx_wwl[5] - 32; } + dx_wwl[5] = toupper(dx_wwl[5]); w = dx_wwl[5] - 65; - if (dx_wwl[0] < 65 || dx_wwl[0] > 90 || - dx_wwl[1] < 65 || dx_wwl[1] > 90 || + if (dx_wwl[0] < 65 || dx_wwl[0] > 88 || + dx_wwl[1] < 65 || dx_wwl[1] > 88 || dx_wwl[2] < 48 || dx_wwl[2] > 57 || dx_wwl[3] < 48 || dx_wwl[3] > 57 || - dx_wwl[4] < 65 || dx_wwl[4] > 90 || - dx_wwl[5] < 65 || dx_wwl[5] > 90 ) { + dx_wwl[4] < 65 || dx_wwl[4] > 88 || + dx_wwl[5] < 65 || dx_wwl[5] > 88 ) { printf("%s: not a valid locator\n", dx_wwl); exit(1); } - v = z * 20 - 180 + n * 2 + x / 12 + 1; + v = z * 20 - 180 + n * 2 + x / 12 + 1.0 / 24; v = v * 3.1415926 / 180; - u = y * 10 - 90 + h + w / 24 + 1 / 48; + u = y * 10 - 90 + h + w / 24 + 1.0 / 48; u = u * 3.1415926 / 180; c = cos(s) * cos(u) * cos(v - t) + sin(s) * sin(u); d = 1 - c * c; - if (cos(u) * sqrt(d) != 0) { - e = (sin(s) - sin(u) * c) / (cos(u) * sqrt(d)); - f = fabs(1 - e * e); - lx = ((3.1415926 / 2) - (atan(- e / sqrt(f)))) * 180 / 3.1415926; + if (sqrt(d) != 0) { + e = (sin(u) - sin(s) * c) / (cos(s) * sqrt(d)); + if (e>1.0) e=1.0; + if (e<-1.0) e=-1.0; + lx = acos(e) * 180 / 3.1415926; l = (int) (lx + 0.5); } else { l = 0; } - if ((v - t) < 0) { l = 360 - l; } + if (sin(v - t) < 0) { l = 360 - l; } p = (int) ((atan(sqrt(d) / c) * 6371.33) + .5); printf("qrb: %d kilometers, azimuth: %d degrees\n", p, l); + + return 0; } --- wwl-1.1.orig/debian/changelog +++ wwl-1.1/debian/changelog @@ -0,0 +1,39 @@ +wwl (1.1-6) unstable; urgency=low + + * Added manual page contributed by Kevin Kreamer + (closes: #191903) + * Upgrade to debhelper 4 + + -- Hamish Moffatt Tue, 6 May 2003 00:03:20 +1000 + +wwl (1.1-5) unstable; urgency=low + + * Cleaned up some Lintian warnings + + -- Hamish Moffatt Thu, 31 Jan 2002 00:03:51 +1100 + +wwl (1.1-4) unstable; urgency=low + + * Fixed bugs in calculating azimuth (closes: #70425) + Thanks to Pieter-Tjerk de Boer for the fixes. + + -- Hamish Moffatt Tue, 2 Jan 2001 23:01:29 +1100 + +wwl (1.1-3) unstable; urgency=low + + * Fixed bugs with lower case and incorrect locators (closes: #69826) + + -- Hamish Moffatt Sat, 26 Aug 2000 12:32:09 +1000 + +wwl (1.1-2) unstable; urgency=low + + * FHS compliant + + -- Hamish Moffatt Fri, 1 Oct 1999 19:07:00 +1000 + +wwl (1.1-1) unstable; urgency=low + + * First upload + + -- Hamish Moffatt Sun, 13 Dec 1998 15:55:00 +1100 + --- wwl-1.1.orig/debian/control +++ wwl-1.1/debian/control @@ -0,0 +1,13 @@ +Source: wwl +Section: hamradio +Priority: optional +Maintainer: Hamish Moffatt +Standards-Version: 3.5.9 +Build-Depends: debhelper (>= 4) + +Package: wwl +Architecture: any +Depends: ${shlibs:Depends} +Description: Calculates distance and azimuth between two Maidenhead locators + Given two Maidenhead locators, wwl calculates distance (qrb) and azimuth. + --- wwl-1.1.orig/debian/copyright +++ wwl-1.1/debian/copyright @@ -0,0 +1,14 @@ +This is the Debian GNU/Linux package of wwl. +This package was put together from sources obtained at: + http://www.geocities.com/BourbonStreet/2903/wwl-1.1.tar.gz +by Hamish Moffatt + +(C) 1998 by IK0ZSN Mirko Caserta +This software is placed under the terms of the GNU General Public Licence. + +A copy of the GNU General Public License is available as +/usr/share/common-licenses/GPL in the Debian GNU/Linux distribution or on the +World Wide Web at http://www.gnu.org/copyleft/gpl.html. You can also +obtain it by writing to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA. + --- wwl-1.1.orig/debian/rules +++ wwl-1.1/debian/rules @@ -0,0 +1,45 @@ +#!/usr/bin/make -f +# Based on debian/rules from hello-debmake by Santiago Vila + +package = cam + +build: + dh_testdir + gcc -lm -o wwl wwl.c + touch build + +clean: + dh_testdir + -rm -f build + -rm wwl + -rm -f `find . -name "*~"` + dh_clean + +binary-indep: build +# nothing else to do + +binary-arch: build + dh_clean + dh_installdirs + install wwl `pwd`/debian/wwl/usr/bin + + dh_installdocs + dh_installman debian/wwl.1 + dh_installchangelogs + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_makeshlibs + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch + +checkroot: + dh_testdir + dh_testroot + +.PHONY: binary binary-arch binary-indep clean checkroot --- wwl-1.1.orig/debian/wwl.1 +++ wwl-1.1/debian/wwl.1 @@ -0,0 +1,22 @@ +.TH "wwl" 1 "May 2003" "wwl" "Debian" +.SH NAME +wwl \- Calculate distance and azimuth given two Maidenhead locators. +.SH SYNOPSIS +.B wwl +\fImy_locator\fR \fIdx_locator\fR +.SH DESCRIPTION +.B wwl +is a small utility that calculates the distance and azimuth given +two Maidenhead locators. Both locators must include subsquare and +be 6 digits long. +.SH OPTIONS +.TP +\fImy_locator\fR +The locator of your current position. +.TP +\fIdx_locator\fR +The locator of the remote target. +.SH AUTHOR +IK0ZSN Mirko Caserta +.SH SEE ALSO +http://www.arrl.org/locate/gridinfo.html --- wwl-1.1.orig/debian/compat +++ wwl-1.1/debian/compat @@ -0,0 +1 @@ +4 --- wwl-1.1.orig/debian/wwl.dirs +++ wwl-1.1/debian/wwl.dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/man/man1 +usr/share/doc/wwl