RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 10-May-2017 19:05:20 Branch: rpm-5_4 Handle: 2017051017052000 Added files: (Branch: rpm-5_4) rpm/rpmio tcap.c Modified files: (Branch: rpm-5_4) rpm/rpmio Makefile.am Log: - cap: test program. Summary: Revision Changes Path 1.293.2.79 +4 -1 rpm/rpmio/Makefile.am 1.1.2.1 +51 -0 rpm/rpmio/tcap.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/Makefile.am ============================================================================ $ cvs diff -u -r1.293.2.78 -r1.293.2.79 Makefile.am --- rpm/rpmio/Makefile.am 4 May 2017 20:55:39 -0000 1.293.2.78 +++ rpm/rpmio/Makefile.am 10 May 2017 17:05:20 -0000 1.293.2.79 @@ -26,7 +26,7 @@ EXTRA_PROGRAMS += bsdiff bspatch pcrsed rpmborg rpmcurl \ rpmgenbasedir rpmgenpkglist rpmgensrclist rpmgpg \ rpmpbzip2 rpmpigz \ - tasn tbf tder tdir tfts tget tglob thkp tmagic \ + tasn tbf tcap tder tdir tfts tget tglob thkp tmagic \ tmire todbc toid tperl tpython tput trpmio tsexp tsvn tsw ttcl \ dumpasn1 lookup3 trel twitter github tmicrojson @@ -556,6 +556,9 @@ tblake2sp.o: blake2sp.c @$(LTCOMPILE) -I${top_srcdir} -DBLAKE2SP_SELFTEST -o $@ -c $< +tcap_SOURCES = tcap.c +tcap_LDADD = $(RPMIO_LDADD_COMMON) + tder_SOURCES = tder.c tder_LDADD = $(RPMIO_LDADD_COMMON) @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/tcap.c ============================================================================ $ cvs diff -u -r0 -r1.1.2.1 tcap.c --- /dev/null 2017-05-10 19:04:11.000000000 +0200 +++ tcap.c 2017-05-10 19:05:20.478581768 +0200 @@ -0,0 +1,51 @@ +/** + * \file rpmio/tcap.c + */ + +#include "system.h" +#include <rpmio.h> +#include <poptIO.h> +#include <argv.h> +#include <rpmcap.h> +#include "debug.h" + +static int _debug = 0; + +static struct poptOption rpmcapOptionsTable[] = { + { "debug", 'd', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_debug, 1, + NULL, NULL }, + + { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmioAllPoptTable, 0, + N_(" Common options for all rpmio executables:"), NULL }, + + POPT_AUTOALIAS + POPT_AUTOHELP + POPT_TABLEEND +}; + +int +main(int argc, char *argv[]) +{ + poptContext con = rpmioInit(argc, argv, rpmcapOptionsTable); + ARGV_t av = poptGetArgs(con); + int ac = argvCount(av);; + pid_t pid = getpid(); + char * text; + int rc; + int ec = 0; + + text = rpmcapGetP(pid); +fprintf(stderr, "*** rpmcapGetP(%u) \"%s\"\n", (unsigned)pid, text); + if (text) free(text); + + rc = rpmcapDrop("cap_chown"); + + for (int i = 0; i < ac; i++) { + const char * arg = av[i]; + rc = rpmcapTest(arg); +fprintf(stderr, "*** rpmcapGet(%s): %d\n", arg, rc); + } + + con = rpmioFini(con); + return ec; +} @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
