Date: Sun, 20 Feb 2000 15:43:17 -0500 (EST) From: jack@germanium.xtalwind.net To: FreeBSD-gnats-submit@freebsd.org Subject: misc/16840: MFC: Matthew D. Fuller's teach pkg_info to deal with full pathnames Message-ID: <200002202043.PAA03763@germanium.xtalwind.net>
next in thread | raw e-mail | index | archive | help
>Number: 16840
>Category: misc
>Synopsis: MFC: Matthew D. Fuller's teach pkg_info to deal with full pathnames
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Feb 20 12:50:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:
>Release: FreeBSD 3.4-STABLE i386
>Organization:
>Environment:
>Description:
MFC Matthew D. Fuller's patch to teach pkg_info how to deal with full
pathnames. Also add `t' to Options[] list, and add to usage(). Add
t template to SYNOPSIS in manpage.
>How-To-Repeat:
>Fix:
--- main.c.orig Sun Aug 29 11:45:23 1999
+++ main.c Sun Feb 20 15:25:02 2000
@@ -28,7 +28,7 @@
#include "lib.h"
#include "info.h"
-static char Options[] = "acdDe:fikrRpLqImvhl:";
+static char Options[] = "acdDe:fhiIkl:LmpqrRt:v";
int Flags = 0;
Boolean AllInstalled = FALSE;
@@ -44,6 +44,7 @@
{
int ch;
char **pkgs, **start;
+ char *pkgs_split;
pkgs = start = argv;
if (argc == 1) {
@@ -143,9 +144,26 @@
Flags = SHOW_COMMENT | SHOW_DESC | SHOW_REQBY;
/* Get all the remaining package names, if any */
- while (*argv)
- *pkgs++ = *argv++;
-
+ while (*argv) {
+ if( (pkgs_split = rindex(*argv, (int) '/')) != NULL ) {
+ while( !isalpha(*(pkgs_split+1)) ) {
+ *pkgs_split = '\0';
+ if ( (pkgs_split = rindex(*argv, (int) '/')) == NULL)
+ pkgs_split = *argv;
+ }
+ if(pkgs_split != NULL) {
+ if (*pkgs_split == '/')
+ pkgs_split++;
+ *pkgs = pkgs_split;
+ pkgs++;
+ }
+ }
+ else {
+ *pkgs = *argv;
+ pkgs++;
+ }
+ argv++;
+ }
/* If no packages, yelp */
if (pkgs == start && !AllInstalled && !CheckPkg)
warnx("missing package name(s)"), usage();
@@ -158,7 +176,7 @@
{
fprintf(stderr, "%s\n%s\n%s\n",
"usage: pkg_info [-cdDikrRpLqImv] [-e package] [-l prefix]",
- " pkg-name [pkg-name ...]",
+ " [-t template] pkg-name [pkg-name ...]",
" pkg_info -a [flags]");
exit(1);
}
--- pkg_info.1.orig Sun Aug 29 11:45:24 1999
+++ pkg_info.1 Sun Feb 20 15:32:13 2000
@@ -28,6 +28,7 @@
.Op Fl cdDikrRpLqImv
.Op Fl e Ar package
.Op Fl l Ar prefix
+.Op Fl t Ar template
.Ar pkg-name [pkg-name ...]
.Nm pkg_info
.Fl a
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200002202043.PAA03763>
