From owner-p4-projects@FreeBSD.ORG Fri Dec 28 01:01:18 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CD00816A419; Fri, 28 Dec 2007 01:01:17 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 177DA16A418 for ; Fri, 28 Dec 2007 01:01:17 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 1959413C46B for ; Fri, 28 Dec 2007 01:01:17 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBS11GAJ000691 for ; Fri, 28 Dec 2007 01:01:16 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBS11GeK000679 for perforce@freebsd.org; Fri, 28 Dec 2007 01:01:16 GMT (envelope-from gcooper@FreeBSD.org) Date: Fri, 28 Dec 2007 01:01:16 GMT Message-Id: <200712280101.lBS11GeK000679@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gcooper@FreeBSD.org using -f From: Garrett Cooper To: Perforce Change Reviews Cc: Subject: PERFORCE change 131828 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Dec 2007 01:01:18 -0000 http://perforce.freebsd.org/chv.cgi?CH=131828 Change 131828 by gcooper@shiina-ibook on 2007/12/28 01:00:49 1. a. [from getopt(3)]: Var is called optind, not optidx. b. Change other variable to be consistent. 2. Yank out init_action(..) and put into pkg_action.c Affected files ... .. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/main.c#3 edit Differences ... ==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/main.c#3 (text+ko) ==== @@ -53,12 +53,12 @@ char opt_char; - int old_optidx; - int optional_opts_idx; + int old_optind; + int optional_opts_ind; int i; /** Preset the initial counter variables to 0. **/ - old_optidx = optional_opts_idx = 0; + old_optind = optional_opts_ind = 0; /** Don't error out on unknown / non-globally applied flags, yet.. **/ opterr = 0; @@ -119,12 +119,12 @@ * Copy down all char* pointers to optional_opt_str_p to parse * later on [in pkg_action_arg_parser->parse_args(..)].. */ - for (i = old_optidx; i < optidx; i++) { - (optional_opt_str_p+optional_opts_idx) = (argv+i); - optional_opts_idx++; + for (i = old_optind; i < optind; i++) { + (optional_opt_str_p+optional_opts_ind) = (argv+i); + optional_opts_ind++; } - old_optidx = optidx; + old_optind = optind; } /** End global args parse **/ @@ -139,8 +139,8 @@ * If arguments usage was invalid, print usage message for specific command * and exit.. */ - if (0 < parsers[action_type]->parse_args(optional_opts_idx+1, optional_opt_str_p)) { - action->print_use(); + if (0 < parsers[action_type]->parse_args(optional_opts_ind+1, optional_opt_str_p)) { + parsers[action_type]->print_use(); exit(1); } @@ -163,42 +163,3 @@ return action_result; } - -/** - * @brief Initialize the appropriate action as per the action_type provided. - * @return Object for respective constructor. - * @return NULL on bad action_type. - */ -pkg_action -init_action(int action_type, freebsd_pkg *fpkg) -{ - - switch (action_type) { - - case add: - return pkg_action_add_new(fpkg); - case clean: - return pkg_action_clean_new(fpkg); - case check: - return pkg_action_check_new(fpkg); - case create: - return pkg_action_create_new(fpkg); - case delete: - return pkg_action_delete_new(fpkg); - case info: - return pkg_action_info_new(fpkg); - case null: - return pkg_action_new(fpkg); - case search: - return pkg_action_search_new(fpkg); - case sign: - return pkg_action_sign_new(fpkg); - case update: - return pkg_action_update_new(fpkg); - case version: - return pkg_action_version_new(fpkg); - - } - - return NULL; -}