From beat@chruetertee.ch  Sat Oct 27 15:06:51 2007
Return-Path: <beat@chruetertee.ch>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 087C316A419
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 27 Oct 2007 15:06:51 +0000 (UTC)
	(envelope-from beat@chruetertee.ch)
Received: from mail14.bluewin.ch (mail14.bluewin.ch [195.186.19.62])
	by mx1.freebsd.org (Postfix) with ESMTP id A5A9413C4A6
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 27 Oct 2007 15:06:50 +0000 (UTC)
	(envelope-from beat@chruetertee.ch)
Received: from [83.79.31.175] (83.79.31.175) by mail14.bluewin.ch (Bluewin 7.3.121)
        id 471B432300178F9C for FreeBSD-gnats-submit@freebsd.org; Sat, 27 Oct 2007 14:44:51 +0000
Received: by _HOSTNAME_ (sSMTP sendmail emulation); Sat, 27 Oct 2007 16:45:32 +0200
Message-Id: <471B432300178F9C@mail14.bluewin.ch> (added by postmaster@bluewin.ch)
Date: Sat, 27 Oct 2007 16:45:32 +0200
From: "Beat Gaetzi" <beat@chruetertee.ch>
Reply-To: Beat Gtzi <beat@chruetertee.ch>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: pkg_updating: UPDATING parser and displayer
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         117564
>Category:       bin
>Synopsis:       [patch] pkg_updating: UPDATING parser and displayer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    krion
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 27 15:10:01 UTC 2007
>Closed-Date:    Fri Jun 06 12:14:02 UTC 2008
>Last-Modified:  Fri Jun 06 12:14:02 UTC 2008
>Originator:     Beat Gtzi
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD daedalus.network.local 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Tue Oct 23 22:18:38 CEST 2007     root@daedalus.network.local:/usr/obj/usr/src/sys/GENERIC  i386


	
>Description:
This patch add another pkg_* program: pkg_updating
pkg_updating scan the installed ports and show all UPDATING entries that
affect one of the installed ports, and are relevant on the given machine.

The idea of pkg_updating is from the project idea page:
http://www.freebsd.org/projects/ideas/#p-ports-updating
	
>How-To-Repeat:
	
>Fix:

	

--- pkg_updating.patch begins here ---
diff -Naur src.orig/usr.sbin/pkg_install/Makefile src/usr.sbin/pkg_install/Makefile
--- src.orig/usr.sbin/pkg_install/Makefile	2007-06-24 21:12:55.000000000 +0200
+++ src/usr.sbin/pkg_install/Makefile	2007-10-27 15:35:17.000000000 +0200
@@ -2,7 +2,7 @@
 
 .include <bsd.own.mk>
 
-SUBDIR=	lib add create delete info ${_sign} version
+SUBDIR=	lib add create delete info ${_sign} updating version
 
 .if ${MK_OPENSSL} != "no"
 _sign=	sign
diff -Naur src.orig/usr.sbin/pkg_install/updating/Makefile src/usr.sbin/pkg_install/updating/Makefile
--- src.orig/usr.sbin/pkg_install/updating/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ src/usr.sbin/pkg_install/updating/Makefile	2007-10-27 15:26:35.000000000 +0200
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PROG=	pkg_updating
+SRCS=	main.c
+
+CFLAGS+= -I${.CURDIR}/../lib
+
+WARNS?=	6
+WFORMAT?=	1
+
+.include <bsd.prog.mk>
diff -Naur src.orig/usr.sbin/pkg_install/updating/main.c src/usr.sbin/pkg_install/updating/main.c
--- src.orig/usr.sbin/pkg_install/updating/main.c	1970-01-01 01:00:00.000000000 +0100
+++ src/usr.sbin/pkg_install/updating/main.c	2007-10-27 16:29:00.000000000 +0200
@@ -0,0 +1,240 @@
+/*-
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
+ * ----------------------------------------------------------------------------
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>						/* For MAXPATHLEN */
+
+#include <dirent.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>	
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "pathnames.h"
+
+typedef struct installedport {
+	struct installedport *next;				/* List of installed ports */
+	char name[LINE_MAX];					/* Name of the installed port */
+} INSTALLEDPORT;
+
+int usage(void);
+
+/*
+ * Parse /usr/port/UPDATING for corresponding entries. If no argument is
+ * passed to pkg_updating all entries for all installed ports are displayed.
+ * If a list of portnames is passed to pkg_updating only entries for the
+ * given portnames are displayed. Use the -d option to define that only newer
+ * entries as this date are shown.
+ */
+int
+main(int argc, char *argv[])
+{
+	/* Keyword for searching portname in UPDATING */
+	const char *affects = "AFFECTS";
+	/* Indicate a date -> end of a entry. Will fail on 2100-01-01.. */
+	const char *end = "20";
+	/* Keyword for searching origin portname of installed port */
+	const char *origin = "@comment ORIGIN:";
+	const char *pkgdbpath = LOG_DIR;		/* Location of pkgdb */
+	const char *updatingfile = UPDATING;	/* Location of UPDATING */
+
+	char *date = NULL; 						/* Passed -d argument */
+	char *dateline = NULL;					/* Saved date of an entry */
+	/* Tmp lines for parsing file */
+	char *tmpline1 = NULL;
+	char *tmpline2 = NULL;
+
+	char originline[LINE_MAX];					/* Line of +CONTENTS */
+	/* Temporary variable to create path to +CONTENTS for installed ports */
+	char tmp_file[MAXPATHLEN];
+	char updatingline[LINE_MAX];				/* Line of UPDATING */
+
+	int ch;										/* Char used by getopt */
+	int found = 0;								/* Found an entry */
+	int linelength;								/* Length of parsed line */
+	int maxcharperline = LINE_MAX;				/* Max chars per line */
+	int dflag = 0;								/* -d option set */
+	/* If pflag = 0 UPDATING will be checked for all installed ports */
+	int pflag = 0;
+
+	size_t n;									/* Offset to create path */
+
+	struct dirent *pkgdbdir;					/* pkgdb directory */
+
+	/* Needed nodes for linked list with installed ports */
+	INSTALLEDPORT *head = (INSTALLEDPORT *) NULL;
+	INSTALLEDPORT *curr = (INSTALLEDPORT *) NULL;
+
+	DIR *dir;
+	FILE *fd;
+
+	while ((ch = getopt(argc, argv, "f:p:d:")) != -1) {
+		switch (ch) {
+			case 'd':
+				dflag = 1;
+				date = optarg;
+				break;
+			case 'f':
+				updatingfile = optarg;
+				break;
+			case '?':
+			default:
+				usage();
+		}
+	}
+	argc -= optind;
+	argv += optind;
+
+	/* Check if passed date has a correct format */
+	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);
+		}
+	}
+
+	/* Save the list of passed portnames */
+	if (argc != 0) {
+		pflag = 1;
+		while (*argv) {
+			if((curr = (INSTALLEDPORT *)
+				malloc(sizeof(INSTALLEDPORT))) == NULL)
+				(void)exit(EXIT_FAILURE);
+			strlcpy (curr->name, *argv, strlen(*argv) + 1);
+			curr->next = head;
+			head = curr;
+			*argv++;
+		}
+	}
+
+	/* UPDATING will be parsed for all installed ports if no portname is passed */
+	if (pflag == 0) {
+		/* Opens /var/db/pkg and search for all installed ports */
+		if((dir = opendir(pkgdbpath)) != NULL) {
+			while ((pkgdbdir = readdir(dir)) != NULL) {
+				if (strcmp(pkgdbdir->d_name, ".") != 0 && 
+					strcmp(pkgdbdir->d_name, "..") !=0) {
+
+					/* Create path to +CONTENTS file for each installed port */
+					n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1);
+					n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n);
+					n = strlcat(tmp_file + n, pkgdbdir->d_name, sizeof(tmp_file) - n);
+					(void)strlcat(tmp_file + n, "/+CONTENTS", sizeof(tmp_file) - n);
+
+					/* Open +CONTENT file */
+					fd = fopen(tmp_file, "r");
+					if(fd == NULL) {
+						fprintf(stderr, "warning: can't open %s: %s\n",
+						tmp_file, strerror(errno));
+						continue;
+					}
+
+					/* Parses +CONTENT for ORIGIN line and 
+					   put element into linked list */
+					while(fgets(originline, maxcharperline, fd) != NULL) {
+						tmpline1 = strstr(originline, origin);
+						if( tmpline1 != NULL ) {
+							char *pname;	/* Tmp variable to store port name */
+							pname = strrchr(originline, (int)':');
+							pname++;
+							if((curr = (INSTALLEDPORT *)
+								malloc(sizeof(INSTALLEDPORT))) == NULL)
+								(void)exit(EXIT_FAILURE);
+							strlcpy (curr->name, pname, strlen(pname)+1);
+							curr->next = head;
+							head = curr;
+						}
+					}
+					
+					if(ferror(fd)) {
+						fprintf(stderr, "error reading input\n");
+						exit(EX_IOERR);
+					}
+
+					(void)fclose(fd);
+				}
+			}
+			closedir(dir);
+		} 
+	}
+
+	/* Open UPDATING file */
+	fd = fopen(updatingfile, "r");
+	if(fd == NULL) {
+		fprintf(stderr, "can't open %s: %s\n",
+		updatingfile, strerror(errno));
+		exit(EX_UNAVAILABLE);
+	}
+
+	/* Parse opened UPDATING file */
+	while(fgets(updatingline, maxcharperline, fd) != NULL) {
+		/* No entry is found so far */
+		if (found == 0) {
+			/* Search for AFFECTS line to parse the portname */
+			tmpline1 = strstr(updatingline, affects);
+
+			if( tmpline1 != NULL ) {
+				curr = head; 
+				while(curr != NULL) {
+					tmpline2 = strstr(updatingline, curr->name);	
+					if( tmpline2 != NULL )
+						break;
+					curr = curr->next;
+				}
+				if( tmpline2 != NULL ) {
+					/* If -d is set, check if entry is newer than the date */
+					if ( (dflag == 1) && (strncmp(dateline, date, 8) < 0))
+						continue;
+					printf("%s", dateline);
+					printf("%s", updatingline);
+					found = 1;
+				}
+			}
+		}
+		/* Search for the end of an entry, if not found print the line */
+		else {
+			tmpline1 = strstr(updatingline, end);
+			if( tmpline1 == NULL )
+				printf("%s", updatingline);
+			else {
+				linelength = strlen(updatingline);
+				if (linelength == 10)
+					found = 0;
+				else
+					printf("%s", updatingline);
+			}
+		}
+		/* Save the actual line, it could be a date */
+		dateline = strdup(updatingline);
+	}
+
+	if(ferror(fd)) {
+		fprintf(stderr, "error reading input\n");
+		exit(EX_IOERR);
+	}
+	(void)fclose(fd);
+
+	exit(EX_OK);
+}
+
+int
+usage(void)
+{
+	fprintf(stderr,
+		"usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n");
+	exit(EX_USAGE);
+}
diff -Naur src.orig/usr.sbin/pkg_install/updating/pathnames.h src/usr.sbin/pkg_install/updating/pathnames.h
--- src.orig/usr.sbin/pkg_install/updating/pathnames.h	1970-01-01 01:00:00.000000000 +0100
+++ src/usr.sbin/pkg_install/updating/pathnames.h	2007-10-27 16:30:11.000000000 +0200
@@ -0,0 +1,27 @@
+/*-
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
+ * ----------------------------------------------------------------------------
+ *
+ * $FreeBSD$
+ *
+ */
+
+/* Copy from ../version/version.h, shouldn't this go in lib/lib.h? */
+/* Where the ports lives by default */
+#define DEF_PORTS_DIR "/usr/ports/UPDATING"
+/* just in case we change the environment variable name */
+#define PORTSDIR  "PORTSDIR"
+/* macro to get name of directory where we put logging information */
+#define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), "/UPDATING") : DEF_PORTS_DIR)
+
+/* Where we put logging information by default, else ${PKG_DBDIR} if set */
+#define DEF_LOG_DIR	"/var/db/pkg"
+/* just in case we change the environment variable name */
+#define PKG_DBDIR	"PKG_DBDIR"
+/* macro to get name of directory where we put logging information */
+#define LOG_DIR		(getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR)
+
diff -Naur src.orig/usr.sbin/pkg_install/updating/pkg_updating.1 src/usr.sbin/pkg_install/updating/pkg_updating.1
--- src.orig/usr.sbin/pkg_install/updating/pkg_updating.1	1970-01-01 01:00:00.000000000 +0100
+++ src/usr.sbin/pkg_install/updating/pkg_updating.1	2007-10-27 15:26:49.000000000 +0200
@@ -0,0 +1,88 @@
+.\"
+.\" FreeBSD updating - Scan the installed ports and show all UPDATING entries 
+.\"	that affect one of the installed ports. Alternative a list of portnames 
+.\" could be passed to pkg_updating
+.\"
+.\" "THE BEER-WARE LICENSE" (Revision 42):
+.\" <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
+.\" can do whatever you want with this stuff. If we meet some day, and you think
+.\" this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
+.\"
+.\" $FreeBSD$
+.\"
+.Dd October 20, 2007
+.Dt PKG_UPDATING 1
+.Os
+.Sh NAME
+.Nm pkg_updating
+.Nd a utility for displaying UPDATING entries of software packages
+.Sh SYNOPSIS
+.Nm
+.Op Fl d Ar date
+.Op Fl f Ar file
+.Op Ar pkg-name ...
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+command scan the installed ports and show all UPDATING entries that affect one
+of the installed ports. Alternative a list of pkg-names could be passed.
+.Sh OPTIONS
+The following command line options are supported:
+.Bl -tag -width indent
+.It Ar pkg-name ...
+UPDATING entries for the named packages are displayed.
+.It Fl d Ar date
+Only entries newer than this date are shown. Use a YYYYMMDD date format.
+.It Fl f Ar UPDATING file
+Defines a alternative location of the UPDATING file.
+.El
+.Sh EXAMPLES
+.Bl -tag -width indent
+.Dl pkg_updating
+.Pp
+Shows all entries of all installed ports.
+.Pp
+.Dl pkg_updating -d 20070101
+.Pp
+Shows all entries of all installed ports since 2007-01-01.
+.Pp
+.Dl pkg_updating apache mysql
+.Pp
+Shows all entries for all apache and mysql ports.
+.Pp
+.Dl pkg_updating -d 20060101 apache
+.Pp
+Shows all apache entries since 2006-01-01.
+.Pp
+.Dl pkg_updating -f /tmp/UPDATING
+.Pp
+Defines that the UPDATING file is in /tmp and shows all entries of all
+installed ports
+.Pp
+.El
+.Sh ENVIRONMENT
+.Bl -tag -width PKG_DBDIR
+.It Ev PKG_DBDIR
+Specifies an alternative location for the installed package database.
+.It Ev PORTSDIR
+Location of the ports tree.
+.El
+.Sh FILES
+.Bl -tag -width /var/db/pkg -compact
+.It Pa /var/db/pkg
+Default location of the installed package database.
+.It Pa /usr/ports
+The default ports directory and default location of the UPDATING file
+.El
+.Sh SEE ALSO
+.Xr pkg_add 1 ,
+.Xr pkg_create 1 ,
+.Xr pkg_delete 1 ,
+.Xr pkg_version 1
+.Sh AUTHORS
+.An Beat Gtzi Aq beat@chruetertee.ch
+.Sh CONTRIBUTORS
+.An Martin Tournoij Aq carpetsmoker@xs4all.nl
+.Sh BUGS
+Sure to be some.
--- pkg_updating.patch ends here ---


>Release-Note:
>Audit-Trail:

From: =?ISO-8859-1?Q?Beat_G=E4tzi?= <beat@chruetertee.ch>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/117564: pkg_updating: UPDATING parser and displayer
Date: Sat, 27 Oct 2007 19:07:20 +0200

 This is a multi-part message in MIME format.
 --------------020505060006080209090802
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Make the patch more compatible to style(9):
 - Fix line legth
 - Fix multi line comments
 
 Thanks to Craig Rodrigues for point out this style violations.
 
 --------------020505060006080209090802
 Content-Type: text/plain;
  name="pkg_updating.patch"
 Content-Transfer-Encoding: 8bit
 Content-Disposition: inline;
  filename="pkg_updating.patch"
 
 diff -Naur src.orig/usr.sbin/pkg_install/Makefile src/usr.sbin/pkg_install/Makefile
 --- src.orig/usr.sbin/pkg_install/Makefile	2007-06-24 21:12:55.000000000 +0200
 +++ src/usr.sbin/pkg_install/Makefile	2007-10-27 15:35:17.000000000 +0200
 @@ -2,7 +2,7 @@
  
  .include <bsd.own.mk>
  
 -SUBDIR=	lib add create delete info ${_sign} version
 +SUBDIR=	lib add create delete info ${_sign} updating version
  
  .if ${MK_OPENSSL} != "no"
  _sign=	sign
 diff -Naur src.orig/usr.sbin/pkg_install/updating/Makefile src/usr.sbin/pkg_install/updating/Makefile
 --- src.orig/usr.sbin/pkg_install/updating/Makefile	1970-01-01 01:00:00.000000000 +0100
 +++ src/usr.sbin/pkg_install/updating/Makefile	2007-10-27 15:26:35.000000000 +0200
 @@ -0,0 +1,11 @@
 +# $FreeBSD$
 +
 +PROG=	pkg_updating
 +SRCS=	main.c
 +
 +CFLAGS+= -I${.CURDIR}/../lib
 +
 +WARNS?=	6
 +WFORMAT?=	1
 +
 +.include <bsd.prog.mk>
 diff -Naur src.orig/usr.sbin/pkg_install/updating/main.c src/usr.sbin/pkg_install/updating/main.c
 --- src.orig/usr.sbin/pkg_install/updating/main.c	1970-01-01 01:00:00.000000000 +0100
 +++ src/usr.sbin/pkg_install/updating/main.c	2007-10-27 18:49:45.000000000 +0200
 @@ -0,0 +1,248 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/param.h>						/* For MAXPATHLEN */
 +
 +#include <dirent.h>
 +#include <errno.h>
 +#include <limits.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>	
 +#include <sysexits.h>
 +#include <unistd.h>
 +
 +#include "pathnames.h"
 +
 +typedef struct installedport {
 +	struct installedport *next;				/* List of installed ports. */
 +	char name[LINE_MAX];					/* Name of the installed port. */
 +} INSTALLEDPORT;
 +
 +int usage(void);
 +
 +/*
 + * Parse /usr/port/UPDATING for corresponding entries. If no argument is
 + * passed to pkg_updating all entries for all installed ports are displayed.
 + * If a list of portnames is passed to pkg_updating only entries for the
 + * given portnames are displayed. Use the -d option to define that only newer
 + * entries as this date are shown.
 + */
 +int
 +main(int argc, char *argv[])
 +{
 +	/* Keyword for searching portname in UPDATING. */
 +	const char *affects = "AFFECTS";
 +	/* Indicate a date -> end of a entry. Will fail on 2100-01-01... */
 +	const char *end = "20";
 +	/* Keyword for searching origin portname of installed port. */
 +	const char *origin = "@comment ORIGIN:";
 +	const char *pkgdbpath = LOG_DIR;		/* Location of pkgdb */
 +	const char *updatingfile = UPDATING;	/* Location of UPDATING */
 +
 +	char *date = NULL; 						/* Passed -d argument */
 +	char *dateline = NULL;					/* Saved date of an entry */
 +	/* Tmp lines for parsing file */
 +	char *tmpline1 = NULL;
 +	char *tmpline2 = NULL;
 +
 +	char originline[LINE_MAX];					/* Line of +CONTENTS */
 +	/* Temporary variable to create path to +CONTENTS for installed ports. */
 +	char tmp_file[MAXPATHLEN];
 +	char updatingline[LINE_MAX];				/* Line of UPDATING */
 +
 +	int ch;										/* Char used by getopt */
 +	int found = 0;								/* Found an entry */
 +	int linelength;								/* Length of parsed line */
 +	int maxcharperline = LINE_MAX;				/* Max chars per line */
 +	int dflag = 0;								/* -d option set */
 +	/* If pflag = 0 UPDATING will be checked for all installed ports. */
 +	int pflag = 0;
 +
 +	size_t n;									/* Offset to create path */
 +
 +	struct dirent *pkgdbdir;					/* pkgdb directory */
 +
 +	/* Needed nodes for linked list with installed ports. */
 +	INSTALLEDPORT *head = (INSTALLEDPORT *) NULL;
 +	INSTALLEDPORT *curr = (INSTALLEDPORT *) NULL;
 +
 +	DIR *dir;
 +	FILE *fd;
 +
 +	while ((ch = getopt(argc, argv, "f:p:d:")) != -1) {
 +		switch (ch) {
 +			case 'd':
 +				dflag = 1;
 +				date = optarg;
 +				break;
 +			case 'f':
 +				updatingfile = optarg;
 +				break;
 +			case '?':
 +			default:
 +				usage();
 +		}
 +	}
 +	argc -= optind;
 +	argv += optind;
 +
 +	/* Check if passed date has a correct format. */
 +	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);
 +		}
 +	}
 +
 +	/* Save the list of passed portnames. */
 +	if (argc != 0) {
 +		pflag = 1;
 +		while (*argv) {
 +			if((curr = (INSTALLEDPORT *)
 +				malloc(sizeof(INSTALLEDPORT))) == NULL)
 +				(void)exit(EXIT_FAILURE);
 +			strlcpy (curr->name, *argv, strlen(*argv) + 1);
 +			curr->next = head;
 +			head = curr;
 +			*argv++;
 +		}
 +	}
 +
 +	/*
 +	 * UPDATING will be parsed for all installed ports
 +	 * if no portname is passed.
 +	 */
 +	if (pflag == 0) {
 +		/* Open /var/db/pkg and search for all installed ports. */
 +		if((dir = opendir(pkgdbpath)) != NULL) {
 +			while ((pkgdbdir = readdir(dir)) != NULL) {
 +				if (strcmp(pkgdbdir->d_name, ".") != 0 && 
 +					strcmp(pkgdbdir->d_name, "..") !=0) {
 +
 +					/* Create path to +CONTENTS file for each installed port */
 +					n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1);
 +					n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n);
 +					n = strlcat(tmp_file + n, pkgdbdir->d_name,
 +						sizeof(tmp_file) - n);
 +					(void)strlcat(tmp_file + n, "/+CONTENTS",
 +						sizeof(tmp_file) - n);
 +
 +					/* Open +CONTENT file */
 +					fd = fopen(tmp_file, "r");
 +					if(fd == NULL) {
 +						fprintf(stderr, "warning: can't open %s: %s\n",
 +						tmp_file, strerror(errno));
 +						continue;
 +					}
 +
 +					/*
 +					 * Parses +CONTENT for ORIGIN line and
 +					 * put element into linked list.
 +					 */
 +					while(fgets(originline, maxcharperline, fd) != NULL) {
 +						tmpline1 = strstr(originline, origin);
 +						if( tmpline1 != NULL ) {
 +							/* Tmp variable to store port name. */
 +							char *pname;
 +							pname = strrchr(originline, (int)':');
 +							pname++;
 +							if((curr = (INSTALLEDPORT *)
 +								malloc(sizeof(INSTALLEDPORT))) == NULL)
 +								(void)exit(EXIT_FAILURE);
 +							strlcpy (curr->name, pname, strlen(pname)+1);
 +							curr->next = head;
 +							head = curr;
 +						}
 +					}
 +					
 +					if(ferror(fd)) {
 +						fprintf(stderr, "error reading input\n");
 +						exit(EX_IOERR);
 +					}
 +
 +					(void)fclose(fd);
 +				}
 +			}
 +			closedir(dir);
 +		} 
 +	}
 +
 +	/* Open UPDATING file */
 +	fd = fopen(updatingfile, "r");
 +	if(fd == NULL) {
 +		fprintf(stderr, "can't open %s: %s\n",
 +		updatingfile, strerror(errno));
 +		exit(EX_UNAVAILABLE);
 +	}
 +
 +	/* Parse opened UPDATING file. */
 +	while(fgets(updatingline, maxcharperline, fd) != NULL) {
 +		/* No entry is found so far */
 +		if (found == 0) {
 +			/* Search for AFFECTS line to parse the portname. */
 +			tmpline1 = strstr(updatingline, affects);
 +
 +			if( tmpline1 != NULL ) {
 +				curr = head; 
 +				while(curr != NULL) {
 +					tmpline2 = strstr(updatingline, curr->name);
 +					if( tmpline2 != NULL )
 +						break;
 +					curr = curr->next;
 +				}
 +				if( tmpline2 != NULL ) {
 +					/* If -d is set, check if entry is newer than the date. */
 +					if ( (dflag == 1) && (strncmp(dateline, date, 8) < 0))
 +						continue;
 +					printf("%s", dateline);
 +					printf("%s", updatingline);
 +					found = 1;
 +				}
 +			}
 +		}
 +		/* Search for the end of an entry, if not found print the line. */
 +		else {
 +			tmpline1 = strstr(updatingline, end);
 +			if( tmpline1 == NULL )
 +				printf("%s", updatingline);
 +			else {
 +				linelength = strlen(updatingline);
 +				if (linelength == 10)
 +					found = 0;
 +				else
 +					printf("%s", updatingline);
 +			}
 +		}
 +		/* Save the actual line, it could be a date. */
 +		dateline = strdup(updatingline);
 +	}
 +
 +	if(ferror(fd)) {
 +		fprintf(stderr, "error reading input\n");
 +		exit(EX_IOERR);
 +	}
 +	(void)fclose(fd);
 +
 +	exit(EX_OK);
 +}
 +
 +int
 +usage(void)
 +{
 +	fprintf(stderr,
 +		"usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n");
 +	exit(EX_USAGE);
 +}
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pathnames.h src/usr.sbin/pkg_install/updating/pathnames.h
 --- src.orig/usr.sbin/pkg_install/updating/pathnames.h	1970-01-01 01:00:00.000000000 +0100
 +++ src/usr.sbin/pkg_install/updating/pathnames.h	2007-10-27 18:49:40.000000000 +0200
 @@ -0,0 +1,28 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + *
 + * $FreeBSD$
 + *
 + */
 +
 +/* Copy from ../version/version.h */
 +
 +/* Where the ports lives by default */
 +#define DEF_PORTS_DIR "/usr/ports/UPDATING"
 +/* just in case we change the environment variable name */
 +#define PORTSDIR  "PORTSDIR"
 +/* macro to get name of directory where we put logging information */
 +#define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), \
 +	"/UPDATING") : DEF_PORTS_DIR)
 +
 +/* Where we put logging information by default, else ${PKG_DBDIR} if set */
 +#define DEF_LOG_DIR	"/var/db/pkg"
 +/* just in case we change the environment variable name */
 +#define PKG_DBDIR	"PKG_DBDIR"
 +/* macro to get name of directory where we put logging information */
 +#define LOG_DIR		(getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR)
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pkg_updating.1 src/usr.sbin/pkg_install/updating/pkg_updating.1
 --- src.orig/usr.sbin/pkg_install/updating/pkg_updating.1	1970-01-01 01:00:00.000000000 +0100
 +++ src/usr.sbin/pkg_install/updating/pkg_updating.1	2007-10-27 15:26:49.000000000 +0200
 @@ -0,0 +1,88 @@
 +.\"
 +.\" FreeBSD updating - Scan the installed ports and show all UPDATING entries 
 +.\"	that affect one of the installed ports. Alternative a list of portnames 
 +.\" could be passed to pkg_updating
 +.\"
 +.\" "THE BEER-WARE LICENSE" (Revision 42):
 +.\" <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 +.\" can do whatever you want with this stuff. If we meet some day, and you think
 +.\" this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 +.\"
 +.\" $FreeBSD$
 +.\"
 +.Dd October 20, 2007
 +.Dt PKG_UPDATING 1
 +.Os
 +.Sh NAME
 +.Nm pkg_updating
 +.Nd a utility for displaying UPDATING entries of software packages
 +.Sh SYNOPSIS
 +.Nm
 +.Op Fl d Ar date
 +.Op Fl f Ar file
 +.Op Ar pkg-name ...
 +.Nm
 +.Sh DESCRIPTION
 +The
 +.Nm
 +command scan the installed ports and show all UPDATING entries that affect one
 +of the installed ports. Alternative a list of pkg-names could be passed.
 +.Sh OPTIONS
 +The following command line options are supported:
 +.Bl -tag -width indent
 +.It Ar pkg-name ...
 +UPDATING entries for the named packages are displayed.
 +.It Fl d Ar date
 +Only entries newer than this date are shown. Use a YYYYMMDD date format.
 +.It Fl f Ar UPDATING file
 +Defines a alternative location of the UPDATING file.
 +.El
 +.Sh EXAMPLES
 +.Bl -tag -width indent
 +.Dl pkg_updating
 +.Pp
 +Shows all entries of all installed ports.
 +.Pp
 +.Dl pkg_updating -d 20070101
 +.Pp
 +Shows all entries of all installed ports since 2007-01-01.
 +.Pp
 +.Dl pkg_updating apache mysql
 +.Pp
 +Shows all entries for all apache and mysql ports.
 +.Pp
 +.Dl pkg_updating -d 20060101 apache
 +.Pp
 +Shows all apache entries since 2006-01-01.
 +.Pp
 +.Dl pkg_updating -f /tmp/UPDATING
 +.Pp
 +Defines that the UPDATING file is in /tmp and shows all entries of all
 +installed ports
 +.Pp
 +.El
 +.Sh ENVIRONMENT
 +.Bl -tag -width PKG_DBDIR
 +.It Ev PKG_DBDIR
 +Specifies an alternative location for the installed package database.
 +.It Ev PORTSDIR
 +Location of the ports tree.
 +.El
 +.Sh FILES
 +.Bl -tag -width /var/db/pkg -compact
 +.It Pa /var/db/pkg
 +Default location of the installed package database.
 +.It Pa /usr/ports
 +The default ports directory and default location of the UPDATING file
 +.El
 +.Sh SEE ALSO
 +.Xr pkg_add 1 ,
 +.Xr pkg_create 1 ,
 +.Xr pkg_delete 1 ,
 +.Xr pkg_version 1
 +.Sh AUTHORS
 +.An Beat Gtzi Aq beat@chruetertee.ch
 +.Sh CONTRIBUTORS
 +.An Martin Tournoij Aq carpetsmoker@xs4all.nl
 +.Sh BUGS
 +Sure to be some.
 
 --------------020505060006080209090802--
Responsible-Changed-From-To: freebsd-bugs->krion 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sat Oct 27 21:15:14 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117564 

From: Kirill Ponomarew <krion@voodoo.bawue.com>
To: Beat Gaetzi <beat@chruetertee.ch>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/117564: pkg_updating: UPDATING parser and displayer
Date: Fri, 2 Nov 2007 21:32:01 +0100

 I'm a bit concerned about this warning, it's on my amd64 -current:
 
 ===> updating (all)
 Warning: Object directory not changed from original /usr/src/usr.sbin/pkg_install/updating
 cc -O2 -fno-strict-aliasing -pipe  -I/usr/src/usr.sbin/pkg_install/updating/../lib -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wno-pointer-sign -Wformat=2 -Wno-format-extra-args -c main.c
 main.c: In function 'main':
 main.c:120: warning: value computed is not used
 
 -Kirill

From: =?ISO-8859-1?Q?Beat_G=E4tzi?= <beat@chruetertee.ch>
To: Kirill Ponomarew <krion@voodoo.bawue.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/117564: pkg_updating: UPDATING parser and displayer
Date: Fri, 02 Nov 2007 22:25:13 +0100

 This is a multi-part message in MIME format.
 --------------080701040803000109080609
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Hi Kirill,
 
 Kirill Ponomarew wrote:
 > I'm a bit concerned about this warning, it's on my amd64 -current:
 > 
 > ===> updating (all)
 > Warning: Object directory not changed from original /usr/src/usr.sbin/pkg_install/updating
 > main.c: In function 'main':
 > main.c:120: warning: value computed is not used
 
 Please try the attached patch, it fixes this warning. Sorry for the
 inconvenience.
 
 Regards,
 Beat
 
 --------------080701040803000109080609
 Content-Type: text/plain;
  name="pkg_updating.patch"
 Content-Transfer-Encoding: 8bit
 Content-Disposition: inline;
  filename="pkg_updating.patch"
 
 diff -Naur src.orig/usr.sbin/pkg_install/Makefile src/usr.sbin/pkg_install/Makefile
 --- src.orig/usr.sbin/pkg_install/Makefile	Sun Jun 24 21:12:55 2007
 +++ src/usr.sbin/pkg_install/Makefile	Fri Nov  2 21:45:08 2007
 @@ -2,7 +2,7 @@
  
  .include <bsd.own.mk>
  
 -SUBDIR=	lib add create delete info ${_sign} version
 +SUBDIR=	lib add create delete info ${_sign} updating version
  
  .if ${MK_OPENSSL} != "no"
  _sign=	sign
 diff -Naur src.orig/usr.sbin/pkg_install/updating/Makefile src/usr.sbin/pkg_install/updating/Makefile
 --- src.orig/usr.sbin/pkg_install/updating/Makefile	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/Makefile	Fri Nov  2 21:45:16 2007
 @@ -0,0 +1,11 @@
 +# $FreeBSD$
 +
 +PROG=	pkg_updating
 +SRCS=	main.c
 +
 +CFLAGS+= -I${.CURDIR}/../lib
 +
 +WARNS?=	6
 +WFORMAT?=	1
 +
 +.include <bsd.prog.mk>
 diff -Naur src.orig/usr.sbin/pkg_install/updating/main.c src/usr.sbin/pkg_install/updating/main.c
 --- src.orig/usr.sbin/pkg_install/updating/main.c	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/main.c	Fri Nov  2 21:55:42 2007
 @@ -0,0 +1,248 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/param.h>						/* For MAXPATHLEN */
 +
 +#include <dirent.h>
 +#include <errno.h>
 +#include <limits.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>	
 +#include <sysexits.h>
 +#include <unistd.h>
 +
 +#include "pathnames.h"
 +
 +typedef struct installedport {
 +	struct installedport *next;				/* List of installed ports. */
 +	char name[LINE_MAX];					/* Name of the installed port. */
 +} INSTALLEDPORT;
 +
 +int usage(void);
 +
 +/*
 + * Parse /usr/port/UPDATING for corresponding entries. If no argument is
 + * passed to pkg_updating all entries for all installed ports are displayed.
 + * If a list of portnames is passed to pkg_updating only entries for the
 + * given portnames are displayed. Use the -d option to define that only newer
 + * entries as this date are shown.
 + */
 +int
 +main(int argc, char *argv[])
 +{
 +	/* Keyword for searching portname in UPDATING. */
 +	const char *affects = "AFFECTS";
 +	/* Indicate a date -> end of a entry. Will fail on 2100-01-01... */
 +	const char *end = "20";
 +	/* Keyword for searching origin portname of installed port. */
 +	const char *origin = "@comment ORIGIN:";
 +	const char *pkgdbpath = LOG_DIR;		/* Location of pkgdb */
 +	const char *updatingfile = UPDATING;	/* Location of UPDATING */
 +
 +	char *date = NULL; 						/* Passed -d argument */
 +	char *dateline = NULL;					/* Saved date of an entry */
 +	/* Tmp lines for parsing file */
 +	char *tmpline1 = NULL;
 +	char *tmpline2 = NULL;
 +
 +	char originline[LINE_MAX];					/* Line of +CONTENTS */
 +	/* Temporary variable to create path to +CONTENTS for installed ports. */
 +	char tmp_file[MAXPATHLEN];
 +	char updatingline[LINE_MAX];				/* Line of UPDATING */
 +
 +	int ch;										/* Char used by getopt */
 +	int found = 0;								/* Found an entry */
 +	int linelength;								/* Length of parsed line */
 +	int maxcharperline = LINE_MAX;				/* Max chars per line */
 +	int dflag = 0;								/* -d option set */
 +	/* If pflag = 0 UPDATING will be checked for all installed ports. */
 +	int pflag = 0;
 +
 +	size_t n;									/* Offset to create path */
 +
 +	struct dirent *pkgdbdir;					/* pkgdb directory */
 +
 +	/* Needed nodes for linked list with installed ports. */
 +	INSTALLEDPORT *head = (INSTALLEDPORT *) NULL;
 +	INSTALLEDPORT *curr = (INSTALLEDPORT *) NULL;
 +
 +	DIR *dir;
 +	FILE *fd;
 +
 +	while ((ch = getopt(argc, argv, "f:p:d:")) != -1) {
 +		switch (ch) {
 +			case 'd':
 +				dflag = 1;
 +				date = optarg;
 +				break;
 +			case 'f':
 +				updatingfile = optarg;
 +				break;
 +			case '?':
 +			default:
 +				usage();
 +		}
 +	}
 +	argc -= optind;
 +	argv += optind;
 +
 +	/* Check if passed date has a correct format. */
 +	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);
 +		}
 +	}
 +
 +	/* Save the list of passed portnames. */
 +	if (argc != 0) {
 +		pflag = 1;
 +		while (*argv) {
 +			if((curr = (INSTALLEDPORT *)
 +				malloc(sizeof(INSTALLEDPORT))) == NULL)
 +				(void)exit(EXIT_FAILURE);
 +			strlcpy (curr->name, *argv, strlen(*argv) + 1);
 +			curr->next = head;
 +			head = curr;
 +			(void)*argv++;
 +		}
 +	}
 +
 +	/*
 +	 * UPDATING will be parsed for all installed ports
 +	 * if no portname is passed.
 +	 */
 +	if (pflag == 0) {
 +		/* Open /var/db/pkg and search for all installed ports. */
 +		if((dir = opendir(pkgdbpath)) != NULL) {
 +			while ((pkgdbdir = readdir(dir)) != NULL) {
 +				if (strcmp(pkgdbdir->d_name, ".") != 0 && 
 +					strcmp(pkgdbdir->d_name, "..") !=0) {
 +
 +					/* Create path to +CONTENTS file for each installed port */
 +					n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1);
 +					n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n);
 +					n = strlcat(tmp_file + n, pkgdbdir->d_name,
 +						sizeof(tmp_file) - n);
 +					(void)strlcat(tmp_file + n, "/+CONTENTS",
 +						sizeof(tmp_file) - n);
 +
 +					/* Open +CONTENT file */
 +					fd = fopen(tmp_file, "r");
 +					if(fd == NULL) {
 +						fprintf(stderr, "warning: can't open %s: %s\n",
 +						tmp_file, strerror(errno));
 +						continue;
 +					}
 +
 +					/*
 +					 * Parses +CONTENT for ORIGIN line and
 +					 * put element into linked list.
 +					 */
 +					while(fgets(originline, maxcharperline, fd) != NULL) {
 +						tmpline1 = strstr(originline, origin);
 +						if( tmpline1 != NULL ) {
 +							/* Tmp variable to store port name. */
 +							char *pname;
 +							pname = strrchr(originline, (int)':');
 +							pname++;
 +							if((curr = (INSTALLEDPORT *)
 +								malloc(sizeof(INSTALLEDPORT))) == NULL)
 +								(void)exit(EXIT_FAILURE);
 +							strlcpy (curr->name, pname, strlen(pname)+1);
 +							curr->next = head;
 +							head = curr;
 +						}
 +					}
 +					
 +					if(ferror(fd)) {
 +						fprintf(stderr, "error reading input\n");
 +						exit(EX_IOERR);
 +					}
 +
 +					(void)fclose(fd);
 +				}
 +			}
 +			closedir(dir);
 +		} 
 +	}
 +
 +	/* Open UPDATING file */
 +	fd = fopen(updatingfile, "r");
 +	if(fd == NULL) {
 +		fprintf(stderr, "can't open %s: %s\n",
 +		updatingfile, strerror(errno));
 +		exit(EX_UNAVAILABLE);
 +	}
 +
 +	/* Parse opened UPDATING file. */
 +	while(fgets(updatingline, maxcharperline, fd) != NULL) {
 +		/* No entry is found so far */
 +		if (found == 0) {
 +			/* Search for AFFECTS line to parse the portname. */
 +			tmpline1 = strstr(updatingline, affects);
 +
 +			if( tmpline1 != NULL ) {
 +				curr = head; 
 +				while(curr != NULL) {
 +					tmpline2 = strstr(updatingline, curr->name);
 +					if( tmpline2 != NULL )
 +						break;
 +					curr = curr->next;
 +				}
 +				if( tmpline2 != NULL ) {
 +					/* If -d is set, check if entry is newer than the date. */
 +					if ( (dflag == 1) && (strncmp(dateline, date, 8) < 0))
 +						continue;
 +					printf("%s", dateline);
 +					printf("%s", updatingline);
 +					found = 1;
 +				}
 +			}
 +		}
 +		/* Search for the end of an entry, if not found print the line. */
 +		else {
 +			tmpline1 = strstr(updatingline, end);
 +			if( tmpline1 == NULL )
 +				printf("%s", updatingline);
 +			else {
 +				linelength = strlen(updatingline);
 +				if (linelength == 10)
 +					found = 0;
 +				else
 +					printf("%s", updatingline);
 +			}
 +		}
 +		/* Save the actual line, it could be a date. */
 +		dateline = strdup(updatingline);
 +	}
 +
 +	if(ferror(fd)) {
 +		fprintf(stderr, "error reading input\n");
 +		exit(EX_IOERR);
 +	}
 +	(void)fclose(fd);
 +
 +	exit(EX_OK);
 +}
 +
 +int
 +usage(void)
 +{
 +	fprintf(stderr,
 +		"usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n");
 +	exit(EX_USAGE);
 +}
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pathnames.h src/usr.sbin/pkg_install/updating/pathnames.h
 --- src.orig/usr.sbin/pkg_install/updating/pathnames.h	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/pathnames.h	Fri Nov  2 21:44:47 2007
 @@ -0,0 +1,28 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + *
 + * $FreeBSD$
 + *
 + */
 +
 +/* Copy from ../version/version.h */
 +
 +/* Where the ports lives by default */
 +#define DEF_PORTS_DIR "/usr/ports/UPDATING"
 +/* just in case we change the environment variable name */
 +#define PORTSDIR  "PORTSDIR"
 +/* macro to get name of directory where we put logging information */
 +#define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), \
 +	"/UPDATING") : DEF_PORTS_DIR)
 +
 +/* Where we put logging information by default, else ${PKG_DBDIR} if set */
 +#define DEF_LOG_DIR	"/var/db/pkg"
 +/* just in case we change the environment variable name */
 +#define PKG_DBDIR	"PKG_DBDIR"
 +/* macro to get name of directory where we put logging information */
 +#define LOG_DIR		(getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR)
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pkg_updating.1 src/usr.sbin/pkg_install/updating/pkg_updating.1
 --- src.orig/usr.sbin/pkg_install/updating/pkg_updating.1	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/pkg_updating.1	Fri Nov  2 21:44:47 2007
 @@ -0,0 +1,88 @@
 +.\"
 +.\" FreeBSD updating - Scan the installed ports and show all UPDATING entries 
 +.\"	that affect one of the installed ports. Alternative a list of portnames 
 +.\" could be passed to pkg_updating
 +.\"
 +.\" "THE BEER-WARE LICENSE" (Revision 42):
 +.\" <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 +.\" can do whatever you want with this stuff. If we meet some day, and you think
 +.\" this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 +.\"
 +.\" $FreeBSD$
 +.\"
 +.Dd October 20, 2007
 +.Dt PKG_UPDATING 1
 +.Os
 +.Sh NAME
 +.Nm pkg_updating
 +.Nd a utility for displaying UPDATING entries of software packages
 +.Sh SYNOPSIS
 +.Nm
 +.Op Fl d Ar date
 +.Op Fl f Ar file
 +.Op Ar pkg-name ...
 +.Nm
 +.Sh DESCRIPTION
 +The
 +.Nm
 +command scan the installed ports and show all UPDATING entries that affect one
 +of the installed ports. Alternative a list of pkg-names could be passed.
 +.Sh OPTIONS
 +The following command line options are supported:
 +.Bl -tag -width indent
 +.It Ar pkg-name ...
 +UPDATING entries for the named packages are displayed.
 +.It Fl d Ar date
 +Only entries newer than this date are shown. Use a YYYYMMDD date format.
 +.It Fl f Ar UPDATING file
 +Defines a alternative location of the UPDATING file.
 +.El
 +.Sh EXAMPLES
 +.Bl -tag -width indent
 +.Dl pkg_updating
 +.Pp
 +Shows all entries of all installed ports.
 +.Pp
 +.Dl pkg_updating -d 20070101
 +.Pp
 +Shows all entries of all installed ports since 2007-01-01.
 +.Pp
 +.Dl pkg_updating apache mysql
 +.Pp
 +Shows all entries for all apache and mysql ports.
 +.Pp
 +.Dl pkg_updating -d 20060101 apache
 +.Pp
 +Shows all apache entries since 2006-01-01.
 +.Pp
 +.Dl pkg_updating -f /tmp/UPDATING
 +.Pp
 +Defines that the UPDATING file is in /tmp and shows all entries of all
 +installed ports
 +.Pp
 +.El
 +.Sh ENVIRONMENT
 +.Bl -tag -width PKG_DBDIR
 +.It Ev PKG_DBDIR
 +Specifies an alternative location for the installed package database.
 +.It Ev PORTSDIR
 +Location of the ports tree.
 +.El
 +.Sh FILES
 +.Bl -tag -width /var/db/pkg -compact
 +.It Pa /var/db/pkg
 +Default location of the installed package database.
 +.It Pa /usr/ports
 +The default ports directory and default location of the UPDATING file
 +.El
 +.Sh SEE ALSO
 +.Xr pkg_add 1 ,
 +.Xr pkg_create 1 ,
 +.Xr pkg_delete 1 ,
 +.Xr pkg_version 1
 +.Sh AUTHORS
 +.An Beat Gtzi Aq beat@chruetertee.ch
 +.Sh CONTRIBUTORS
 +.An Martin Tournoij Aq carpetsmoker@xs4all.nl
 +.Sh BUGS
 +Sure to be some.
 
 --------------080701040803000109080609--

From: Kirill Ponomarew <krion@voodoo.bawue.com>
To: Beat G?tzi <beat@chruetertee.ch>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/117564: pkg_updating: UPDATING parser and displayer
Date: Fri, 2 Nov 2007 22:32:01 +0100

 On Fri, Nov 02, 2007 at 10:25:13PM +0100, Beat G?tzi wrote:
 > Please try the attached patch, it fixes this warning. Sorry for the
 > inconvenience.
 
 Thanks a lot for the fix, I've got another problem running it with
 -d, like:
 
 voodoo#  pkg_updating -d 20070101
 warning: can't open /var/db/pkg/pkgdb.db/+CONTENTS: Not a directory
 warning: can't open /var/db/pkg/Index.db/+CONTENTS: Not a directory
 20070104:
   AFFECTS: users of sysutils/hal
   AUTHOR: gnome@FreeBSD.org
 
   If atapicam is enabled in the kernel, hald will use the CAM device nodes
   instead of ATAPI device nodes to access disc devices (e.g. CD-ROMS,
   DVD drives, etc.).  Previously, hald would use ATAPI device nodes even
   if atapicam was enabled.  The previous behavior can be restored by
   following the instructions in /usr/local/share/doc/hal-0.5.8/README.freebsd.
 
 -Kirill

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/117564: commit references a PR
Date: Fri,  2 Nov 2007 22:48:38 +0000 (UTC)

 krion       2007-11-02 22:46:30 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.sbin/pkg_install Makefile 
   Added files:
     usr.sbin/pkg_install/updating Makefile main.c pathnames.h 
                                   pkg_updating.1 
   Log:
   Introduce pkg_updating(1) which scans for installed ports and shows
   all ports/UPDATING entries that affect one of the installed ports,
   and are relevant on the given machine.
   
   PR:             bin/117564
   Submitted by:   Beat Gaetzi <beat@chruetertee.ch>
   MFC after:      14 days
   
   Revision  Changes    Path
   1.18      +1 -1      src/usr.sbin/pkg_install/Makefile
   1.1       +11 -0     src/usr.sbin/pkg_install/updating/Makefile (new)
   1.1       +257 -0    src/usr.sbin/pkg_install/updating/main.c (new)
   1.1       +28 -0     src/usr.sbin/pkg_install/updating/pathnames.h (new)
   1.1       +88 -0     src/usr.sbin/pkg_install/updating/pkg_updating.1 (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: krion 
State-Changed-When: Fri Nov 2 22:54:49 UTC 2007 
State-Changed-Why:  
MFC follows in 14 days 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117564 

From: =?ISO-8859-1?Q?Beat_G=E4tzi?= <beat@chruetertee.ch>
To: Kirill Ponomarew <krion@voodoo.bawue.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/117564: pkg_updating: UPDATING parser and displayer
Date: Fri, 02 Nov 2007 23:29:11 +0100

 This is a multi-part message in MIME format.
 --------------050609040507040200000900
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Kirill Ponomarew wrote:
 > Thanks a lot for the fix, I've got another problem running it with
 > -d, like:
 > 
 > voodoo#  pkg_updating -d 20070101
 > warning: can't open /var/db/pkg/pkgdb.db/+CONTENTS: Not a directory
 > warning: can't open /var/db/pkg/Index.db/+CONTENTS: Not a directory
 
 Thanks for your feedback. I didn't have the pkgdb.db and Index.db files
 on my machines, that's why I didn't recognize this problem. I think this
 files are used by portupgrade. I wrote a little workaround for such
 files. Please try the attached patch.
 
 Regards,
 Beat
 
 
 --------------050609040507040200000900
 Content-Type: text/plain;
  name="pkg_updating.patch"
 Content-Transfer-Encoding: 8bit
 Content-Disposition: inline;
  filename="pkg_updating.patch"
 
 diff -Naur src.orig/usr.sbin/pkg_install/Makefile src/usr.sbin/pkg_install/Makefile
 --- src.orig/usr.sbin/pkg_install/Makefile	Sun Jun 24 21:12:55 2007
 +++ src/usr.sbin/pkg_install/Makefile	Fri Nov  2 21:45:08 2007
 @@ -2,7 +2,7 @@
  
  .include <bsd.own.mk>
  
 -SUBDIR=	lib add create delete info ${_sign} version
 +SUBDIR=	lib add create delete info ${_sign} updating version
  
  .if ${MK_OPENSSL} != "no"
  _sign=	sign
 diff -Naur src.orig/usr.sbin/pkg_install/updating/Makefile src/usr.sbin/pkg_install/updating/Makefile
 --- src.orig/usr.sbin/pkg_install/updating/Makefile	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/Makefile	Fri Nov  2 21:45:16 2007
 @@ -0,0 +1,11 @@
 +# $FreeBSD$
 +
 +PROG=	pkg_updating
 +SRCS=	main.c
 +
 +CFLAGS+= -I${.CURDIR}/../lib
 +
 +WARNS?=	6
 +WFORMAT?=	1
 +
 +.include <bsd.prog.mk>
 diff -Naur src.orig/usr.sbin/pkg_install/updating/main.c src/usr.sbin/pkg_install/updating/main.c
 --- src.orig/usr.sbin/pkg_install/updating/main.c	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/main.c	Fri Nov  2 23:09:25 2007
 @@ -0,0 +1,257 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + */
 +
 +#include <sys/cdefs.h>
 +__FBSDID("$FreeBSD$");
 +
 +#include <sys/stat.h>
 +#include <sys/param.h>						/* For MAXPATHLEN */
 +
 +#include <dirent.h>
 +#include <errno.h>
 +#include <limits.h>
 +#include <stdio.h>
 +#include <stdlib.h>
 +#include <string.h>	
 +#include <sysexits.h>
 +#include <unistd.h>
 +
 +#include "pathnames.h"
 +
 +typedef struct installedport {
 +	struct installedport *next;				/* List of installed ports. */
 +	char name[LINE_MAX];					/* Name of the installed port. */
 +} INSTALLEDPORT;
 +
 +int usage(void);
 +
 +/*
 + * Parse /usr/port/UPDATING for corresponding entries. If no argument is
 + * passed to pkg_updating all entries for all installed ports are displayed.
 + * If a list of portnames is passed to pkg_updating only entries for the
 + * given portnames are displayed. Use the -d option to define that only newer
 + * entries as this date are shown.
 + */
 +int
 +main(int argc, char *argv[])
 +{
 +	/* Keyword for searching portname in UPDATING. */
 +	const char *affects = "AFFECTS";
 +	/* Indicate a date -> end of a entry. Will fail on 2100-01-01... */
 +	const char *end = "20";
 +	/* Keyword for searching origin portname of installed port. */
 +	const char *origin = "@comment ORIGIN:";
 +	const char *pkgdbpath = LOG_DIR;		/* Location of pkgdb */
 +	const char *updatingfile = UPDATING;	/* Location of UPDATING */
 +
 +	char *date = NULL; 						/* Passed -d argument */
 +	char *dateline = NULL;					/* Saved date of an entry */
 +	/* Tmp lines for parsing file */
 +	char *tmpline1 = NULL;
 +	char *tmpline2 = NULL;
 +
 +	char originline[LINE_MAX];				/* Line of +CONTENTS */
 +	/* Temporary variable to create path to +CONTENTS for installed ports. */
 +	char tmp_file[MAXPATHLEN];
 +	char updatingline[LINE_MAX];			/* Line of UPDATING */
 +
 +	int ch;									/* Char used by getopt */
 +	int found = 0;							/* Found an entry */
 +	int linelength;							/* Length of parsed line */
 +	int maxcharperline = LINE_MAX;			/* Max chars per line */
 +	int dflag = 0;							/* -d option set */
 +	/* If pflag = 0 UPDATING will be checked for all installed ports. */
 +	int pflag = 0;
 +
 +	size_t n;								/* Offset to create path */
 +
 +	struct dirent *pkgdbdir;				/* pkgdb directory */
 +	struct stat attribute;					/* attribute of pkgdb element */
 +
 +	/* Needed nodes for linked list with installed ports. */
 +	INSTALLEDPORT *head = (INSTALLEDPORT *) NULL;
 +	INSTALLEDPORT *curr = (INSTALLEDPORT *) NULL;
 +
 +	DIR *dir;
 +	FILE *fd;
 +
 +	while ((ch = getopt(argc, argv, "f:p:d:")) != -1) {
 +		switch (ch) {
 +			case 'd':
 +				dflag = 1;
 +				date = optarg;
 +				break;
 +			case 'f':
 +				updatingfile = optarg;
 +				break;
 +			case '?':
 +			default:
 +				usage();
 +		}
 +	}
 +	argc -= optind;
 +	argv += optind;
 +
 +	/* Check if passed date has a correct format. */
 +	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);
 +		}
 +	}
 +
 +	/* Save the list of passed portnames. */
 +	if (argc != 0) {
 +		pflag = 1;
 +		while (*argv) {
 +			if((curr = (INSTALLEDPORT *)
 +				malloc(sizeof(INSTALLEDPORT))) == NULL)
 +				(void)exit(EXIT_FAILURE);
 +			strlcpy (curr->name, *argv, strlen(*argv) + 1);
 +			curr->next = head;
 +			head = curr;
 +			(void)*argv++;
 +		}
 +	}
 +
 +	/*
 +	 * UPDATING will be parsed for all installed ports
 +	 * if no portname is passed.
 +	 */
 +	if (pflag == 0) {
 +		/* Open /var/db/pkg and search for all installed ports. */
 +		if((dir = opendir(pkgdbpath)) != NULL) {
 +			while ((pkgdbdir = readdir(dir)) != NULL) {
 +				if (strcmp(pkgdbdir->d_name, ".") != 0 && 
 +					strcmp(pkgdbdir->d_name, "..") !=0) {
 +
 +					/* Create path to +CONTENTS file for each installed port */
 +					n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1);
 +					n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n);
 +					n = strlcat(tmp_file + n, pkgdbdir->d_name,
 +						sizeof(tmp_file) - n);
 +					if(stat(tmp_file, &attribute) == -1) {
 +						fprintf(stderr, "can't open %s: %s\n",
 +							tmp_file, strerror(errno));
 +						return EXIT_FAILURE;
 +					}
 +					if(attribute.st_mode & S_IFREG)
 +						continue;
 +					(void)strlcat(tmp_file + n, "/+CONTENTS",
 +						sizeof(tmp_file) - n);
 +
 +					/* Open +CONTENT file */
 +					fd = fopen(tmp_file, "r");
 +					if(fd == NULL) {
 +						fprintf(stderr, "warning: can't open %s: %s\n",
 +						tmp_file, strerror(errno));
 +						continue;
 +					}
 +
 +					/*
 +					 * Parses +CONTENT for ORIGIN line and
 +					 * put element into linked list.
 +					 */
 +					while(fgets(originline, maxcharperline, fd) != NULL) {
 +						tmpline1 = strstr(originline, origin);
 +						if( tmpline1 != NULL ) {
 +							/* Tmp variable to store port name. */
 +							char *pname;
 +							pname = strrchr(originline, (int)':');
 +							pname++;
 +							if((curr = (INSTALLEDPORT *)
 +								malloc(sizeof(INSTALLEDPORT))) == NULL)
 +								(void)exit(EXIT_FAILURE);
 +							strlcpy (curr->name, pname, strlen(pname)+1);
 +							curr->next = head;
 +							head = curr;
 +						}
 +					}
 +					
 +					if(ferror(fd)) {
 +						fprintf(stderr, "error reading input\n");
 +						exit(EX_IOERR);
 +					}
 +
 +					(void)fclose(fd);
 +				}
 +			}
 +			closedir(dir);
 +		} 
 +	}
 +
 +	/* Open UPDATING file */
 +	fd = fopen(updatingfile, "r");
 +	if(fd == NULL) {
 +		fprintf(stderr, "can't open %s: %s\n",
 +		updatingfile, strerror(errno));
 +		exit(EX_UNAVAILABLE);
 +	}
 +
 +	/* Parse opened UPDATING file. */
 +	while(fgets(updatingline, maxcharperline, fd) != NULL) {
 +		/* No entry is found so far */
 +		if (found == 0) {
 +			/* Search for AFFECTS line to parse the portname. */
 +			tmpline1 = strstr(updatingline, affects);
 +
 +			if( tmpline1 != NULL ) {
 +				curr = head; 
 +				while(curr != NULL) {
 +					tmpline2 = strstr(updatingline, curr->name);
 +					if( tmpline2 != NULL )
 +						break;
 +					curr = curr->next;
 +				}
 +				if( tmpline2 != NULL ) {
 +					/* If -d is set, check if entry is newer than the date. */
 +					if ( (dflag == 1) && (strncmp(dateline, date, 8) < 0))
 +						continue;
 +					printf("%s", dateline);
 +					printf("%s", updatingline);
 +					found = 1;
 +				}
 +			}
 +		}
 +		/* Search for the end of an entry, if not found print the line. */
 +		else {
 +			tmpline1 = strstr(updatingline, end);
 +			if( tmpline1 == NULL )
 +				printf("%s", updatingline);
 +			else {
 +				linelength = strlen(updatingline);
 +				if (linelength == 10)
 +					found = 0;
 +				else
 +					printf("%s", updatingline);
 +			}
 +		}
 +		/* Save the actual line, it could be a date. */
 +		dateline = strdup(updatingline);
 +	}
 +
 +	if(ferror(fd)) {
 +		fprintf(stderr, "error reading input\n");
 +		exit(EX_IOERR);
 +	}
 +	(void)fclose(fd);
 +
 +	exit(EX_OK);
 +}
 +
 +int
 +usage(void)
 +{
 +	fprintf(stderr,
 +		"usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n");
 +	exit(EX_USAGE);
 +}
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pathnames.h src/usr.sbin/pkg_install/updating/pathnames.h
 --- src.orig/usr.sbin/pkg_install/updating/pathnames.h	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/pathnames.h	Fri Nov  2 21:44:47 2007
 @@ -0,0 +1,28 @@
 +/*-
 + * ----------------------------------------------------------------------------
 + * "THE BEER-WARE LICENSE" (Revision 42):
 + * <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 + * can do whatever you want with this stuff. If we meet some day, and you think
 + * this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 + * ----------------------------------------------------------------------------
 + *
 + * $FreeBSD$
 + *
 + */
 +
 +/* Copy from ../version/version.h */
 +
 +/* Where the ports lives by default */
 +#define DEF_PORTS_DIR "/usr/ports/UPDATING"
 +/* just in case we change the environment variable name */
 +#define PORTSDIR  "PORTSDIR"
 +/* macro to get name of directory where we put logging information */
 +#define UPDATING (getenv(PORTSDIR) ? strcat(getenv(PORTSDIR), \
 +	"/UPDATING") : DEF_PORTS_DIR)
 +
 +/* Where we put logging information by default, else ${PKG_DBDIR} if set */
 +#define DEF_LOG_DIR	"/var/db/pkg"
 +/* just in case we change the environment variable name */
 +#define PKG_DBDIR	"PKG_DBDIR"
 +/* macro to get name of directory where we put logging information */
 +#define LOG_DIR		(getenv(PKG_DBDIR) ? getenv(PKG_DBDIR) : DEF_LOG_DIR)
 diff -Naur src.orig/usr.sbin/pkg_install/updating/pkg_updating.1 src/usr.sbin/pkg_install/updating/pkg_updating.1
 --- src.orig/usr.sbin/pkg_install/updating/pkg_updating.1	Thu Jan  1 01:00:00 1970
 +++ src/usr.sbin/pkg_install/updating/pkg_updating.1	Fri Nov  2 21:44:47 2007
 @@ -0,0 +1,88 @@
 +.\"
 +.\" FreeBSD updating - Scan the installed ports and show all UPDATING entries 
 +.\"	that affect one of the installed ports. Alternative a list of portnames 
 +.\" could be passed to pkg_updating
 +.\"
 +.\" "THE BEER-WARE LICENSE" (Revision 42):
 +.\" <beat@chruetertee.ch> wrote this file. As long as you retain this notice you
 +.\" can do whatever you want with this stuff. If we meet some day, and you think
 +.\" this stuff is worth it, you can buy me a beer in return.          Beat Gtzi
 +.\"
 +.\" $FreeBSD$
 +.\"
 +.Dd October 20, 2007
 +.Dt PKG_UPDATING 1
 +.Os
 +.Sh NAME
 +.Nm pkg_updating
 +.Nd a utility for displaying UPDATING entries of software packages
 +.Sh SYNOPSIS
 +.Nm
 +.Op Fl d Ar date
 +.Op Fl f Ar file
 +.Op Ar pkg-name ...
 +.Nm
 +.Sh DESCRIPTION
 +The
 +.Nm
 +command scan the installed ports and show all UPDATING entries that affect one
 +of the installed ports. Alternative a list of pkg-names could be passed.
 +.Sh OPTIONS
 +The following command line options are supported:
 +.Bl -tag -width indent
 +.It Ar pkg-name ...
 +UPDATING entries for the named packages are displayed.
 +.It Fl d Ar date
 +Only entries newer than this date are shown. Use a YYYYMMDD date format.
 +.It Fl f Ar UPDATING file
 +Defines a alternative location of the UPDATING file.
 +.El
 +.Sh EXAMPLES
 +.Bl -tag -width indent
 +.Dl pkg_updating
 +.Pp
 +Shows all entries of all installed ports.
 +.Pp
 +.Dl pkg_updating -d 20070101
 +.Pp
 +Shows all entries of all installed ports since 2007-01-01.
 +.Pp
 +.Dl pkg_updating apache mysql
 +.Pp
 +Shows all entries for all apache and mysql ports.
 +.Pp
 +.Dl pkg_updating -d 20060101 apache
 +.Pp
 +Shows all apache entries since 2006-01-01.
 +.Pp
 +.Dl pkg_updating -f /tmp/UPDATING
 +.Pp
 +Defines that the UPDATING file is in /tmp and shows all entries of all
 +installed ports
 +.Pp
 +.El
 +.Sh ENVIRONMENT
 +.Bl -tag -width PKG_DBDIR
 +.It Ev PKG_DBDIR
 +Specifies an alternative location for the installed package database.
 +.It Ev PORTSDIR
 +Location of the ports tree.
 +.El
 +.Sh FILES
 +.Bl -tag -width /var/db/pkg -compact
 +.It Pa /var/db/pkg
 +Default location of the installed package database.
 +.It Pa /usr/ports
 +The default ports directory and default location of the UPDATING file
 +.El
 +.Sh SEE ALSO
 +.Xr pkg_add 1 ,
 +.Xr pkg_create 1 ,
 +.Xr pkg_delete 1 ,
 +.Xr pkg_version 1
 +.Sh AUTHORS
 +.An Beat Gtzi Aq beat@chruetertee.ch
 +.Sh CONTRIBUTORS
 +.An Martin Tournoij Aq carpetsmoker@xs4all.nl
 +.Sh BUGS
 +Sure to be some.
 
 --------------050609040507040200000900--
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Fri Jun 6 12:13:24 UTC 2008 
State-Changed-Why:  
Close, patch was MFC'd to RELENG_7 and RELENG_6 by flz on 2008-04-07 
so will be fixed in 6.4 and 7.1-RELEASE 

http://www.freebsd.org/cgi/query-pr.cgi?pr=117564 
>Unformatted:
