From owner-p4-projects@FreeBSD.ORG Fri May 7 11:10:53 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B5D751065676; Fri, 7 May 2010 11:10:52 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A6B2106566B for ; Fri, 7 May 2010 11:10:52 +0000 (UTC) (envelope-from gcooper@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 674B58FC0C for ; Fri, 7 May 2010 11:10:52 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o47BAqfu088168 for ; Fri, 7 May 2010 11:10:52 GMT (envelope-from gcooper@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o47BAqeL088166 for perforce@freebsd.org; Fri, 7 May 2010 11:10:52 GMT (envelope-from gcooper@FreeBSD.org) Date: Fri, 7 May 2010 11:10:52 GMT Message-Id: <201005071110.o47BAqeL088166@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 Precedence: bulk Cc: Subject: PERFORCE change 177894 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 May 2010 11:10:53 -0000 http://p4web.freebsd.org/@@177894?ac=10 Change 177894 by gcooper@gcooper-bayonetta on 2010/05/07 11:09:54 1. Dump lib; it shouldn't be in my workspace anymore. 2. Properly shuffle around header includes. 3. Dump sysexits. 4. Dump some local changes that would complicate libpkg install splitting at this point in time. Affected files ... .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/add/main.c#9 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/main.c#4 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/delete/main.c#4 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/info/main.c#4 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/Makefile#4 delete .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/file.c#14 delete .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/lib.h#6 delete .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/pen.c#9 delete .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/url.c#5 delete .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/updating/main.c#4 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/version/main.c#4 edit .. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/version/perform.c#8 edit Differences ... ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/add/main.c#9 (text+ko) ==== ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/main.c#4 (text+ko) ==== @@ -12,8 +12,9 @@ #include __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/create/main.c,v 1.48 2010/04/23 11:07:43 flz Exp $"); +#include #include -#include +#include #include #include "create.h" ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/delete/main.c#4 (text+ko) ==== @@ -24,8 +24,9 @@ #include #include +#include #include -#include +#include #include #include "delete.h" ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/info/main.c#4 (text+ko) ==== @@ -22,8 +22,9 @@ #include __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/info/main.c,v 1.56 2010/04/23 11:07:43 flz Exp $"); +#include #include -#include +#include #include #include "info.h" ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/updating/main.c#4 (text+ko) ==== @@ -10,14 +10,14 @@ #include __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/updating/main.c,v 1.6 2010/04/23 11:07:43 flz Exp $"); - #include #include +#include #include #include +#include +#include #include -#include -#include #include #include "pathnames.h" @@ -76,6 +76,7 @@ int dflag = 0; /* -d option set */ /* If pflag = 0 UPDATING will be checked for all installed ports. */ int pflag = 0; + int serrno = 0; size_t n; /* Offset to create path */ @@ -114,11 +115,9 @@ if (dflag == 1) { linelength = strlen(date); if (linelength != 8) - exit(EX_DATAERR); - if (strspn(date, "0123456789") != 8) { - fprintf(stderr, "unknown date format: %s\n", date); - exit(EX_DATAERR); - } + errx(EXIT_FAILURE, "invalid date length"); + if (strspn(date, "0123456789") != 8) + errx(EXIT_FAILURE, "unknown date format: %s", date); } /* Save the list of passed portnames. */ @@ -193,10 +192,9 @@ } } - if (ferror(fd)) { - fprintf(stderr, "error reading input\n"); - exit(EX_IOERR); - } + if (ferror(fd)) + err(EXIT_FAILURE, + "error reading input"); (void)fclose(fd); } @@ -207,21 +205,14 @@ /* Fetch UPDATING file if needed and open file */ if (isURL(updatingfile)) { - if ((fd = fetchGetURL(updatingfile, "")) == NULL) { - fprintf(stderr, "Error: Unable to get %s: %s\n", - updatingfile, fetchLastErrString); - exit(EX_UNAVAILABLE); - } - } - else { - fd = fopen(updatingfile, "r"); - } - if (fd == NULL) { - fprintf(stderr, "can't open %s: %s\n", - updatingfile, strerror(errno)); - exit(EX_UNAVAILABLE); + if ((fd = fetchGetURL(updatingfile, "")) == NULL) + err(EXIT_FAILURE, "Error: Unable to get %s: %s", + updatingfile, fetchLastErrString); + } else { + if ((fd = fopen(updatingfile, "r")) == NULL) + err(EXIT_FAILURE, "can't open %s: %s", + updatingfile, strerror(errno)); } - /* Parse opened UPDATING file. */ while (fgets(updatingline, maxcharperline, fd) != NULL) { /* No entry is found so far */ @@ -264,13 +255,11 @@ dateline = strdup(updatingline); } - if (ferror(fd)) { - fprintf(stderr, "error reading input\n"); - exit(EX_IOERR); - } + serrno = errno; + if (ferror(fd)) + warnx("error reading input: %s", strerror(errno)); (void)fclose(fd); - - exit(EX_OK); + exit(serrno == 0 ? 0 : 1); } int @@ -278,7 +267,7 @@ { fprintf(stderr, "usage: pkg_updating [-h] [-d YYYYMMDD] [-f file] [portname ...]\n"); - exit(EX_USAGE); + exit(1); } void ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/version/main.c#4 (text+ko) ==== @@ -22,8 +22,9 @@ __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/version/main.c,v 1.11 2010/04/23 11:07:43 flz Exp $"); +#include +#include #include -#include #include #include "version.h" ==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/version/perform.c#8 (text+ko) ==== @@ -21,12 +21,15 @@ #include __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/version/perform.c,v 1.19 2010/04/23 11:07:43 flz Exp $"); -#include -#include "version.h" +#include +#include #include #include #include +#include +#include "version.h" + FILE *IndexFile; char IndexPath[PATH_MAX] = ""; struct index_head Index = SLIST_HEAD_INITIALIZER(Index); @@ -56,12 +59,10 @@ struct utsname u; if (uname(&u) == -1) { - warn("%s.%s: failed to determine uname information", progname, - __func__); + warn("%s: failed to determine uname information", __func__); return 1; } else if ((rel_major_ver = (int) strtol(u.release, NULL, 10)) <= 0) { - warnx("%s.%s: bad release version specified: %s", progname, __func__, - u.release); + warnx("%s: bad release version specified: %s", __func__, u.release); return 1; } @@ -85,10 +86,10 @@ pat[1] = NULL; MatchType = RegexExtended ? MATCH_EREGEX : MATCH_REGEX; patterns = pat; - } else { + } else { MatchType = MATCH_ALL; patterns = NULL; - } + } if (LookUpOrigin != NULL) pkgs = matchbyorigin(LookUpOrigin, &err_cnt);