3d63ea05cb8474d8036d3588cf8299306a994b8cas * CDDL HEADER START
3d63ea05cb8474d8036d3588cf8299306a994b8cas * The contents of this file are subject to the terms of the
3d63ea05cb8474d8036d3588cf8299306a994b8cas * Common Development and Distribution License (the "License").
3d63ea05cb8474d8036d3588cf8299306a994b8cas * You may not use this file except in compliance with the License.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3d63ea05cb8474d8036d3588cf8299306a994b8cas * See the License for the specific language governing permissions
3d63ea05cb8474d8036d3588cf8299306a994b8cas * and limitations under the License.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * When distributing Covered Code, include this CDDL HEADER in each
3d63ea05cb8474d8036d3588cf8299306a994b8cas * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * If applicable, add the following below this CDDL HEADER, with the
3d63ea05cb8474d8036d3588cf8299306a994b8cas * fields enclosed by brackets "[]" replaced with your own identifying
3d63ea05cb8474d8036d3588cf8299306a994b8cas * information: Portions Copyright [yyyy] [name of copyright owner]
3d63ea05cb8474d8036d3588cf8299306a994b8cas * CDDL HEADER END
3d63ea05cb8474d8036d3588cf8299306a994b8cas * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * Use is subject to license terms.
3d63ea05cb8474d8036d3588cf8299306a994b8cas/* defaults - C locale values for yesstr, nostr, yesexpr (LC_MESSAGES) */
3d63ea05cb8474d8036d3588cf8299306a994b8cas/* variables used by getresponse functions */
3d63ea05cb8474d8036d3588cf8299306a994b8cas/* for regcomp()/regexec() yesexpr and noexpr */
3d63ea05cb8474d8036d3588cf8299306a994b8cas * This function compiles a regular expression that is used to match an
3d63ea05cb8474d8036d3588cf8299306a994b8cas * affirmative response from the user, and also assigns the strings used
3d63ea05cb8474d8036d3588cf8299306a994b8cas * in the prompts that request affirmative or negative responses. The
3d63ea05cb8474d8036d3588cf8299306a994b8cas * locale's values for YESEXPR, NOEXPR, YESSTR and NOSTR are used.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * If there are any problems using the locale's YESEXPR, NOEXPR, YESSTR or NOSTR
3d63ea05cb8474d8036d3588cf8299306a994b8cas * values, default values of YESEXPR, YESSTR and NOSTR will be used
3d63ea05cb8474d8036d3588cf8299306a994b8cas * as a fallback. The default values are the same as the C locale values.
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* get yes expression and strings for yes/no prompts */
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (-1);
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* if problem with locale strings, use default values */
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* Compile the yes and no expressions */
3d63ea05cb8474d8036d3588cf8299306a994b8cas while (regcomp(&preg_yes, yesexpr, REG_EXTENDED | REG_NOSUB) != 0 ||
3d63ea05cb8474d8036d3588cf8299306a994b8cas regcomp(&preg_no, noexpr, REG_EXTENDED | REG_NOSUB) != 0) {
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* The fallback yesexpr failed, so exit */
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (-1);
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* The locale's yesexpr or noexpr failed so use fallback */
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (0);
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* Get user's answer */
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* Both Expressions Match (reg2 conservative) */
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (0);
3d63ea05cb8474d8036d3588cf8299306a994b8cas /* Match */
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (1);
3d63ea05cb8474d8036d3588cf8299306a994b8cas return (0);
3d63ea05cb8474d8036d3588cf8299306a994b8cas * yes_check() returns 1 if the input string is matched by yesexpr and is
3d63ea05cb8474d8036d3588cf8299306a994b8cas * not matched by noexpr; otherwise yes_check() returns 0.
3d63ea05cb8474d8036d3588cf8299306a994b8cas * no_check() returns 1 if the input string is matched by noexpr and is
3d63ea05cb8474d8036d3588cf8299306a994b8cas * not matched by yesexpr; otherwise no_check() returns 0.