int usage(int retval, bool brief) {
  if (brief)
    ( retval ? std::cerr : std::cout ) << "Usage:\n"
"    RhumbSolve [ -i | -L lat1 lon1 azi12 ] [ -e a f ] [ -d | -: ] [ -w ] [\n"
"    -p prec ] [ -s ] [ --comment-delimiter commentdelim ] [ --version | -h\n"
"    | --help ] [ --input-file infile | --input-string instring ] [\n"
"    --line-separator linesep ] [ --output-file outfile ]\n"
"\n"
"For full documentation type:\n"
"    RhumbSolve --help\n"
"or visit:\n"
"    https://geographiclib.sourceforge.io/1.51/RhumbSolve.1.html\n";
  else
    ( retval ? std::cerr : std::cout ) << "Man page:\n"
"NAME\n"
"       RhumbSolve -- perform rhumb line calculations\n"
"\n"
"SYNOPSIS\n"
"       RhumbSolve [ -i | -L lat1 lon1 azi12 ] [ -e a f ] [ -d | -: ] [ -w ] [\n"
"       -p prec ] [ -s ] [ --comment-delimiter commentdelim ] [ --version | -h\n"
"       | --help ] [ --input-file infile | --input-string instring ] [\n"
"       --line-separator linesep ] [ --output-file outfile ]\n"
"\n"
"DESCRIPTION\n"
"       The path with constant heading between two points on the ellipsoid at\n"
"       (lat1, lon1) and (lat2, lon2) is called the rhumb line or loxodrome.\n"
"       Its length is s12 and the rhumb line has a forward azimuth azi12 along\n"
"       its length.  Also computed is S12 is the area between the rhumb line\n"
"       from point 1 to point 2 and the equator; i.e., it is the area, measured\n"
"       counter-clockwise, of the geodesic quadrilateral with corners\n"
"       (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2).  A point at a pole is\n"
"       treated as a point a tiny distance away from the pole on the given line\n"
"       of longitude.  The longitude becomes indeterminate when a rhumb line\n"
"       passes through a pole, and RhumbSolve reports NaNs for the longitude\n"
"       and the area in this case.\n"
"\n"
"       NOTE: the rhumb line is not the shortest path between two points; that\n"
"       is the geodesic and it is calculated by GeodSolve(1).\n"
"\n"
"       RhumbSolve operates in one of three modes:\n"
"\n"
"       1.  By default, RhumbSolve accepts lines on the standard input\n"
"           containing lat1 lon1 azi12 s12 and prints lat2 lon2 S12 on standard\n"
"           output.  This is the direct calculation.\n"
"\n"
"       2.  With the -i command line argument, RhumbSolve performs the inverse\n"
"           calculation.  It reads lines containing lat1 lon1 lat2 lon2 and\n"
"           prints the values of azi12 s12 S12 for the corresponding shortest\n"
"           rhumb lines.  If the end points are on opposite meridians, there\n"
"           are two shortest rhumb lines and the east-going one is chosen.\n"
"\n"
"       3.  Command line arguments -L lat1 lon1 azi12 specify a rhumb line.\n"
"           RhumbSolve then accepts a sequence of s12 values (one per line) on\n"
"           standard input and prints lat2 lon2 S12 for each.  This generates a\n"
"           sequence of points on a rhumb line.\n"
"\n"
"OPTIONS\n"
"       -i  perform an inverse calculation (see 2 above).\n"
"\n"
"       -L lat1 lon1 azi12\n"
"           line mode (see 3 above); generate a sequence of points along the\n"
"           rhumb line specified by lat1 lon1 azi12.  The -w flag can be used\n"
"           to swap the default order of the 2 geographic coordinates, provided\n"
"           that it appears before -L.  (-l is an alternative, deprecated,\n"
"           spelling of this flag.)\n"
"\n"
"       -e a f\n"
"           specify the ellipsoid via the equatorial radius, a and the\n"
"           flattening, f.  Setting f = 0 results in a sphere.  Specify f < 0\n"
"           for a prolate ellipsoid.  A simple fraction, e.g., 1/297, is\n"
"           allowed for f.  By default, the WGS84 ellipsoid is used, a =\n"
"           6378137 m, f = 1/298.257223563.\n"
"\n"
"       -d  output angles as degrees, minutes, seconds instead of decimal\n"
"           degrees.\n"
"\n"
"       -:  like -d, except use : as a separator instead of the d, ', and \"\n"
"           delimiters.\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"
"       -p prec\n"
"           set the output precision to prec (default 3); prec is the precision\n"
"           relative to 1 m.  See \"PRECISION\".\n"
"\n"
"       -s  By default, the rhumb line calculations are carried out exactly in\n"
"           terms of elliptic integrals.  This includes the use of the addition\n"
"           theorem for elliptic integrals to compute the divided difference of\n"
"           the isometric and rectifying latitudes.  If -s is supplied this\n"
"           divided difference is computed using Krueger series for the\n"
"           transverse Mercator projection which is only accurate for |f| <\n"
"           0.01.  See \"ACCURACY\".\n"
"\n"
"       --comment-delimiter commentdelim\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 infile\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 instring\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 linesep\n"
"           set the line separator character to linesep.  By default this is a\n"
"           semicolon.\n"
"\n"
"       --output-file outfile\n"
"           write output to the file outfile instead of to standard output; a\n"
"           file name of \"-\" stands for standard output.\n"
"\n"
"INPUT\n"
"       RhumbSolve measures all angles in degrees, all lengths (s12) in meters,\n"
"       and all areas (S12) in meters^2.  On input angles (latitude, longitude,\n"
"       azimuth, arc length) can be as decimal degrees or degrees, minutes,\n"
"       seconds.  For example, \"40d30\", \"40d30'\", \"40:30\", \"40.5d\", and 40.5\n"
"       are all equivalent.  By default, latitude precedes longitude for each\n"
"       point (the -w flag switches this convention); however on input either\n"
"       may be given first by appending (or prepending) N or S to the latitude\n"
"       and E or W to the longitude.  Azimuths are measured clockwise from\n"
"       north; however this may be overridden with E or W.\n"
"\n"
"       For details on the allowed formats for angles, see the \"GEOGRAPHIC\n"
"       COORDINATES\" section of GeoConvert(1).\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 lengths.  For decimal degrees, the number\n"
"       of digits after the decimal point is prec + 5.  For DMS (degree,\n"
"       minute, seconds) output, the number of digits after the decimal point\n"
"       in the seconds component is prec + 1.  The minimum value of prec is 0\n"
"       and the maximum is 10.\n"
"\n"
"ERRORS\n"
"       An illegal line of input will print an error message to standard output\n"
"       beginning with \"ERROR:\" and causes RhumbSolve to return an exit code of\n"
"       1.  However, an error does not cause RhumbSolve to terminate; following\n"
"       lines will be converted.\n"
"\n"
"ACCURACY\n"
"       The algorithm used by RhumbSolve uses exact formulas for converting\n"
"       between the latitude, rectifying latitude (mu), and isometric latitude\n"
"       (psi).  These formulas are accurate for any value of the flattening.\n"
"       The computation of rhumb lines involves the ratio (psi1 - psi2) / (mu1\n"
"       - mu2) and this is subject to large round-off errors if lat1 is close\n"
"       to lat2.  So this ratio is computed using divided differences using one\n"
"       of two methods: by default, this uses the addition theorem for elliptic\n"
"       integrals (accurate for all values of f); however, with the -s options,\n"
"       it is computed using the series expansions used by\n"
"       TransverseMercatorProj(1) for the conversions between rectifying and\n"
"       conformal latitudes (accurate for |f| < 0.01).  For the WGS84\n"
"       ellipsoid, the error is about 10 nanometers using either method.\n"
"\n"
"EXAMPLES\n"
"       Route from JFK Airport to Singapore Changi Airport:\n"
"\n"
"          echo 40:38:23N 073:46:44W 01:21:33N 103:59:22E |\n"
"          RhumbSolve -i -: -p 0\n"
"\n"
"          103:34:58.2 18523563\n"
"\n"
"       N.B. This is not the route typically taken by aircraft because it's\n"
"       considerably longer than the geodesic given by GeodSolve(1).\n"
"\n"
"       Waypoints on the route at intervals of 2000km:\n"
"\n"
"          for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |\n"
"          RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0\n"
"\n"
"          40:38:23.0N 073:46:44.0W 0\n"
"          36:24:30.3N 051:28:26.4W 9817078307821\n"
"          32:10:26.8N 030:20:57.3W 18224745682005\n"
"          27:56:13.2N 010:10:54.2W 25358020327741\n"
"          23:41:50.1N 009:12:45.5E 31321269267102\n"
"          19:27:18.7N 027:59:22.1E 36195163180159\n"
"          15:12:40.2N 046:17:01.1E 40041499143669\n"
"          10:57:55.9N 064:12:52.8E 42906570007050\n"
"          06:43:07.3N 081:53:28.8E 44823504180200\n"
"          02:28:16.2N 099:24:54.5E 45813843358737\n"
"          01:46:36.0S 116:52:59.7E 45888525219677\n"
"\n"
"SEE ALSO\n"
"       GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1).\n"
"\n"
"       An online version of this utility is availbable at\n"
"       <https://geographiclib.sourceforge.io/cgi-bin/RhumbSolve>.\n"
"\n"
"       The Wikipedia page, Rhumb line,\n"
"       <https://en.wikipedia.org/wiki/Rhumb_line>.\n"
"\n"
"AUTHOR\n"
"       RhumbSolve was written by Charles Karney.\n"
"\n"
"HISTORY\n"
"       RhumbSolve was added to GeographicLib,\n"
"       <https://geographiclib.sourceforge.io>, in version 1.37.\n"
;
  return retval;
}
