From owner-freebsd-bugs Sun Feb 20 12:50: 8 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 32CE337BF90 for ; Sun, 20 Feb 2000 12:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA36973; Sun, 20 Feb 2000 12:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from germanium.xtalwind.net (germanium.xtalwind.net [205.160.242.5]) by hub.freebsd.org (Postfix) with ESMTP id E27F437BF5F for ; Sun, 20 Feb 2000 12:43:20 -0800 (PST) (envelope-from jack@germanium.xtalwind.net) Received: (from jack@localhost) by germanium.xtalwind.net (8.9.3/8.9.3) id PAA03763; Sun, 20 Feb 2000 15:43:17 -0500 (EST) Message-Id: <200002202043.PAA03763@germanium.xtalwind.net> Date: Sun, 20 Feb 2000 15:43:17 -0500 (EST) From: jack@germanium.xtalwind.net Reply-To: jack@germanium.xtalwind.net To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/16840: MFC: Matthew D. Fuller's teach pkg_info to deal with full pathnames Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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