/*1* *****************************************************************************2*3* SPDX-License-Identifier: BSD-2-Clause4*5* Copyright (c) 2018-2025 Gavin D. Howard and contributors.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions are met:9*10* * Redistributions of source code must retain the above copyright notice, this11* list of conditions and the following disclaimer.12*13* * Redistributions in binary form must reproduce the above copyright notice,14* this list of conditions and the following disclaimer in the documentation15* and/or other materials provided with the distribution.16*17* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"18* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE19* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE20* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE21* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR22* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF23* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS24* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN25* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)26* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE27* POSSIBILITY OF SUCH DAMAGE.28*29* *****************************************************************************30*31* Definitions for processing command-line arguments.32*33*/3435#ifndef BC_ARGS_H36#define BC_ARGS_H3738#include <status.h>39#include <opt.h>40#include <vm.h>4142/**43* Processes command-line arguments.44* @param argc How many arguments there are.45* @param argv The array of arguments.46* @param exit_exprs True if bc/dc should exit when there are expressions,47* false otherwise.48* @param scale A pointer to return the scale that the arguments set, if49* any.50* @param ibase A pointer to return the ibase that the arguments set, if51* any.52* @param obase A pointer to return the obase that the arguments set, if53* any.54*/55void56bc_args(int argc, const char* argv[], bool exit_exprs, BcBigDig* scale,57BcBigDig* ibase, BcBigDig* obase);5859#if BC_ENABLED6061#if DC_ENABLED6263/// Returns true if the banner should be quieted.64#define BC_ARGS_SHOULD_BE_QUIET (BC_IS_DC || vm->exprs.len > 1)6566#else // DC_ENABLED6768/// Returns true if the banner should be quieted.69#define BC_ARGS_SHOULD_BE_QUIET (vm->exprs.len > 1)7071#endif // DC_ENABLED7273#else // BC_ENABLED7475/// Returns true if the banner should be quieted.76#define BC_ARGS_SHOULD_BE_QUIET (BC_IS_DC)7778#endif // BC_ENABLED7980// A reference to the list of long options.81extern const BcOptLong bc_args_lopt[];8283#endif // BC_ARGS_H848586