main.c revision 62224350e5355e6834f7deb9d8a7d062a50cb7c2
080575042aba2197b425ebfd52061dea061a9aa1xy * CDDL HEADER START
080575042aba2197b425ebfd52061dea061a9aa1xy * The contents of this file are subject to the terms of the
080575042aba2197b425ebfd52061dea061a9aa1xy * Common Development and Distribution License (the "License").
080575042aba2197b425ebfd52061dea061a9aa1xy * You may not use this file except in compliance with the License.
080575042aba2197b425ebfd52061dea061a9aa1xy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d5c3073dbbd835e1e9b7dca0c6c770cf3cc20afachenlu chen - Sun Microsystems - Beijing China * or http://www.opensolaris.org/os/licensing.
080575042aba2197b425ebfd52061dea061a9aa1xy * See the License for the specific language governing permissions
080575042aba2197b425ebfd52061dea061a9aa1xy * and limitations under the License.
080575042aba2197b425ebfd52061dea061a9aa1xy * When distributing Covered Code, include this CDDL HEADER in each
080575042aba2197b425ebfd52061dea061a9aa1xy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
080575042aba2197b425ebfd52061dea061a9aa1xy * If applicable, add the following below this CDDL HEADER, with the
080575042aba2197b425ebfd52061dea061a9aa1xy * fields enclosed by brackets "[]" replaced with your own identifying
080575042aba2197b425ebfd52061dea061a9aa1xy * information: Portions Copyright [yyyy] [name of copyright owner]
080575042aba2197b425ebfd52061dea061a9aa1xy * CDDL HEADER END
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
080575042aba2197b425ebfd52061dea061a9aa1xy * Use is subject to license terms.
080575042aba2197b425ebfd52061dea061a9aa1xy/* unix system includes */
080575042aba2197b425ebfd52061dea061a9aa1xy/* initial error message buffer size */
25f2d433de915875c8393f0b0dc14aa155997ad0xy/* Local Function Prototypes */
080575042aba2197b425ebfd52061dea061a9aa1xystatic void print_version();
25f2d433de915875c8393f0b0dc14aa155997ad0xy/* holds subcommands and their definitions */
080575042aba2197b425ebfd52061dea061a9aa1xy int (*c_func)(int, char **);
080575042aba2197b425ebfd52061dea061a9aa1xy /* last one must be all NULLs */
080575042aba2197b425ebfd52061dea061a9aa1xy /* last one must be all NULLs */
080575042aba2197b425ebfd52061dea061a9aa1xy * Function: main
080575042aba2197b425ebfd52061dea061a9aa1xy * Return: 0 - subprocessing successful
080575042aba2197b425ebfd52061dea061a9aa1xy * scripts and reboot
080575042aba2197b425ebfd52061dea061a9aa1xy * [other] - subprocessing-specific failure
080575042aba2197b425ebfd52061dea061a9aa1xy /* Should be defined by cc -D */
25f2d433de915875c8393f0b0dc14aa155997ad0xy#if !defined(TEXT_DOMAIN)
080575042aba2197b425ebfd52061dea061a9aa1xy /* set the default text domain for messaging */
080575042aba2197b425ebfd52061dea061a9aa1xy /* Superficial check of the arguments. */
080575042aba2197b425ebfd52061dea061a9aa1xy return (1);
080575042aba2197b425ebfd52061dea061a9aa1xy /* first, process any arguments that can appear before the subcommand */
080575042aba2197b425ebfd52061dea061a9aa1xy switch (i) {
080575042aba2197b425ebfd52061dea061a9aa1xy return (0);
080575042aba2197b425ebfd52061dea061a9aa1xy return (0);
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* OK, hand it off to the subcommand processors */
080575042aba2197b425ebfd52061dea061a9aa1xy for (cur_cmd = 0; cmds[cur_cmd].c_name != NULL; cur_cmd++) {
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* make subcommand the first option */
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* initialize security library */
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* OK, hand it off to the subcommand processors */
25f2d433de915875c8393f0b0dc14aa155997ad0xy for (cur_cmd = 0; cert_cmds[cur_cmd].c_name != NULL; cur_cmd++) {
080575042aba2197b425ebfd52061dea061a9aa1xy /* make subcommand the first option */
080575042aba2197b425ebfd52061dea061a9aa1xy /* bad subcommand */
080575042aba2197b425ebfd52061dea061a9aa1xy return (1);
080575042aba2197b425ebfd52061dea061a9aa1xy * Name: set_verbose
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Description: Turns on verbose output
080575042aba2197b425ebfd52061dea061a9aa1xy * Scope: public
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Arguments: verbose = B_TRUE indicates verbose mode
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Returns: none
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Name: get_verbose
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Description: Returns whether or not to output verbose messages
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Scope: public
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Arguments: none
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Returns: B_TRUE - verbose messages should be output
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Name: log_pkgerr
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Description: Outputs pkgerr messages to logging facility.
da14cebe459d3275048785f25bd869cb09b5307fEric Cheng * Scope: public
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Arguments: type - the severity of the message
25f2d433de915875c8393f0b0dc14aa155997ad0xy * err - error stack to dump to facility
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Returns: none
080575042aba2197b425ebfd52061dea061a9aa1xy * Name: print_Version
080575042aba2197b425ebfd52061dea061a9aa1xy * Desc: Prints Version of packaging tools
080575042aba2197b425ebfd52061dea061a9aa1xy * Arguments: none
080575042aba2197b425ebfd52061dea061a9aa1xy * Returns: none
25f2d433de915875c8393f0b0dc14aa155997ad0xystatic void
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* ignore any and all arguments, print version only */
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Outputs the usage string.
47b7744cbea59975a6b583125b7ed1ff2ac45313yy * Return:1
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Side effects: none
25f2d433de915875c8393f0b0dc14aa155997ad0xy return (1);
25f2d433de915875c8393f0b0dc14aa155997ad0xy * get_dbstatus
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Return 'text' as the db status.
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Use the command line to determine if there is an alternate root.
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Return: 0 on success, nonzero on failure
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Side effects: none
25f2d433de915875c8393f0b0dc14aa155997ad0xy /* Either accept 1 argument or 3 arguments where the second is -R */
25f2d433de915875c8393f0b0dc14aa155997ad0xy return (usage());
080575042aba2197b425ebfd52061dea061a9aa1xy return (0);
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Use the command line to determine if there is an alternate root.
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Return: 0 on success, nonzero on failure
25f2d433de915875c8393f0b0dc14aa155997ad0xy * Flush the pkgserv's log.
080575042aba2197b425ebfd52061dea061a9aa1xy switch (c) {
080575042aba2197b425ebfd52061dea061a9aa1xy return (usage());
25f2d433de915875c8393f0b0dc14aa155997ad0xy return (0);
080575042aba2197b425ebfd52061dea061a9aa1xy /* Flush the log file */
080575042aba2197b425ebfd52061dea061a9aa1xy return (0);
080575042aba2197b425ebfd52061dea061a9aa1xy return (1);