Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
pkg info is compatible with basic usage from bsd.port.mk
Baptiste Daroussin committed 15 years ago
commit b2cfdad6c854f157c2be93837d3f61d642040cde
parent e14054274d061689dac1e1f0ca324a19e51b360f
1 file changed +16 -0
modified pkg/info.c
@@ -6,8 +6,10 @@
#include <libutil.h>
#include <unistd.h>
#include <stdio.h>
+
#include <stdbool.h>
#include <pkg.h>
#include <string.h>
+
#include <sysexits.h>

#include "info.h"

@@ -89,6 +91,7 @@ exec_info(int argc, char **argv)
	char ch;
	size_t i;
	int retcode = 0;
+
	bool gotone = false;

	/* TODO: exclusive opts ? */
	while ((ch = getopt(argc, argv, "egxXdrlsqO")) != -1) {
@@ -149,9 +152,19 @@ exec_info(int argc, char **argv)
		return (-1);
	}

+
	/* this is place for compatibility hacks */
+

+
	/* ports infrastructure expects pkg info -q -O to always return 0 even
+
	 * if the ports doesn't exists */
+
	if (opt & INFO_ORIGIN)
+
		gotone = true;
+

+

+
	/* end of compatibility hacks */
	pkg_new(&pkg);

	while (pkgdb_it_next_pkg(it, &pkg, query_flags) == 0) {
+
		gotone = true;

		if (opt & INFO_EXISTS) {
			retcode = 0;
@@ -202,6 +215,9 @@ exec_info(int argc, char **argv)
		retcode = -1;
	}

+
	if (retcode == 0 && !gotone)
+
		retcode = EX_SOFTWARE;
+

	pkgdb_it_free(it);
	pkgdb_close(db);
	return (retcode);