[Midnightbsd-cvs] src [12188] stable/1.0/libexec: MFC: mport origin feature for info and query
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Feb 23 17:11:31 EST 2019
Revision: 12188
http://svnweb.midnightbsd.org/src/?rev=12188
Author: laffer1
Date: 2019-02-23 17:11:31 -0500 (Sat, 23 Feb 2019)
Log Message:
-----------
MFC: mport origin feature for info and query
Modified Paths:
--------------
stable/1.0/libexec/mport.info/mport.info.c
stable/1.0/libexec/mport.query/mport.query.c
Modified: stable/1.0/libexec/mport.info/mport.info.c
===================================================================
--- stable/1.0/libexec/mport.info/mport.info.c 2019-02-23 22:10:34 UTC (rev 12187)
+++ stable/1.0/libexec/mport.info/mport.info.c 2019-02-23 22:11:31 UTC (rev 12188)
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD: src/libexec/mport.info/mport.info.c,v 1.3 2011/03/06 19:58:25 laffer1 Exp $");
+__MBSDID("$MidnightBSD$");
#include <stdlib.h>
#include <stdio.h>
@@ -46,9 +46,13 @@
mportPackageMeta **packs;
bool quiet = false;
bool verbose = false;
+ bool origin = false;
- while ((ch = getopt(argc, argv, "qv")) != -1) {
+ while ((ch = getopt(argc, argv, "oqv")) != -1) {
switch (ch) {
+ case 'o':
+ origin = true;
+ break;
case 'q':
quiet = true;
break;
@@ -94,8 +98,14 @@
printf("The following installed package(s) has %s origin:\n", argv[0]);
while (*packs != NULL) {
- if (strcmp(argv[0], (*packs)->origin) == 0)
- printf("%s-%s\n", (*packs)->name, (*packs)->version);
+ if (strcmp(argv[0], (*packs)->origin) == 0) {
+ 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++;
}
@@ -109,6 +119,6 @@
static void
usage(void)
{
- fprintf(stderr, "Usage: mport.info [-q | -v] <origin>\n");
+ fprintf(stderr, "Usage: mport.info [-o | -q | -v] <origin>\n");
exit(2);
}
Modified: stable/1.0/libexec/mport.query/mport.query.c
===================================================================
--- stable/1.0/libexec/mport.query/mport.query.c 2019-02-23 22:10:34 UTC (rev 12187)
+++ stable/1.0/libexec/mport.query/mport.query.c 2019-02-23 22:11:31 UTC (rev 12188)
@@ -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