///
///  @file    _option_sys.c
///
///  @brief   Auxiliary file for option_sys.c, containing help message.
///
///           This file defines data that is statically stored, rather than
///           just being declared, and is intended to be used by only one
///           source file, through use of the #include directive. This is why
///           it is created in the include/ directory, with a file type of
///           .c, and with the same name (prefaced by a leading underscore)
///           as the file which will use it.
///
///  *** This file is automatically generated. DO NOT MODIFY. ***
///
///  @brief   External resources:
///
///  <a href="options.html">List of Command-line options</a>
///
///  @brief   Process command-line options for TECO editor.
///
///  @copyright 2019-2023 Franklin P. Johnston / Nowwith Treble Software
///
///  Permission is hereby granted, free of charge, to any person obtaining a
///  copy of this software and associated documentation files (the "Software"),
///  to deal in the Software without restriction, including without limitation
///  the rights to use, copy, modify, merge, publish, distribute, sublicense,
///  and/or sell copies of the Software, and to permit persons to whom the
///  Software is furnished to do so, subject to the following conditions:
///
///  The above copyright notice and this permission notice shall be included in
///  all copies or substantial portions of the Software.
///
///  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
///  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
///  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
///  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA-
///  BILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
///  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
///  THE SOFTWARE.
///
////////////////////////////////////////////////////////////////////////////////


///  @brief  Help text string.

static const char * const help_text[] =
{
    "Usage: teco [options] [file]...",
    "",
    "TECO (Text Editor and Corrector) is a character-oriented text",
    "editing language for reading and writing ASCII text files.",
    "",
    "Examples:",
    "",
    "  teco foo               Open 'foo' for input and output.",
    "  teco -R foo            Open 'foo' for input only.",
    "  teco foo baz           Open 'foo' for input and 'baz' for output.",
    "  teco foo -O baz        Equivalent to 'teco foo baz'",
    "  teco -E foo            Execute the file 'foo' as a TECO macro.",
    "",
    "Environment variables:",
    "",
    "  TECO_INIT              Default initialization file, executed at startup.",
    "  TECO_LIBRARY           Directory of library for TECO macros.",
    "  TECO_MEMORY            File that contains name of last file edited.",
    "  TECO_VTEDIT            Default file for initialization of display mode.",
    "",
    "Text file options:",
    "",
    "  -C, --create           Create new file if file does not exist.",
    "  -c, --nocreate         Do not create new file if file does not exist.",
    "  -F, --formfeed         Enables FF as a page delimiter.",
    "  -f, --noformfeed       Disables FF as a page delimiter.",
    "  -R, --read-only        Open file for input only.",
    "  -r, --noread-only      Open file for input and output.",
    "  --make=foo             Create new file 'foo'. Similar to TECO MAKE command.",
    "",
    "Indirect command file options:",
    "",
    "  -A, --arguments        Specify n or m,n arguments for command file.",
    "  -E, --execute=foo      Execute macro in file 'foo'.",
    "  -T, --text=foo         Store text 'foo' in edit buffer.",
    "  --mung=foo             Execute macro in file 'foo'. Similar to TECO MUNG command.",
    "",
    "Initialization options:",
    "",
    "  -I, --initialize=foo   Use initialization file 'foo' at startup.",
    "  -i, --noinitialize     Ignore TECO_INIT environment variable.",
    "  -m, --nomemory         Ignore TECO_MEMORY environment variable.",
    "",
    "Display options:",
    "",
    "  -D, --display=foo      Enable display mode, optionally using file 'foo'.",
    "  -d, --nodisplay        Disable display mode.",
    "  -S, --scroll=n         Use 'n' lines for scrolling region (implies -D).",
    "",
    "Miscellaneous options:",
    "",
    "  -n, --nodefaults       Equivalent to --noinitialize --nomemory --nodisplay.",
    "  -L, --log=foo          Saves input and output in log file 'foo'.",
    "  -X, --exit             Exit from TECO after executing all command-line options.",
    "  -H, --help             Print this help message.",
    "  --version              Print version and copyright information.",
    NULL
};

///  @enum     option_t
///  case values for command-line options.

enum option_t
{
    OPT_arguments    = 'A',
    OPT_create       = 'C',
    OPT_display      = 'D',
    OPT_execute      = 'E',
    OPT_exit         = 'X',
    OPT_formfeed     = 'F',
    OPT_help         = 'H',
    OPT_initialize   = 'I',
    OPT_log          = 'L',
    OPT_make         = '0',
    OPT_mung         = '1',
    OPT_nocreate     = 'c',
    OPT_nodefaults   = 'n',
    OPT_nodisplay    = 'd',
    OPT_noformfeed   = 'f',
    OPT_noinitialize = 'i',
    OPT_nomemory     = 'm',
    OPT_noread_only  = 'r',
    OPT_practice     = 'p',
    OPT_read_only    = 'R',
    OPT_scroll       = 'S',
    OPT_text         = 'T',
    OPT_version      = '2'
};

///  @var optstring
///  String of short options parsed by getopt_long().

static const char * const optstring = ":A:CD::E:XFHI:L:cndfimrpRS:T:";

///  @var    long_options[]
///  @brief  Table of command-line options parsed by getopt_long().

static const struct option long_options[] =
{
    { "arguments",      required_argument,  NULL, -OPT_arguments    },
    { "create",         no_argument,        NULL, -OPT_create       },
    { "display",        optional_argument,  NULL, -OPT_display      },
    { "execute",        required_argument,  NULL, -OPT_execute      },
    { "exit",           no_argument,        NULL, -OPT_exit         },
    { "formfeed",       no_argument,        NULL, -OPT_formfeed     },
    { "help",           no_argument,        NULL, -OPT_help         },
    { "initialize",     required_argument,  NULL, -OPT_initialize   },
    { "log",            required_argument,  NULL, -OPT_log          },
    { "make",           required_argument,  NULL, -OPT_make         },
    { "mung",           required_argument,  NULL, -OPT_mung         },
    { "nocreate",       no_argument,        NULL, -OPT_nocreate     },
    { "nodefaults",     no_argument,        NULL, -OPT_nodefaults   },
    { "nodisplay",      no_argument,        NULL, -OPT_nodisplay    },
    { "noformfeed",     no_argument,        NULL, -OPT_noformfeed   },
    { "noinitialize",   no_argument,        NULL, -OPT_noinitialize },
    { "nomemory",       no_argument,        NULL, -OPT_nomemory     },
    { "noread-only",    no_argument,        NULL, -OPT_noread_only  },
    { "practice",       no_argument,        NULL, -OPT_practice     },
    { "read-only",      no_argument,        NULL, -OPT_read_only    },
    { "scroll",         required_argument,  NULL, -OPT_scroll       },
    { "text",           required_argument,  NULL, -OPT_text         },
    { "version",        no_argument,        NULL, -OPT_version      },
    { NULL,             no_argument,        NULL,  0                },  // Markers for end of list
};

