Skip to content

Commit 2fd4ae2

Browse files
committed
Added library version to usage()
1 parent d5620db commit 2fd4ae2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

mapcode.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ static const double PI = 3.14159265358979323846;
1111
static const int RESULTS_MAX = 64;
1212

1313
static void usage(const char* appName) {
14+
printf("MAPCODE (C library version %s)\n", mapcode_cversion);
15+
printf("Copyright (C) 2014 Stichting Mapcode Foundation\n");
16+
printf("\n");
1417
printf("Usage: \n");
1518
printf(" %s [-d | --decode] <default-territory> <mapcode> [<mapcode> ...]\n", appName);
1619
printf("\n");
@@ -46,7 +49,7 @@ static void usage(const char* appName) {
4649
* (x, y, z) point on a sphere with a radius of 1.
4750
*/
4851
static void unitToLatLonDegXYZ(
49-
const double unit1, const double unit2,
52+
const double unit1, const double unit2,
5053
double* latDeg, double* lonDeg, double* x, double* y, double* z) {
5154

5255
// Calculate uniformly distributed 3D point on sphere (radius = 1.0):
@@ -122,7 +125,7 @@ int main(const int argc, const char** argv)
122125
const char* results[RESULTS_MAX];
123126
const int nrResults = coord2mc(results, lat, lon, context);
124127
if (nrResults <= 0) {
125-
fprintf(stderr, "error: cannot encode lat=%s, lon=%s (default territory=%d)\n",
128+
fprintf(stderr, "error: cannot encode lat=%s, lon=%s (default territory=%d)\n",
126129
argv[2], argv[3], context);
127130
return -1;
128131
}
@@ -218,10 +221,10 @@ int main(const int argc, const char** argv)
218221
}
219222

220223
/**
221-
* This program can encode and decode Mapcodes. It can also generate reference Mapcodes,
224+
* This program can encode and decode Mapcodes. It can also generate reference Mapcodes,
222225
* lat/lon pairs and their corresponding (x, y, z) coordinates.
223226
*
224-
* If you'd like to visualize the generated points, you can use "Processing" from
227+
* If you'd like to visualize the generated points, you can use "Processing" from
225228
* processing.org with the following Processing (Java) source code:
226229
*
227230
@@ -263,7 +266,7 @@ int main(const int argc, const char** argv)
263266
total = 0;
264267
BufferedReader reader = createReader(DATA_FILE);
265268
try {
266-
while (true) {
269+
while (true) {
267270
String line = reader.readLine();
268271
if (line == null) {
269272
break;
@@ -277,7 +280,7 @@ int main(const int argc, const char** argv)
277280
px[total] = Float.parseFloat(items[3]);
278281
py[total] = Float.parseFloat(items[4]);
279282
pz[total] = Float.parseFloat(items[5]);
280-
283+
281284
// Skip codes.
282285
for (int i = 0; i < nrItems; ++i) {
283286
reader.readLine();
@@ -305,13 +308,13 @@ int main(const int argc, const char** argv)
305308
rotateX(rotX);
306309
rotateY(rotY);
307310
rotateZ(rotZ);
308-
311+
309312
// Draw sphere.
310313
stroke(255, 0, 0, 50);
311314
fill(255, 0, 0, 50);
312315
sphere(C * 0.95);
313316
stroke(255, 0, 0, 255);
314-
317+
315318
// Draw poles.
316319
line(0, 0, -C - 200, 0, 0, C + 200);
317320
@@ -336,7 +339,7 @@ int main(const int argc, const char** argv)
336339
line(C + 5, -C - 50, -C - 5, -C - 5, -C - 50, -C - 5);
337340
line(-C - 5, -C - 50, -C - 5, -C - 5, -C - 50, C + 5);
338341
line(-C - 5, -C - 50, C + 5, C + 5, -C - 50, C + 5);
339-
342+
340343
// Draw lat/lon dots.
341344
stroke(255, 255, 0, 200);
342345
for (int i = 0; i < total; ++i) {

0 commit comments

Comments
 (0)