Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 May 2010 11:10:52 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 177894 for review
Message-ID:  <201005071110.o47BAqeL088166@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/create/main.c,v 1.48 2010/04/23 11:07:43 flz Exp $");
 
+#include <err.h>
 #include <getopt.h>
-#include <err.h>
+#include <libgen.h>
 
 #include <pkg.h>
 #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 <sys/types.h>
 #include <sys/stat.h>
+#include <err.h>
 #include <getopt.h>
-#include <err.h>
+#include <libgen.h>
 
 #include <pkg.h>
 #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 <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/info/main.c,v 1.56 2010/04/23 11:07:43 flz Exp $");
 
+#include <err.h>
 #include <getopt.h>
-#include <err.h>
+#include <libgen.h>
 
 #include <pkg.h>
 #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 <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/updating/main.c,v 1.6 2010/04/23 11:07:43 flz Exp $");
 
-
 #include <sys/param.h>
 #include <stdio.h>
+#include <err.h>
 #include <errno.h>
 #include <fetch.h>
+#include <getopt.h>
+#include <libgen.h>
 #include <limits.h>
-#include <sysexits.h>
-#include <getopt.h>
 
 #include <pkg.h>
 #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 <err.h>
+#include <libgen.h>
 #include <getopt.h>
-#include <err.h>
 
 #include <pkg.h>
 #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 <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/version/perform.c,v 1.19 2010/04/23 11:07:43 flz Exp $");
 
-#include <pkg.h>
-#include "version.h"
+#include <sys/param.h>
+#include <stdio.h>
 #include <err.h>
 #include <fetch.h>
 #include <signal.h>
 
+#include <pkg.h>
+#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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005071110.o47BAqeL088166>