Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Implement pkg shlib -q
Baptiste Daroussin committed 11 years ago
commit f2c3489ec70f57618c8e844afe640d9acd856589
parent 9ea03ff
1 file changed +8 -4
modified src/shlib.c
@@ -42,7 +42,7 @@
void
usage_shlib(void)
{
-
	fprintf(stderr, "Usage: pkg shlib [-P|R] <library>\n\n");
+
	fprintf(stderr, "Usage: pkg shlib [-q] [-P|R] <library>\n\n");
	fprintf(stderr, "<library> should be a filename without leading path.\n");
	fprintf(stderr, "For more information see 'pkg help shlib'.\n");
}
@@ -83,7 +83,7 @@ pkgs_providing_lib(struct pkgdb *db, const char *libname)
	}

	while ((ret = pkgdb_it_next(it, &pkg, PKG_LOAD_BASIC)) == EPKG_OK) {
-
		if (count == 0)
+
		if (count == 0 && !quiet)
			printf("%s is provided by the following packages:\n",
			       libname);
		count++;
@@ -91,7 +91,7 @@ pkgs_providing_lib(struct pkgdb *db, const char *libname)
	}

	if (ret == EPKG_END) {
-
		if (count == 0)
+
		if (count == 0 && !quiet)
			printf("No packages provide %s.\n", libname);
		ret = EPKG_OK;
	}
@@ -147,10 +147,11 @@ exec_shlib(int argc, char **argv)
	struct option longopts[] = {
		{ "provides",	no_argument,	NULL,	'P' },
		{ "requires",	no_argument,	NULL,	'R' },
+
		{ "quiet" ,	no_argument,	NULL,	'q' },
		{ NULL,		0,		NULL,	0 },
	};

-
	while ((ch = getopt_long(argc, argv, "+PR", longopts, NULL)) != -1) {
+
	while ((ch = getopt_long(argc, argv, "+qPR", longopts, NULL)) != -1) {
		switch (ch) {
		case 'P':
			provides_only = true;
@@ -158,6 +159,9 @@ exec_shlib(int argc, char **argv)
		case 'R':
			requires_only = true;
			break;
+
		case 'q':
+
			quiet = true;
+
			break;
		default:
			usage_shlib();
			return (EX_USAGE);