Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Initial commit of man pages and other changes
Marin Atanasov Nikolov committed 15 years ago
commit b5af7935e9dc444552c8d304c7c12c5d83db5cfc
parent 67cf1c7
21 files changed +756 -40
modified pkg/Makefile
@@ -15,6 +15,16 @@ LDADD+= -L../libpkg \
		-lpkgng \
		-lutil
WARNS?=		6
-
MAN=	pkg.1
+
MAN=	pkg.1 \
+
	pkg-add.1 \
+
	pkg-create.1 \
+
	pkg-delete.1 \
+
	pkg-info.1 \
+
	pkg-register.1 \
+
	pkg-repo.1 \
+
	pkg-update.1 \
+
	pkg-upgrade.1 \
+
	pkg-version.1 \
+
	pkg-which.1

.include <bsd.prog.mk>
modified pkg/add.c
@@ -44,11 +44,8 @@ void
usage_add(void)
{
	fprintf(stderr, "usage: pkg add <pkg-name>\n");
-
	fprintf(stderr, "       pkg add <url>://<pkg-name>\n\n"
-
			"Installs a package from either a local source or remote one.\n\n"
-
			"When installing from remote source you need to specify\n"
-
			"the protocol to use when fetching the package.\n\n"
-
			"Currently supported protocols are FTP, HTTP and HTTPS\n");
+
	fprintf(stderr, "       pkg add <url>://<pkg-name>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help add'.\n");
}

int
modified pkg/create.c
@@ -14,7 +14,8 @@ usage_create(void)
{
	fprintf(stderr, "usage: pkg create [-gx] [-r rootdir] [-m manifest] [-f format] [-o outdir] "
			"<pkg-name>\n");
-
	fprintf(stderr, "       pkg create -a [-r rootdir] [-m manifest] [-f format] [-o outdir]\n");
+
	fprintf(stderr, "       pkg create -a [-r rootdir] [-m manifest] [-f format] [-o outdir]\n\n");
+
	fprintf(stderr, "For more information see 'pkg help create'.\n");
}

/*
modified pkg/delete.c
@@ -13,7 +13,8 @@ void
usage_delete(void)
{
	fprintf(stderr, "usage: pkg delete [-f] <pkg-name>\n");
-
	fprintf(stderr, "       pkg delete -a\n");
+
	fprintf(stderr, "       pkg delete -a\n\n");
+
	fprintf(stderr, "For more information see 'pkg help delete'.\n");
}

int
modified pkg/info.c
@@ -84,7 +84,8 @@ void
usage_info(void)
{
	fprintf(stderr, "usage: pkg info\n");
-
	fprintf(stderr, "       pkg info [-egxXdrlsqO] <pkg-name>\n");
+
	fprintf(stderr, "       pkg info [-egxXdrlsqO] <pkg-name>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help info'.\n");
}

/*
modified pkg/main.c
@@ -42,13 +42,14 @@ static void
usage(void)
{
	fprintf(stderr, "usage: pkg <command> [<args>]\n\n");
-
	fprintf(stderr, "For more information on the different commands"
-
			" see 'pkg help <command>'\n\n");
	fprintf(stderr, "Where <command> can be:\n");

	for (unsigned int i = 0; i < cmd_len; i++) 
		fprintf(stderr, "\t%s\n", cmd[i].name);

+
	fprintf(stderr, "\nFor more information on the different commands"
+
			" see 'pkg help <command>'.\n");
+

	exit(EX_USAGE);
}

@@ -65,23 +66,31 @@ usage_help(void)
static int
exec_help(int argc, char **argv)
{
-
	if (argc != 2) {
+
	char *manpage;
+

+
	if ((argc != 2) || (strcmp("help", argv[1]) == 0)) {
		usage_help();
		return(EX_USAGE);
	}

	for (unsigned int i = 0; i < cmd_len; i++) {
		if (strcmp(cmd[i].name, argv[1]) == 0) {
-
			assert(cmd[i].usage != NULL);
-
			cmd[i].usage();
+
			if (asprintf(&manpage, "/usr/bin/man pkg-%s", cmd[i].name) == -1)
+
				errx(1, "cannot allocate memory");
+

+
			system(manpage);
+
			free(manpage);
+

			return (0);
		}
	}

	/* Command name not found */
-
	warnx("'%s' is not a valid command", argv[1]);
+
	warnx("'%s' is not a valid command.\n", argv[1]);
+
	
+
	fprintf(stderr, "See 'pkg help' for more information on the commands.\n");

-
	return (1);
+
	return (EX_USAGE);
}

int
@@ -89,7 +98,7 @@ main(int argc, char **argv)
{
	unsigned int i;
	struct commands *command = NULL;
-
	int ambiguous = -1;
+
	unsigned int ambiguous = 0;
	size_t len;

	if (argc < 2)
@@ -109,10 +118,7 @@ main(int argc, char **argv)
			 * we already found a partial match so `argv[1]' is
			 * an ambiguous shortcut
			 */
-
			if (command != NULL)
-
				ambiguous = 1;
-
			else
-
				ambiguous = 0;
+
			ambiguous++;

			command = &cmd[i];
		}
@@ -128,13 +134,15 @@ main(int argc, char **argv)
		return (command->exec(argc, argv));
	}

-
	if (ambiguous == 1) {
-
		warnx("Ambiguous command: '%s'. See 'pkg help' for more information.", argv[1]);
-
		warnx("'%s' could be one of the following:", argv[1]);
+
	if (ambiguous >= 1) {
+
		warnx("'%s' is not a valid command.\n", argv[1]);
+

+
		fprintf(stderr, "See 'pkg help' for more information on the commands.\n\n");
+
		fprintf(stderr, "Command '%s' could be %s:\n", argv[1], ( ambiguous == 1 ? "this" : "one of the following"));

		for (i = 0; i < cmd_len; i++)
			if (strncmp(argv[1], cmd[i].name, len) == 0)
-
				warnx("\t%s",cmd[i].name);
+
				fprintf(stderr, "\t%s\n",cmd[i].name);
	}

	return (EX_USAGE);
added pkg/pkg-add.1
@@ -0,0 +1,53 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-ADD 1
+
.Os
+
.Sh NAME
+
.Nm "pkg add"
+
.Nd Registeres a package and installs it on the system
+
.Sh SYNOPSIS
+
.Nm
+
.Ar <pkg-name>
+
.Nm
+
.Ar <url>://<pkg-name>
+
.Sh DESCRIPTION
+
.Nm
+
installs a package from either a local source or remote one.
+
.Pp
+
When installing from remote source you need to specify
+
the protocol to use when fetching the package.
+
.Pp
+
Currently supported protocols are FTP, HTTP and HTTPS.
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-delete(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-create.1
@@ -0,0 +1,86 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-CREATE 1
+
.Os
+
.Sh NAME
+
.Nm "pkg create"
+
.Nd Creates a package
+
.Sh SYNOPSIS
+
.Nm
+
.Op Fl gx
+
.Op Fl r Ar rootdir
+
.Op Fl m Ar manifest
+
.Op Fl f Ar format
+
.Op Fl o Ar outdir
+
.Op <pkg-name>
+
.Nm
+
.Op Fl a
+
.Op Fl r Ar rootdir
+
.Op Fl m Ar manifest
+
.Op Fl f Ar format
+
.Op Fl o Ar outdir
+
.Sh DESCRIPTION
+
.Nm
+
is used for creating packages.
+
.Pp
+
< To be completed >
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It Fl a
+
Match all packages that match
+
.Ar <pkg-name>
+
.It Fl g
+
Treat
+
.Ar <pkg-name>
+
as a shell glob pattern
+
.It Fl x
+
Treat
+
.Ar <pkg-name>
+
as a regular expression
+
.It Fl X
+
Treat
+
.Ar <pkg-name>
+
as an extended regular expression
+
.It Fl f
+
Specify package format.
+
.Pp
+
Supported formats include \fB.txz\fP, \fB.tbz\fP, \fB.tgz\fP and \fB.tar\fP
+
.Pp
+
If no format is specified \fB.txz\fP is assumed.
+
.It Fl o
+
Specify output directory for package creation
+
.It Fl r
+
< To be added >
+
.It Fl m
+
Specify manifest directory
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-add(1), pkg-delete(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-delete.1
@@ -0,0 +1,54 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-DELETE 1
+
.Os
+
.Sh NAME
+
.Nm "pkg delete"
+
.Nd deletes a package from the database and the system
+
.Sh SYNOPSIS
+
.Nm
+
.Op Fl a 
+
.Nm
+
.Op Fl f
+
.Ar <pkg-name>
+
.Sh DESCRIPTION
+
.Nm
+
is used for deleting previously installed packages and removes them from the 
+
database.
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It Fl f Ar <pkg-name>
+
Forces a package to be removed.
+
.It Fl a
+
Deletes all installed packages from the system and the database.
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-info.1
@@ -0,0 +1,93 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-INFO 1
+
.Os
+
.Sh NAME
+
.Nm "pkg info"
+
.Nd displays information for installed packages
+
.Sh SYNOPSIS
+
.Nm
+
.Nm
+
.Op Fl egxXdrlsqO
+
.Ar <pkg-name>
+
.Sh DESCRIPTION
+
.Nm
+
is used for displaying information for installed packages.
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It Fl O
+
Search is done by origin of the package.
+
.Pp
+
< Added only for ports compatibility - To be completed >
+
.It Fl e
+
Returns 0 if
+
.Ar <pkg-name>
+
is installed and is registered in the database, otherwise returns 1.
+
Useful for checking if a package is installed or not using a 
+
script.
+
.It Fl g
+
Treat
+
.Ar <pkg-name>
+
as a shell glob pattern.
+
.It Fl x
+
Treat
+
.Ar <pkg-name>
+
as a regular expression.
+
.It Fl X
+
Treat
+
.Ar <pkg-name>
+
as an extended regular expression.
+
.It Fl d
+
Displays the dependecies of package
+
.Ar <pkg-name>
+
.It Fl r
+
Displays a list of packages on which
+
.Ar <pkg-name>
+
depends.
+
.It Fl l
+
Display all files installed by
+
.Ar <pkg-name>
+
.It Fl s
+
Display the total size of files installed by
+
.Ar <pkg-name>
+
.It Fl E
+
< To be added >
+
.It Fl q
+
Be ``quiet'' - < To be completed >
+
.It Fl o
+
< To be added >
+
.It Fl p
+
Display the installation prefix for each package
+
matching
+
.Ar <pkg-name>
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-delete(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-register.1
@@ -0,0 +1,94 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-REGISTER 1
+
.Os
+
.Sh NAME
+
.Nm "pkg register"
+
.Nd registers a package into the database
+
.Sh SYNOPSIS
+
.Nm
+
.Op Fl v
+
.Op Fl c Ar comment
+
.Op Fl d Ar desc
+
.Op Fl f Ar plist-file
+
.Op Fl p Ar prefix
+
.Op Fl m Ar mtree-file
+
.Op Fl n Ar pkg-name
+
.Op Fl o Ar origin
+
.Op Fl r Ar maintainer
+
.Op Fl P Ar depends
+
.Op Fl C Ar conflicts
+
.Op Fl M Ar message-file
+
.Op Fl s Ar scripts
+
.Op Fl a Ar arch
+
.Op Fl w Ar www
+
.Op Fl O options
+
.Op Fl H
+
.Sh DESCRIPTION
+
.Nm
+
is used for registering a package into the database
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It Fl v
+
Verbose mode
+
.It Fl c Ar comment
+
One line description of the package
+
.It Fl d Ar desc
+
Description of the package
+
.It Fl f Ar plist-file
+
Specifies the packing list file
+
.It Fl m Ar mtree-file
+
Specifies the mtree file
+
.It Fl n Ar pkg-name
+
Specifies the package name
+
.It Fl o Ar origin
+
Package origin
+
.It Fl r Ar maintainer
+
Specifies the maintainer of the package
+
.It Fl P Ar depends
+
Defines the list of packages that the package depends on
+
.It Fl C Ar conflicts
+
Defines the list of packages that the package conflicts with
+
.It Fl M Ar message-file
+
Specifies the message file
+
.It Fl s Ar scripts
+
< To be added >
+
.It Fl a Ar arch
+
Specifies the package arch
+
.It Fl w Ar www
+
Specifies the web site of the package
+
.It Fl O Ar options
+
< To be added >
+
.It Fl H
+
< To be added >
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-delete(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-repo.1
@@ -0,0 +1,48 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-REPO 1
+
.Os
+
.Sh NAME
+
.Nm "pkg repo"
+
.Nd creates a package repository
+
.Sh SYNOPSIS
+
.Nm
+
.Ar <repo-path>
+
.Sh DESCRIPTION
+
.Nm
+
is used for creating package repositories
+
.Pp
+
< To be completed >
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-register(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-update.1
@@ -0,0 +1,45 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-UPDATE 1
+
.Os
+
.Sh NAME
+
.Nm "pkg update"
+
.Nd < To be added >
+
.Sh SYNOPSIS
+
.Nm
+
.Sh DESCRIPTION
+
.Nm
+
< To be added >
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-upgrade.1
@@ -0,0 +1,45 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-UPGRADE 1
+
.Os
+
.Sh NAME
+
.Nm "pkg upgrade"
+
.Nd < To be added >
+
.Sh SYNOPSIS
+
.Nm
+
.Sh DESCRIPTION
+
.Nm
+
< To be added >
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-version.1
@@ -0,0 +1,93 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-VERSION 1
+
.Os
+
.Sh NAME
+
.Nm "pkg version"
+
.Nd summarize installed versions of packages
+
.Sh SYNOPSIS
+
.Nm
+
.Op Fl hIoqv
+
.Op Fl l Ar limchar
+
.Op Fl L Ar limchar
+
.Oo
+
.Op Fl X 
+
.Fl s Ar string
+
.Oc
+
.Op Fl O Ar origin
+
.Op Ar index
+
.Nm
+
.Fl t Ar version1
+
.Nm
+
.Fl T Ar <pkgname> Ar <pattern>
+
.Sh DESCRIPTION
+
.Nm
+
is used for generating a report of packages installed by \fBpkg(1)\fP
+
.Pp
+
< To be completed >
+
.Sh OPTIONS
+
The following options are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It Fl h
+
Displays usage information
+
.It Fl I
+
Use INDEX file for determining if a package is out of date
+
.It Fl o
+
Display package origin, instead of package name.
+
.It Fl q
+
Be quiet. Less output will be produced.
+
.It Fl v
+
Be verbose.
+
.It Fl l Ar limchar
+
Display only the packages which status flag matches the one specified by
+
.Ar limchar
+
.It Fl L Ar limchar
+
Does the opposite of
+
.Fl l
+
flag. Displays the packages which status flag does not match the one
+
specified by
+
.Ar limchar
+
.It Fl X 
+
Treat
+
.Ar string
+
as an extended regular expression.
+
.It Fl s Ar string
+
Only display the packages that match
+
.Ar string
+
.It Fl O Ar origin
+
Display only the packages which origin matches
+
.Ar origin
+
.It Fl t Ar <version1> Ar <version2>
+
< To be added >
+
.It Fl T Ar <pkgname> Ar <pattern>
+
< To be added >
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-add(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
added pkg/pkg-which.1
@@ -0,0 +1,47 @@
+
.\"
+
.\" FreeBSD pkg - a next generation package for the installation and maintenance
+
.\" of non-core utilities.
+
.\"
+
.\" Redistribution and use in source and binary forms, with or without
+
.\" modification, are permitted provided that the following conditions
+
.\" are met:
+
.\" 1. Redistributions of source code must retain the above copyright
+
.\"    notice, this list of conditions and the following disclaimer.
+
.\" 2. Redistributions in binary form must reproduce the above copyright
+
.\"    notice, this list of conditions and the following disclaimer in the
+
.\"    documentation and/or other materials provided with the distribution.
+
.\"
+
.\"
+
.\"     @(#)pkg.1
+
.\" $FreeBSD$
+
.\"
+
.Dd April 06, 2011
+
.Dt PKG-WHICH 1
+
.Os
+
.Sh NAME
+
.Nm "pkg which"
+
.Nd displays which package installed a specific file
+
.Sh SYNOPSIS
+
.Nm
+
.Ar <file>
+
.Sh DESCRIPTION
+
.Nm
+
is used for displaying the package that installed
+
.Ar <file>
+
.Sh OPTIONS
+
The following commands are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.El
+
.Sh WARNING
+
.Sh ENVRIOMENT
+
The following envrioment variables affect the execution of
+
.Nm :
+
.Bl -tag -width ".Ev TMPDIR"
+
.El
+
.Sh FILES
+
.Sh SEE ALSO
+
pkg(1), pkg-create(1), pkg-delete(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1)
+
.Sh AUTHORS AND CONTRIBUTORS
+
.Sh BUGS
modified pkg/pkg.1
@@ -16,28 +16,64 @@
.\" $FreeBSD$
.\"
.Dd March 29, 2011
-
.Dt pkg
+
.Dt PKG 1
.Os
.Sh NAME
.Nm pkg
.Nd a utility for manipulating packages 
.Sh SYNOPSIS
.Nm
+
.Ar <command> Ar <flags>
.Sh DESCRIPTION
-
The 
.Nm
-
command provides an interface for registerating, upgrading,
-
removing, and otherwise manipulating packages
+
provides an interface for manupulating packages - registering,
+
adding, removing and upgrading of packages.
+
.Sh COMMANDS
+
The following commands are supported by
+
.Nm :
+
.Bl -tag -width F1
+
.It \fBhelp\fP Ar <command>
+
Displays usage information.
+
.Ar <command>
+
.It \fBadd\fP
+
Install a package from either a local source or a remote one.
+
.Pp
+
When installing from remote source you need to specify the
+
protocol to use when fetching the package.
+
.Pp
+
Currently supported protocols are FTP, HTTP and HTTPS.
+
.It \fBcreate\fP
+
< To be added >
+
.It \fBdelete\fP
+
Deletes a package from the database and the system.
+
.It \fBinfo\fP
+
Displays information about installed packages.
+
.It \fBregister\fP
+
Registers a package in the database.
+
.It \fBrepo\fP
+
Creates a package repository.
+
.Pp
+
< To be completed >
+
.It \fBupdate\fP
+
< To be added >
+
.It \fBupgrade\fP
+
Upgrades a package to a newer version.
+
.It \fBversion\fP
+
< To be added >
+
.It \fBwhich\fP
+
Queries the database for package(s) that installed a specific
+
file.
+
.El
.Sh WARNING
-
.Sh OPTIONS
.Sh ENVRIOMENT
The following envrioment variables affect the execution of
.Nm :
.Bl -tag -width ".Ev TMPDIR"
.It Ev TMPDIR, SQLITE_FORCE_PROXY_LOCKING, PKG_DBDIR
+
.El
.Sh FILES
.Sh SEE ALSO
-
.Sh AUTHORS AND CONTRIBUTERS
+
pkg-add(1), pkg-create(1), pkg-delete(1), pkg-info(1), pkg-register(1), pkg-repo(1),
+
pkg-update(1), pkg-upgrade(1), pkg-version(1), pkg-which(1)
+
.Sh AUTHORS AND CONTRIBUTORS
.Sh BUGS
-

-

modified pkg/register.c
@@ -35,7 +35,8 @@ usage_register(void)
	fprintf(stderr, "usage: pkg register -c comment -d desc -f plist_file -p prefix\n");
	fprintf(stderr, "                    -m mtree_file -n pkgname -o origin -r maintainer\n");
	fprintf(stderr, "                    [-P depends] [-C conflicts] [-M message_file] [-s scripts]\n");
-
	fprintf(stderr, "                    [-a arch] [-w www] [-O options] [-H]\n");
+
	fprintf(stderr, "                    [-a arch] [-w www] [-O options] [-H]\n\n");
+
	fprintf(stderr, "For more information see 'pkg help register'.\n");
}

int
@@ -95,7 +96,7 @@ exec_register(int argc, char **argv)
				break;
			case 'n':
				if ((v = strrchr(optarg, '-')) == NULL)
-
					errx(1, "bad pkgname format");
+
					errx(EX_DATAERR, "bad pkgname format");

				v[0] = '\0';
				v++;
@@ -146,11 +147,11 @@ exec_register(int argc, char **argv)
	}

	if (plist == NULL)
-
		errx(1, "missing -f flag");
+
		errx(EX_USAGE, "missing -f flag");

	for (unsigned int i = 0; required_flags[i].flag != NULL; i++)
		if (pkg_get(pkg, required_flags[i].attr) == NULL)
-
			errx(1, "missing %s flag", required_flags[i].flag);
+
			errx(EX_USAGE, "missing %s flag", required_flags[i].flag);

	uname(&u);
	if (arch == NULL) {
modified pkg/repo.c
@@ -9,7 +9,8 @@
void
usage_repo(void)
{
-
	fprintf(stderr, "usage: pkg repo <repo-path>\n");
+
	fprintf(stderr, "usage: pkg repo <repo-path>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help repo'.\n");
}

static void
modified pkg/version.c
@@ -11,7 +11,8 @@ usage_version(void)
	fprintf(stderr, "usage: pkg version [-hIoqv] [-l limchar] [-L limchar] [[-X] -s string]\n");
	fprintf(stderr, "                   [-O origin] [index]\n");
	fprintf(stderr, "       pkg version -t <version1> <version2>\n");
-
	fprintf(stderr, "       pkg version -T <pkgname> <pattern>\n");
+
	fprintf(stderr, "       pkg version -T <pkgname> <pattern>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help version'.\n");
}

int exec_version(int argc, char **argv)
modified pkg/which.c
@@ -14,7 +14,8 @@
void
usage_which(void)
{
-
	fprintf(stderr, "usage: pkg which <file>\n");
+
	fprintf(stderr, "usage: pkg which <file>\n\n");
+
	fprintf(stderr, "For more information see 'pkg help which'.\n");
}

int