[Midnightbsd-cvs] src [7496] trunk/usr.sbin/mport/mport.c: dont print out blank lines for CPE info

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 20 23:02:21 EDT 2016


Revision: 7496
          http://svnweb.midnightbsd.org/src/?rev=7496
Author:   laffer1
Date:     2016-03-20 23:02:20 -0400 (Sun, 20 Mar 2016)
Log Message:
-----------
dont print out blank lines for CPE info

Modified Paths:
--------------
    trunk/usr.sbin/mport/mport.c

Modified: trunk/usr.sbin/mport/mport.c
===================================================================
--- trunk/usr.sbin/mport/mport.c	2016-03-20 23:38:57 UTC (rev 7495)
+++ trunk/usr.sbin/mport/mport.c	2016-03-21 03:02:20 UTC (rev 7496)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2010, 2011, 2013, 2014 Lucas Holt
+ * Copyright (c) 2010-2016 Lucas Holt
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -644,6 +644,7 @@
 int
 cpeList(mportInstance *mport) {
 	mportPackageMeta **packs;
+	int cpe_total = 0;
 
 	if (mport_pkgmeta_list(mport, &packs) != MPORT_OK) {
 		warnx("%s", mport_err_string());
@@ -656,11 +657,17 @@
 	}
 
 	while (*packs != NULL) {
-		if ((*packs)->cpe != NULL)
+		if ((*packs)->cpe != NULL && strlen((*packs)->cpe) > 0) {
 			printf("%s\n", (*packs)->cpe);
+			cpe_total++;
+		}
 		packs++;
 	}
 
+	if (cpe_total == 0) {
+		puts("No packages contained CPE information.");
+	}
+
 	mport_pkgmeta_vec_free(packs);
 
 	return (0);



More information about the Midnightbsd-cvs mailing list