[Midnightbsd-cvs] src [12182] trunk/libexec/mport.query/mport.query.c: Add -o flag to print out the origin.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Feb 23 10:41:47 EST 2019
Revision: 12182
http://svnweb.midnightbsd.org/src/?rev=12182
Author: laffer1
Date: 2019-02-23 10:41:46 -0500 (Sat, 23 Feb 2019)
Log Message:
-----------
Add -o flag to print out the origin.
mport.query -oq name=gmake gives
devel/gmake
mport.query -o name=gmake gives
gmake-4.2.1_3 devel/gmake
Modified Paths:
--------------
trunk/libexec/mport.query/mport.query.c
Modified: trunk/libexec/mport.query/mport.query.c
===================================================================
--- trunk/libexec/mport.query/mport.query.c 2019-02-19 00:33:02 UTC (rev 12181)
+++ trunk/libexec/mport.query/mport.query.c 2019-02-23 15:41:46 UTC (rev 12182)
@@ -23,13 +23,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD: src/libexec/mport.query/mport.query.c,v 1.5 2011/06/14 02:22:33 laffer1 Exp $
+ * $MidnightBSD$
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD: src/libexec/mport.query/mport.query.c,v 1.5 2011/06/14 02:22:33 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
#include <stdlib.h>
@@ -51,12 +51,16 @@
mportPackageMeta **packs;
char *where;
int quiet = 0;
+ int origin = 0;
if (argc == 1)
usage();
- while ((ch = getopt(argc, argv, "q")) != -1) {
+ while ((ch = getopt(argc, argv, "oq")) != -1) {
switch (ch) {
+ case 'o':
+ origin = 1;
+ break;
case 'q':
quiet = 1;
break;
@@ -93,8 +97,16 @@
}
while (*packs != NULL) {
- if (!quiet)
- (void)printf("%s-%s\n", (*packs)->name, (*packs)->version);
+ if (quiet && origin) {
+ printf("%s\n", (*packs)->origin);
+ } else if (!quiet) {
+ if (origin) {
+ printf("%s-%s\t\t%s\n", (*packs)->name, (*packs)->version,
+ (*packs)->origin);
+ } else {
+ printf("%s-%s\n", (*packs)->name, (*packs)->version);
+ }
+ }
packs++;
}
@@ -107,7 +119,7 @@
static void
usage(void)
{
- fprintf(stderr, "Usage: mport.query [-q] <query statement>\n");
+ fprintf(stderr, "Usage: mport.query [-oq] <query statement>\n");
exit(2);
}
More information about the Midnightbsd-cvs
mailing list