Date: Thu, 27 Jun 2013 00:36:22 GMT From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r253583 - in soc2013/mattbw: . tests/licence tests/query Message-ID: <201306270036.r5R0aMsH015707@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mattbw Date: Thu Jun 27 00:36:22 2013 New Revision: 253583 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253583 Log: here are those query tests, I really need to learn how to use svn Added: soc2013/mattbw/tests/licence/lictest.1 soc2013/mattbw/tests/query/ soc2013/mattbw/tests/query/Makefile soc2013/mattbw/tests/query/querytest.1 soc2013/mattbw/tests/query/querytest.c - copied, changed from r253430, soc2013/mattbw/querytest.c Deleted: soc2013/mattbw/querytest.c Added: soc2013/mattbw/tests/licence/lictest.1 ============================================================================== Added: soc2013/mattbw/tests/query/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2013/mattbw/tests/query/Makefile Thu Jun 27 00:36:22 2013 (r253583) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +PROG= querytest +CFLAGS+= `pkgconf --cflags pkg` +LDFLAGS+= `pkgconf --libs pkg` + +.include <bsd.prog.mk> Added: soc2013/mattbw/tests/query/querytest.1 ============================================================================== Copied and modified: soc2013/mattbw/tests/query/querytest.c (from r253430, soc2013/mattbw/querytest.c) ============================================================================== --- soc2013/mattbw/querytest.c Mon Jun 24 17:09:28 2013 (r253430, copy source) +++ soc2013/mattbw/tests/query/querytest.c Thu Jun 27 00:36:22 2013 (r253583) @@ -3,6 +3,7 @@ #include "pkg.h" void handle_it(struct pkgdb_it *it); +int getdb(struct pkgdb **db); int getdb(struct pkgdb **db) @@ -29,6 +30,11 @@ struct pkgdb *db; int err; + if (argc != 2) { + fprintf(stderr, "usage: %s packagename\n", argv[0]); + return 1; + } + db = NULL; err = pkg_init(NULL); @@ -40,12 +46,12 @@ if (err == EPKG_OK) { struct pkgdb_it *it; - it = pkgdb_query(db, "pkg", MATCH_EXACT); + it = pkgdb_query(db, argv[1], MATCH_EXACT); if (it == NULL) printf("no local matches!\n"); else handle_it(it); - it = pkgdb_rquery(db, "pkg", MATCH_EXACT, NULL); + it = pkgdb_rquery(db, argv[1], MATCH_EXACT, NULL); if (it == NULL) printf("no remote matches!\n"); else handle_it(it);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306270036.r5R0aMsH015707>