Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg which -- pkg_printf()-ify
Matthew Seaman committed 12 years ago
commit b68f7ac1e99f3f5ccf3d41af1a16a04c37871c6e
parent 5d081d5
1 file changed +4 -6
modified pkg/which.c
@@ -51,7 +51,6 @@ exec_which(int argc, char **argv)
	struct pkg *pkg = NULL;
	char pathabs[MAXPATHLEN + 1];
	int ret = EPKG_OK, retcode = EX_OK;
-
	const char *name, *version, *origin;
	int ch;
	bool orig = false;
	bool glob = false;
@@ -95,15 +94,14 @@ exec_which(int argc, char **argv)
		return (EX_IOERR);

	while ((ret = pkgdb_it_next(it, &pkg, PKG_LOAD_BASIC)) == EPKG_OK) {
-
		pkg_get(pkg, PKG_NAME, &name, PKG_VERSION, &version, PKG_ORIGIN, &origin);
		if (quiet && orig)
-
			printf("%s\n", origin);
+
			pkg_printf("%o\n", pkg);
		else if (quiet && !orig)
-
			printf("%s-%s\n", name, version);
+
			pkg_printf("%n-%v\n", pkg, pkg);
		else if (!quiet && orig)
-
			printf("%s was installed by package %s\n", pathabs, origin);
+
			pkg_printf("%S was installed by package %o\n", pathabs, pkg);
		else if (!quiet && !orig)
-
			printf("%s was installed by package %s-%s\n", pathabs, name, version);
+
			pkg_printf("%S was installed by package %n-%v\n", pathabs, pkg, pkg);
		if (!glob)
			break;
	}