int usage(int retval, bool brief) {
  if (brief)
    ( retval ? std::cerr : std::cout ) << "Usage:\n"
"    GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s |\n"
"    -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version |\n"
"    -h | --help ] [ --input-file infile | --input-string instring ] [\n"
"    --line-separator linesep ] [ --output-file outfile ]\n"
"\n"
"For full documentation type:\n"
"    GeoConvert --help\n"
"or visit:\n"
"    http://geographiclib.sf.net/html/GeoConvert.1.html\n";
  else
    ( retval ? std::cerr : std::cout ) << "Man page:\n"
"NAME\n"
"       GeoConvert -- convert geographic coordinates\n"
"\n"
"SYNOPSIS\n"
"       GeoConvert [ -g | -d | -: | -u | -m | -c ] [ -p prec ] [ -z zone | -s |\n"
"       -t ] [ -n ] [ -w ] [ --comment-delimiter commentdelim ] [ --version |\n"
"       -h | --help ] [ --input-file infile | --input-string instring ] [\n"
"       --line-separator linesep ] [ --output-file outfile ]\n"
"\n"
"DESCRIPTION\n"
"       GeoConvert reads from standard input interpreting each line as a\n"
"       geographic coordinate and prints the coordinate in the format specified\n"
"       by the options on standard output.  The input is interpreted in one of\n"
"       three different ways depending on how many space or comma delimited\n"
"       tokens there are on the line.  The options -g, -d, -u, and -m govern\n"
"       the format of output.  In all cases, the WGS84 model of the earth is\n"
"       used (a = 6378137 m, f = 1/298.257223563).\n"
"\n"
"       geographic\n"
"           2 tokens (output options -g, -d, or -:) given as latitude longitude\n"
"           using decimal degrees or degrees minutes seconds.  d, ', and \" are\n"
"           used to denote degrees, minutes, and seconds, with the least\n"
"           significant designator optional.  (See QUOTING for how to quote the\n"
"           characters ' and \" when entering coordinates on the command line.)\n"
"           Various unicode characters (encoded with UTF-8) may also be used to\n"
"           denote degrees, minutes, and seconds, e.g., the degree, prime, and\n"
"           double prime symbols.  Alternatively, : (colon) may be used to\n"
"           separate the various components.  Latitude is given first (unless\n"
"           the -w option is given); however, on input, either may be given\n"
"           first by appending or prepending N or S to the latitude and E or W\n"
"           to the longitude.  For example, the following are all equivalent\n"
"\n"
"               33.3 44.4\n"
"               E44.4 N33.3\n"
"               33d18'N 44d24'E\n"
"               44d24 33d18N\n"
"               33:18 44:24\n"
"\n"
"       UTM/UPS\n"
"           3 tokens (output option -u) given as zone+hemisphere easting\n"
"           northing or easting northing zone+hemisphere, where hemisphere is\n"
"           either N or S.  The zone is absent for a UPS specification.  For\n"
"           example,\n"
"\n"
"               38N 444140.54 3684706.36\n"
"               444140.54 3684706.36 38N\n"
"               S 2173854.98 2985980.58\n"
"               2173854.98 2985980.58 S\n"
"\n"
"       MRGS\n"
"           1 token (output option -m) is used to specify the center of an MGRS\n"
"           grid square.  For example,\n"
"\n"
"               38SMB4484\n"
"               38SMB44140847064\n"
"\n"
"OPTIONS\n"
"       -g  output latitude and longitude using decimal degrees.  Default\n"
"           output mode.\n"
"\n"
"       -d  output latitude and longitude using degrees, minutes, and seconds\n"
"           (DMS).\n"
"\n"
"       -:  like -d, except use : as a separator instead of the d, ', and \"\n"
"           delimiters.\n"
"\n"
"       -u  output UTM or UPS.\n"
"\n"
"       -m  output MGRS.\n"
"\n"
"       -c  output meridian convergence and scale for the corresponding UTM or\n"
"           UPS projection.  Convergence is the bearing of grid north given as\n"
"           degrees clockwise from true north.\n"
"\n"
"       -p  set the output precision to prec (default 0); prec is the precision\n"
"           relative to 1 m.  See PRECISION.\n"
"\n"
"       -z  set the zone to zone for output.  Use either 0 < zone <= 60 for a\n"
"           UTM zone or zone = 0 for UPS.  Alternatively use a zone+hemisphere\n"
"           designation, e.g., 38N.  See ZONE.\n"
"\n"
"       -s  use the standard UPS and UTM zones.\n"
"\n"
"       -t  similar to -s but forces UPS regions to the closest UTM zone.\n"
"\n"
"       -n  on input, MGRS coordinates refer to the south-west corner of the\n"
"           MGRS square instead of the center; see MGRS.\n"
"\n"
"       -w  on input and output, longitude precedes latitude (except that on\n"
"           input this can be overridden by a hemisphere designator, N, S, E,\n"
"           W).\n"
"\n"
"       --comment-delimiter\n"
"           set the comment delimiter to commentdelim (e.g., \"#\" or \"//\").  If\n"
"           set, the input lines will be scanned for this delimiter and, if\n"
"           found, the delimiter and the rest of the line will be removed prior\n"
"           to processing and subsequently appended to the output line\n"
"           (separated by a space).\n"
"\n"
"       --version\n"
"           print version and exit.\n"
"\n"
"       -h  print usage and exit.\n"
"\n"
"       --help\n"
"           print full documentation and exit.\n"
"\n"
"       --input-file\n"
"           read input from the file infile instead of from standard input; a\n"
"           file name of \"-\" stands for standard input.\n"
"\n"
"       --input-string\n"
"           read input from the string instring instead of from standard input.\n"
"           All occurrences of the line separator character (default is a\n"
"           semicolon) in instring are converted to newlines before the reading\n"
"           begins.\n"
"\n"
"       --line-separator\n"
"           set the line separator character to linesep.  By default this is a\n"
"           semicolon.\n"
"\n"
"       --output-file\n"
"           write output to the file outfile instead of to standard output; a\n"
"           file name of \"-\" stands for standard output.\n"
"\n"
"PRECISION\n"
"       prec gives precision of the output with prec = 0 giving 1 m precision,\n"
"       prec = 3 giving 1 mm precision, etc.  prec is the number of digits\n"
"       after the decimal point for UTM/UPS.  The number of digits per\n"
"       coordinate for MGRS is 5 + prec.  For decimal degrees, the number of\n"
"       digits after the decimal point is 5 + prec.  For DMS (degree, minute,\n"
"       seconds) output, the number of digits after the decimal point in the\n"
"       seconds components is 1 + prec; if this is negative then use minutes\n"
"       (prec = -2 or -3) or degrees (prec <= -4) as the least significant\n"
"       component.  Print convergence, resp. scale, with 5 + prec, resp. 7 +\n"
"       prec, digits after the decimal point.  The minimum value of prec is -5\n"
"       and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6\n"
"       for MGRS, and 8 for convergence and scale.\n"
"\n"
"MGRS\n"
"       MGRS coordinates represent a square patch of the earth, thus\n"
"       \"38SMB4488\" is in zone \"38N\" with 444km <= easting < 445km and 3688km\n"
"       <= northing < 3689km.  Consistent with this representation, coordinates\n"
"       are truncated (instead of rounded) to the requested precision.\n"
"       Similarly, on input an MGRS coordinate represents the center of the\n"
"       square (\"38N 444500 3688500\" in the example above).  However, if the -n\n"
"       option is given then the south-west corner of the square is returned\n"
"       instead (\"38N 444000 3688000\" in the example above).\n"
"\n"
"ZONE\n"
"       If the input is geographic, GeoConvert uses the standard rules of\n"
"       selecting UTM vs UPS and for assigning the UTM zone (with the Norway\n"
"       and Svalbard exceptions).  If the input is UTM/UPS or MGRS, then the\n"
"       choice between UTM and UPS and the UTM zone mirrors the input.  The -z\n"
"       zone, -s, and -t options allow these rules to be overridden with zone =\n"
"       0 being used to indicate UPS.  For example, the point\n"
"\n"
"          79.9S 6.1E\n"
"\n"
"       corresponds to possible MGRS coordinates\n"
"\n"
"          32CMS4324728161 (standard UTM zone = 32)\n"
"          31CEM6066227959 (neighboring UTM zone = 31)\n"
"            BBZ1945517770 (neighboring UPS zone)\n"
"\n"
"       then\n"
"\n"
"          echo 79.9S 6.1E      | GeoConvert -p -3 -m       => 32CMS4328\n"
"          echo 31CEM6066227959 | GeoConvert -p -3 -m       => 31CEM6027\n"
"          echo 31CEM6066227959 | GeoConvert -p -3 -m -s    => 32CMS4328\n"
"          echo 31CEM6066227959 | GeoConvert -p -3 -m -z 0  =>   BBZ1917\n"
"\n"
"       Is zone is specified with a hemisphere, then this is honored when\n"
"       printing UTM coordinates:\n"
"\n"
"          echo -1 3 | GeoConvert -u         => 31S 500000 9889470\n"
"          echo -1 3 | GeoConvert -u -z 31   => 31S 500000 9889470\n"
"          echo -1 3 | GeoConvert -u -z 31S  => 31S 500000 9889470\n"
"          echo -1 3 | GeoConvert -u -z 31N  => 31N 500000 -110530\n"
"\n"
"       NOTE: the letter in the zone specification for UTM is a hemisphere\n"
"       designator N or S and not an MGRS latitude band letter.  Convert the\n"
"       MGRS latitude band letter to a hemisphere as follows: replace C thru M\n"
"       by S; replace N thru X by N.\n"
"\n"
"QUOTING\n"
"       Unfortunately the characters ' and \" have special meanings in many\n"
"       shells and have to be entered with care.  However note (1) that the\n"
"       trailing designator is optional and that (2) you can use colons as a\n"
"       separator character.  Thus 10d20' can be entered as 10d20 or 10:20 and\n"
"       10d20'30\" can be entered as 10:20:30.\n"
"\n"
"       Unix shells (sh, bash, tsch)\n"
"           The characters ' and \" can be quoted by preceding them with a \\\n"
"           (backslash); or you can quote a ' with a pair of \"s.  The two\n"
"           alternatives are illustrated by\n"
"\n"
"              echo 10d20\\'30\\\" \"20d30'40\" | GeoConvert -d -p -1\n"
"              => 10d20'30\"N 020d30'40\"E\n"
"\n"
"           Quoting of command line arguments is similar\n"
"\n"
"              GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n"
"              => 10d20'30\"N 020d30'40\"E\n"
"\n"
"       Windows command shell (cmd)\n"
"           The ' character needs no quoting and the \" character can be quoted\n"
"           by a ^.  (This quoting is usually unnecessary because the trailing\n"
"           designator can be omitted.)  Thus\n"
"\n"
"              echo 10d20'30^\" 20d30'40 | GeoConvert -d -p -1\n"
"              => 10d20'30\"N 020d30'40\"E\n"
"\n"
"           Use \\ to quote the \" character in a command line argument\n"
"\n"
"              GeoConvert -d -p -1 --input-string \"10d20'30\\\" 20d30'40\"\n"
"              => 10d20'30\"N 020d30'40\"E\n"
"\n"
"       Input from a file\n"
"           No quoting need be done if the input from a file.  Thus each line\n"
"           of the file \"input.txt\" should just contain the plain coordinates.\n"
"\n"
"             GeoConvert -d -p -1 < input.txt\n"
"\n"
"EXAMPLES\n"
"          echo 38SMB4488 | GeoConvert         => 33.33424 44.40363\n"
"          echo 38SMB4488 | GeoConvert -: -p 1 => 33:20:03.25N 044:2413.06E\n"
"          echo 38SMB4488 | GeoConvert -u      => 38N 444500 3688500\n"
"          echo E44d24 N33d20 | GeoConvert -m -p -3 => 38SMB4488\n"
"\n"
"ERRORS\n"
"       An illegal line of input will print an error message to standard output\n"
"       beginning with \"ERROR:\" and causes GeoConvert to return an exit code of\n"
"       1.  However, an error does not cause GeoConvert to terminate; following\n"
"       lines will be converted.\n"
"\n"
"ABBREVIATIONS\n"
"       UTM Universal Transverse Mercator,\n"
"           <http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system>.\n"
"\n"
"       UPS Universal Polar Stereographic,\n"
"           <http://en.wikipedia.org/wiki/Universal_Polar_Stereographic>.\n"
"\n"
"       MGRS\n"
"           Military Grid Reference System,\n"
"           <http://en.wikipedia.org/wiki/Military_grid_reference_system>.\n"
"\n"
"       WGS84\n"
"           World Geodetic System 1984, <http://en.wikipedia.org/wiki/WGS84>.\n"
"\n"
"SEE ALSO\n"
"       The algorithms for the transverse Mercator projection are described in\n"
"       C. F. F. Karney, Transverse Mercator with an accuracy of a few\n"
"       nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI\n"
"       http://dx.doi.org/10.1007/s00190-011-0445-3\n"
"       <http://dx.doi.org/10.1007/s00190-011-0445-3>; preprint\n"
"       <http://arxiv.org/abs/1002.1417>.\n"
"\n"
"AUTHOR\n"
"       GeoConvert was written by Charles Karney.\n"
"\n"
"HISTORY\n"
"       GeoConvert was added to GeographicLib, <http://geographiclib.sf.net>,\n"
"       in 2009-01.\n"
;
  return retval;
}
