int usage(int retval, bool brief) {
  if (brief)
    ( retval ? std::cerr : std::cout ) << "Usage:\n"
"    CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter\n"
"    commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
"    --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
"    outfile ]\n"
"\n"
"For full documentation type:\n"
"    CartConvert --help\n"
"or visit:\n"
"    http://geographiclib.sf.net/html/CartConvert.1.html\n";
  else
    ( retval ? std::cerr : std::cout ) << "Man page:\n"
"NAME\n"
"       CartConvert -- convert geodetic coordinates to geocentric or local\n"
"       cartesian\n"
"\n"
"SYNOPSIS\n"
"       CartConvert [ -r ] [ -l lat0 lon0 h0 ] [ -e a f ] [ --comment-delimiter\n"
"       commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
"       --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
"       outfile ]\n"
"\n"
"DESCRIPTION\n"
"       Convert geodetic coordinates to either geocentric or local cartesian\n"
"       coordinates.  Geocentric coordinates have the origin at the center of\n"
"       the earth, with the z axis going thru the north pole, and the x axis\n"
"       thru latitude = 0, longitude = 0.  By default, the conversion is to\n"
"       geocentric coordinates.  Specifying -l lat0 lon0 h0 causes a local\n"
"       coordinate system to be used with the origin at latitude = lat0,\n"
"       longitude = lon0, height = h0, z normal to the ellipsoid and y due\n"
"       north.\n"
"\n"
"       Geodetic coordinates are provided on standard input as a set of lines\n"
"       containing (blank separated) latitude, longitude (decimal degrees or\n"
"       degrees, minutes and seconds), and height above the ellipsoid (meters).\n"
"       For each set of geodetic coordinates, the corresponding cartesian\n"
"       coordinates x, y, z (meters) are printed on standard output.\n"
"\n"
"OPTIONS\n"
"       -r  perform the reverse projection.  x, y, z are given on standard\n"
"           input and each line of standard output gives latitude, longitude,\n"
"           height.\n"
"\n"
"       -e  specify the ellipsoid via a f; the equatorial radius is a and the\n"
"           flattening is 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.  (Also, if f > 1, the flattening is set to 1/f.)  By\n"
"           default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n"
"           1/298.257223563.\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"
"EXAMPLES\n"
"          echo 33.3 44.4 6000 | CartConvert\n"
"          => 3816209.60 3737108.55 3485109.57\n"
"          echo 33.3 44.4 6000 | CartConvert -l 33 44 20\n"
"          => 37288.97 33374.29 5783.64\n"
"          echo 30000 30000 0 | CartConvert -r\n"
"          => 6.483 45 -6335709.73\n"
"\n"
"ERRORS\n"
"       An illegal line of input will print an error message to standard output\n"
"       beginning with \"ERROR:\" and causes CartConvert to return an exit code\n"
"       of 1.  However, an error does not cause CartConvert to terminate;\n"
"       following lines will be converted.\n"
"\n"
"SEE ALSO\n"
"       The algorithm for converting geocentric to geodetic coordinates is\n"
"       given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of\n"
"       revolution, Feb. 2011; preprint <http://arxiv.org/abs/1102.1215>.\n"
"\n"
"AUTHOR\n"
"       CartConvert was written by Charles Karney.\n"
"\n"
"HISTORY\n"
"       CartConvert was added to GeographicLib, <http://geographiclib.sf.net>,\n"
"       in 2009-02.  Prior to 2009-03 it was called ECEFConvert.\n"
;
  return retval;
}
