/*
 * *****************************************************************************
 *
 * SPDX-License-Identifier: BSD-2-Clause
 *
 * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * * Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 *
 * * Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * *****************************************************************************
 *
 * The dc help text.
 *
 */

usage: %s [options] [file...]

dc is a reverse-polish notation command-line calculator which supports unlimited
precision arithmetic. For details, use `man %s`.

This dc is (mostly) compatible with the FreeBSD dc and the GNU dc. See the
FreeBSD man page (https://www.unix.com/man-page/FreeBSD/1/dc/) and the GNU dc
manual (https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html) for
details.

This dc has a few differences from the two above:

  1) When printing a byte stream (command "P"), this bc follows what the FreeBSD
     dc does.
  2) This dc implements the GNU extensions for divmod ("~") and modular
     exponentiation ("|").
  3) This dc implements all FreeBSD extensions, except for "J" and "M".
  4) This dc does not implement the run command ("!"), for security reasons.
  5) Like the FreeBSD dc, this dc supports extended registers. However, they are
     implemented differently. When it encounters whitespace where a register
     should be, it skips the whitespace. If the character following is not
     a lowercase letter, an error is issued. Otherwise, the register name is
     parsed by the following regex:

       [a-z][a-z0-9_]*

     This generally means that register names will be surrounded by whitespace.

     Examples:

       l idx s temp L index S temp2 < do_thing

     Also note that, unlike the FreeBSD dc, extended registers are not even
     parsed unless the "-x" option is given. Instead, the space after a command
     that requires a register name is taken as the register name.

Options:

  -e  expr  --expression=expr

      Run "expr" and quit. If multiple expressions or files (see below) are
      given, they are all run. After running, dc will exit.

  -f  file  --file=file

      Run the dc code in "file" and exit. See above.

  -h  --help

      Print this usage message and exit.

  -i  --interactive

      Put dc into interactive mode. See the man page for more details.

  -P  --no-prompt

      Disable the prompt in interactive mode.

  -V  --version

      Print version and copyright and exit.

  -x  --extended-register

      Enable extended register mode.
