[Midnightbsd-cvs] src: pkg_install/info: Long options and updated man page for them.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Fri Sep 12 13:18:58 EDT 2008
Log Message:
-----------
Long options and updated man page for them.
Modified Files:
--------------
src/usr.sbin/pkg_install/info:
main.c (r1.4 -> r1.5)
pkg_info.1 (r1.4 -> r1.5)
-------------- next part --------------
Index: pkg_info.1
===================================================================
RCS file: /home/cvs/src/usr.sbin/pkg_install/info/pkg_info.1,v
retrieving revision 1.4
retrieving revision 1.5
diff -L usr.sbin/pkg_install/info/pkg_info.1 -L usr.sbin/pkg_install/info/pkg_info.1 -u -r1.4 -r1.5
--- usr.sbin/pkg_install/info/pkg_info.1
+++ usr.sbin/pkg_install/info/pkg_info.1
@@ -15,9 +15,9 @@
.\"
.\"
.\" @(#)pkg_info.1
-.\" $FreeBSD: src/usr.sbin/pkg_install/info/pkg_info.1,v 1.54.2.2 2006/01/16 19:48:17 flz Exp $
+.\" $FreeBSD: src/usr.sbin/pkg_install/info/pkg_info.1,v 1.54.2.4 2008/06/10 09:56:11 flz Exp $
.\"
-.Dd January 16, 2006
+.Dd May 30, 2008
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -25,7 +25,7 @@
.Nd a utility for displaying information on software packages
.Sh SYNOPSIS
.Nm
-.Op Fl bcdDEfgGijIkKLmopPqQrRsvVxX
+.Op Fl bcdDEfghGiIjkKLmopPqQrRsvVxX
.Op Fl e Ar package
.Op Fl l Ar prefix
.Op Fl t Ar template
@@ -67,9 +67,9 @@
will match versions 20030723 and later of the
.Pa portupgrade
package.
-.It Fl a
+.It Fl a , -all
Show all currently installed packages.
-.It Fl b
+.It Fl b , -blocksize
Use the
.Ev BLOCKSIZE
environment variable for output even when the
@@ -77,11 +77,13 @@
or
.Fl Q
flag is present.
-.It Fl v
+.It Fl h , -help
+Print help message.
+.It Fl v , -verbose
Turn on verbose output.
.It Fl p
Show the installation prefix for each package.
-.It Fl q
+.It Fl q , -quiet
Be
.Dq quiet
in emitting report headers and such, just dump the
@@ -110,7 +112,7 @@
Show the requirements script (if any) for each package.
.It Fl k
Show the de-install script (if any) for each package.
-.It Fl K
+.It Fl K , -keep
Keep any downloaded package in
.Ev PKGDIR
if it is defined or in current directory by default.
@@ -139,14 +141,14 @@
.Fx
.Em "Ports Collection"
of the underlying port from which the package was generated.
-.It Fl G
+.It Fl G , -no-glob
Do not try to expand shell glob patterns in the
.Ar pkg-name
when selecting packages to be displayed (by default
.Nm
automatically expands shell glob patterns in the
.Ar pkg-name ) .
-.It Fl W Ar filename
+.It Fl W , -which Ar filename
For the specified
.Ar filename
argument show which package it belongs to.
@@ -156,10 +158,10 @@
.Ev PATH
are searched using
.Xr which 1 .
-.It Fl O Ar origin
+.It Fl O , -origin Ar origin
List all packages having the specified
.Ar origin .
-.It Fl x
+.It Fl x , -regex
Treat the
.Ar pkg-name
as a regular expression and display information only for packages
@@ -169,13 +171,13 @@
.Nm
displays information about all packages that match at least one
regular expression from the list.
-.It Fl X
+.It Fl X , -extended
Like
.Fl x ,
but treats the
.Ar pkg-name
as an extended regular expression.
-.It Fl e Ar package
+.It Fl e , -exists Ar package
If the package identified by
.Ar package
is currently installed, return 0, otherwise return 1.
@@ -198,7 +200,7 @@
organize it.
This lets you add a special token to the start of
each field.
-.It Fl t Ar template
+.It Fl t , -template Ar template
Use
.Ar template
as the argument to
@@ -226,7 +228,7 @@
.Ed
.It Fl V
Show revision number of the packing list format.
-.It Fl P
+.It Fl P , -version
Show revision number of package tools.
.El
.Sh TECHNICAL DETAILS
Index: main.c
===================================================================
RCS file: /home/cvs/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -L usr.sbin/pkg_install/info/main.c -L usr.sbin/pkg_install/info/main.c -u -r1.4 -r1.5
--- usr.sbin/pkg_install/info/main.c
+++ usr.sbin/pkg_install/info/main.c
@@ -20,13 +20,13 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.sbin/pkg_install/info/main.c,v 1.47.2.2 2006/01/16 19:48:17 flz Exp $");
+__MBSDID("$MidnightBSD$");
-#include "lib.h"
-#include "info.h"
+#include <getopt.h>
#include <err.h>
-static char Options[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
+#include "lib.h"
+#include "info.h"
int Flags = 0;
match_t MatchType = MATCH_GLOB;
@@ -41,6 +41,25 @@
static void usage (void);
+static char opts[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
+static struct option longopts[] = {
+ { "all", no_argument, NULL, 'a' },
+ { "blocksize", no_argument, NULL, 'b' },
+ { "exist", required_argument, NULL, 'X' },
+ { "exists", required_argument, NULL, 'X' },
+ { "extended", no_argument, NULL, 'e' },
+ { "help", no_argument, NULL, 'h' },
+ { "keep", no_argument, NULL, 'K' },
+ { "no-glob", no_argument, NULL, 'G' },
+ { "origin", required_argument, NULL, 'O' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "regex", no_argument, NULL, 'x' },
+ { "template", required_argument, NULL, 't' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'P' },
+ { "which", required_argument, NULL, 'W' },
+};
+
int
main(int argc, char **argv)
{
@@ -58,7 +77,7 @@
MatchType = MATCH_ALL;
Flags = SHOW_INDEX;
}
- else while ((ch = getopt(argc, argv, Options)) != -1) {
+ else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch(ch) {
case 'a':
MatchType = MATCH_ALL;
@@ -209,7 +228,6 @@
break;
case 'h':
- case '?':
default:
usage();
break;
More information about the Midnightbsd-cvs
mailing list