summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--Makefile.am1
-rw-r--r--lib/poptK.c2
-rw-r--r--lib/rpmcli.h3
-rwxr-xr-xpopt/configure.in2
-rw-r--r--popt/popt.c185
-rw-r--r--popt/popt.h36
-rw-r--r--popt/poptconfig.c78
-rw-r--r--popt/popthelp.c180
-rw-r--r--popt/poptint.h14
-rw-r--r--python/rpmmodule.c64
-rw-r--r--rpmio/rpmio.h80
-rw-r--r--rpmpopt.in123
-rwxr-xr-xrpmqv.c10
14 files changed, 520 insertions, 262 deletions
diff --git a/CHANGES b/CHANGES
index 373c0257c..3cc17c9c2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -152,7 +152,9 @@
- expose rpmShowProgress() and rpmVerifyDigest() in rpmcli.h.
- portability: avoid st_mtime, gendiff uses basename, etc (#47497).
- glibc-2.0.x has not __va_copy().
- - popthelp.c: static copy of stpcpy/stpncpy for the deprived (#47500).
+ - popthelp.c: don't use stpcpy to avoid portability grief (#47500).
+ - permit alias/exec description/arg text to be set from popt config.
+ - use rpmqv.c, not rpm.c, as rpm's main() routine.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.
diff --git a/Makefile.am b/Makefile.am
index b48385565..29f198953 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -187,7 +187,6 @@ setperms:
@$(__CHOWN) -R ${RPMUSER}.${RPMGROUP} $(DESTDIR)$(varprefix)/lib/rpm
-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/[A-Z]*
-@$(__CHMOD) 0775 $(DESTDIR)$(varprefix)/lib/rpm
- -@$(__CHMOD) 0755 $(DESTDIR)$(varprefix)/lib/rpm/Desktop
-@$(__CHMOD) 0664 $(DESTDIR)$(varprefix)/lib/rpm/__db.*
.PHONY: unsetgid
diff --git a/lib/poptK.c b/lib/poptK.c
index 91f8e2ad4..ed532f8dd 100644
--- a/lib/poptK.c
+++ b/lib/poptK.c
@@ -10,7 +10,7 @@
#include "debug.h"
struct rpmSignArguments_s rpmKArgs =
- { RESIGN_CHK_SIGNATURE, CHECKSIG_ALL, 0, NULL };
+ { RESIGN_NONE, CHECKSIG_ALL, 0, NULL };
#define POPT_ADDSIGN 1005
#define POPT_RESIGN 1006
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index 520c19536..f48cd39bf 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -484,7 +484,8 @@ int rpmCheckSig(rpmCheckSigFlags flags, /*@null@*/ const char ** argv)
* Bit(s) to control rpmReSign() operation.
*/
typedef enum rpmResignFlags_e {
- RESIGN_CHK_SIGNATURE = 0, /*!< from --checksig */
+ RESIGN_NONE = 0,
+ RESIGN_CHK_SIGNATURE = 1, /*!< from --checksig */
RESIGN_NEW_SIGNATURE, /*!< from --resign */
RESIGN_ADD_SIGNATURE /*!< from --addsign */
} rpmResignFlags;
diff --git a/popt/configure.in b/popt/configure.in
index 02f54eb74..bb7fbfd82 100755
--- a/popt/configure.in
+++ b/popt/configure.in
@@ -72,8 +72,6 @@ then
fi
AC_CHECK_FUNCS(strerror mtrace)
-dnl AC_CHECK_FUNCS(gettext)
-dnl AC_CHECK_FUNCS(dgettext)
AC_CHECK_FUNC(setreuid, [], [
AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
])
diff --git a/popt/popt.c b/popt/popt.c
index a5672c498..c4fa4eea0 100644
--- a/popt/popt.c
+++ b/popt/popt.c
@@ -233,21 +233,24 @@ static int handleExec(/*@special@*/ poptContext con,
con->finalArgv, con->finalArgvAlloced, con->finalArgvCount @*/
/*@modifies con @*/
{
+ poptItem item;
int i;
if (con->execs == NULL || con->numExecs <= 0) /* XXX can't happen */
return 0;
- i = con->numExecs - 1;
- if (longName) {
- while (i >= 0 && (!con->execs[i].longName ||
- strcmp(con->execs[i].longName, longName))) i--;
- } else {
- while (i >= 0 &&
- con->execs[i].shortName != shortName) i--;
- }
+ for (i = con->numExecs - 1; i >= 0; i--) {
+ item = con->execs + i;
+ if (longName && !(item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ continue;
+ else if (shortName != item->option.shortName)
+ continue;
+ break;
+ }
if (i < 0) return 0;
+
if (con->flags & POPT_CONTEXT_NO_EXEC)
return 1;
@@ -286,33 +289,34 @@ static int handleExec(/*@special@*/ poptContext con,
static int handleAlias(/*@special@*/ poptContext con,
/*@null@*/ const char * longName, char shortName,
/*@keep@*/ /*@null@*/ const char * nextCharArg)
- /*@uses con->aliases, con->numAliases, con->optionStack,
- con->os, con->os->currAlias, con->os->currAlias->longName @*/
+ /*@uses con->aliases, con->numAliases, con->optionStack, con->os,
+ con->os->currAlias, con->os->currAlias->option.longName @*/
/*@modifies con @*/
{
+ poptItem item = con->os->currAlias;
int rc;
int i;
- if (con->os->currAlias && con->os->currAlias->longName && longName &&
- /*@-nullpass@*/ /* LCL: con->os->currAlias->longName != NULL */
- !strcmp(con->os->currAlias->longName, longName))
- /*@=nullpass@*/
- return 0;
- if (con->os->currAlias && shortName &&
- shortName == con->os->currAlias->shortName)
- return 0;
+ if (item) {
+ if (longName && (item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ return 0;
+ if (shortName && shortName == item->option.shortName)
+ return 0;
+ }
if (con->aliases == NULL || con->numAliases <= 0) /* XXX can't happen */
return 0;
- i = con->numAliases - 1;
- if (longName) {
- while (i >= 0 && (!con->aliases[i].longName ||
- strcmp(con->aliases[i].longName, longName))) i--;
- } else {
- while (i >= 0 &&
- con->aliases[i].shortName != shortName) i--;
- }
+ for (i = con->numAliases - 1; i >= 0; i--) {
+ item = con->aliases + i;
+ if (longName && !(item->option.longName &&
+ !strcmp(longName, item->option.longName)))
+ continue;
+ else if (shortName != item->option.shortName)
+ continue;
+ break;
+ }
if (i < 0) return 0;
if ((con->os - con->optionStack + 1) == POPT_OPTION_DEPTH)
@@ -337,37 +341,34 @@ static int handleAlias(/*@special@*/ poptContext con,
static int execCommand(poptContext con)
/*@modifies fileSystem @*/
{
+ poptItem item = con->doExec;
const char ** argv;
int argc = 0;
- const char ** sargv;
- int sargc = 0;
int rc;
- if (con->doExec == NULL || con->doExec->script == NULL) /*XXX can't happen*/
+ if (item == NULL) /*XXX can't happen*/
return POPT_ERROR_NOARG;
- rc = poptParseArgvString(con->doExec->script, &sargc, &sargv);
- if (rc) return rc;
- if (sargv == NULL || sargc < 1 ||
- (!con->execAbsolute && strchr(sargv[0], '/')))
+ if (item->argv == NULL || item->argc < 1 ||
+ (!con->execAbsolute && strchr(item->argv[0], '/')))
return POPT_ERROR_NOARG;
argv = malloc(sizeof(*argv) *
- (6 + sargc + con->numLeftovers + con->finalArgvCount));
+ (6 + item->argc + con->numLeftovers + con->finalArgvCount));
if (argv == NULL) return POPT_ERROR_MALLOC; /* XXX can't happen */
- if (!strchr(sargv[0], '/') && con->execPath) {
- char *s = alloca(strlen(con->execPath) + strlen(sargv[0]) + sizeof("/"));
- sprintf(s, "%s/%s", con->execPath, sargv[0]);
+ if (!strchr(item->argv[0], '/') && con->execPath) {
+ char *s = alloca(strlen(con->execPath) + strlen(item->argv[0]) + sizeof("/"));
+ sprintf(s, "%s/%s", con->execPath, item->argv[0]);
argv[argc] = s;
} else {
- argv[argc] = findProgramPath(sargv[0]);
+ argv[argc] = findProgramPath(item->argv[0]);
}
if (argv[argc++] == NULL) return POPT_ERROR_NOARG;
- if (sargc > 1) {
- memcpy(argv + argc, sargv + 1, sizeof(*argv) * (sargc - 1));
- argc += (sargc - 1);
+ if (item->argc > 1) {
+ memcpy(argv + argc, item->argv + 1, sizeof(*argv) * (item->argc - 1));
+ argc += (item->argc - 1);
}
if (con->finalArgv != NULL && con->finalArgvCount > 0) {
@@ -387,7 +388,8 @@ static int execCommand(poptContext con)
argv[argc] = NULL;
#ifdef __hpux
- (void) setresuid(getuid(), getuid(),-1);
+ rc = setresuid(getuid(), getuid(),-1);
+ if (rc) return POPT_ERROR_ERRNO;
#else
/*
* XXX " ... on BSD systems setuid() should be preferred over setreuid()"
@@ -395,9 +397,11 @@ static int execCommand(poptContext con)
* XXX from Norbert Warmuth <nwarmuth@privat.circular.de>
*/
#if defined(HAVE_SETUID)
- (void) setuid(getuid());
+ rc = setuid(getuid());
+ if (rc) return POPT_ERROR_ERRNO;
#elif defined (HAVE_SETREUID)
- (void) setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
+ rc = setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
+ if (rc) return POPT_ERROR_ERRNO;
#else
; /* Can't drop privileges */
#endif
@@ -414,7 +418,7 @@ static int execCommand(poptContext con)
}
#endif
- (void) execvp(argv[0], (char *const *)argv);
+ rc = execvp(argv[0], (char *const *)argv);
return POPT_ERROR_ERRNO;
}
@@ -975,6 +979,7 @@ const char ** poptGetArgs(poptContext con)
poptContext poptFreeContext(poptContext con)
{
+ poptItem item;
int i;
if (con == NULL) return con;
@@ -983,21 +988,31 @@ poptContext poptFreeContext(poptContext con)
if (con->aliases != NULL)
for (i = 0; i < con->numAliases; i++) {
- con->aliases[i].longName = _free(con->aliases[i].longName);
- con->aliases[i].argv = _free(con->aliases[i].argv);
+ item = con->aliases + i;
+ /*@-modobserver -observertrans -dependenttrans@*/
+ item->option.longName = _free(item->option.longName);
+ item->option.descrip = _free(item->option.descrip);
+ item->option.argDescrip = _free(item->option.argDescrip);
+ /*@=modobserver =observertrans =dependenttrans@*/
+ item->argv = _free(item->argv);
}
+ con->aliases = _free(con->aliases);
if (con->execs != NULL)
for (i = 0; i < con->numExecs; i++) {
- con->execs[i].longName = _free(con->execs[i].longName);
- con->execs[i].script = _free(con->execs[i].script);
+ item = con->execs + i;
+ /*@-modobserver -observertrans -dependenttrans@*/
+ item->option.longName = _free(item->option.longName);
+ item->option.descrip = _free(item->option.descrip);
+ item->option.argDescrip = _free(item->option.argDescrip);
+ /*@=modobserver =observertrans =dependenttrans@*/
+ item->argv = _free(item->argv);
}
con->execs = _free(con->execs);
con->leftovers = _free(con->leftovers);
con->finalArgv = _free(con->finalArgv);
con->appName = _free(con->appName);
- con->aliases = _free(con->aliases);
con->otherHelp = _free(con->otherHelp);
con->execPath = _free(con->execPath);
con->arg_strip = PBM_FREE(con->arg_strip);
@@ -1009,28 +1024,60 @@ poptContext poptFreeContext(poptContext con)
int poptAddAlias(poptContext con, struct poptAlias newAlias,
/*@unused@*/ int flags)
{
- int aliasNum = con->numAliases++;
+ poptItem item = alloca(sizeof(*item));
+ memset(item, 0, sizeof(*item));
+ item->option.longName = newAlias.longName;
+ item->option.shortName = newAlias.shortName;
+ item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
+ item->option.arg = 0;
+ item->option.val = 0;
+ item->option.descrip = NULL;
+ item->option.argDescrip = NULL;
+ item->argc = newAlias.argc;
+ item->argv = newAlias.argv;
+ return poptAddItem(con, item, 0);
+}
- /* SunOS won't realloc(NULL, ...) */
- if (con->aliases == NULL)
- con->aliases = malloc(con->numAliases * sizeof(newAlias));
- else
- con->aliases = realloc(con->aliases,
- con->numAliases * sizeof(newAlias));
-
- if (con->aliases) {
- struct poptAlias * alias = con->aliases + aliasNum;
-
- alias->longName = (newAlias.longName)
- /*@-nullpass@*/ /* FIX: malloc can return NULL. */
- ? strcpy(malloc(strlen(newAlias.longName) + 1), newAlias.longName)
- /*@=nullpass@*/
- : NULL;
- alias->shortName = newAlias.shortName;
- alias->argc = newAlias.argc;
- alias->argv = newAlias.argv;
+int poptAddItem(poptContext con, poptItem newItem, int flags)
+{
+ poptItem * items, item;
+ int * nitems;
+
+ switch (flags) {
+ case 1:
+ items = &con->execs;
+ nitems = &con->numExecs;
+ break;
+ case 0:
+ items = &con->aliases;
+ nitems = &con->numAliases;
+ break;
+ default:
+ return 1;
+ /*@notreached@*/ break;
}
+ *items = realloc((*items), ((*nitems) + 1) * sizeof(**items));
+ if ((*items) == NULL)
+ return 1;
+
+ item = (*items) + (*nitems);
+
+ item->option.longName =
+ (newItem->option.longName ? xstrdup(newItem->option.longName) : NULL);
+ item->option.shortName = newItem->option.shortName;
+ item->option.argInfo = newItem->option.argInfo;
+ item->option.arg = newItem->option.arg;
+ item->option.val = newItem->option.val;
+ item->option.descrip =
+ (newItem->option.descrip ? xstrdup(newItem->option.descrip) : NULL);
+ item->option.argDescrip =
+ (newItem->option.argDescrip ? xstrdup(newItem->option.argDescrip) : NULL);
+ item->argc = newItem->argc;
+ item->argv = newItem->argv;
+
+ (*nitems)++;
+
return 0;
}
diff --git a/popt/popt.h b/popt/popt.h
index a4c60e998..cf614988a 100644
--- a/popt/popt.h
+++ b/popt/popt.h
@@ -126,6 +126,7 @@ struct poptOption {
};
/** \ingroup popt
+ * A popt alias argument for poptAddAlias().
*/
struct poptAlias {
/*@owned@*/ /*@null@*/ const char * longName; /*!< may be NULL */
@@ -135,12 +136,33 @@ struct poptAlias {
};
/** \ingroup popt
+ * A popt alias or exec argument for poptAddItem().
+ */
+typedef struct poptItem_s {
+ struct poptOption option; /*!< alias/exec name(s) and description. */
+ int argc; /*!< (alias) no. of args. */
+/*@owned@*/ const char ** argv; /*!< (alias) args, must be free()able. */
+} * poptItem;
+
+/** \ingroup popt
* \name Auto-generated help/usage
*/
/*@{*/
+
+/**
+ * Empty table marker to enable displaying popt alias/exec options.
+ */
+extern struct poptOption poptAliasOptions[];
+#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \
+ 0, "Options implemented via popt alias/exec:", NULL },
+
+/**
+ * Auto help table options.
+ */
extern struct poptOption poptHelpOptions[];
#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
0, "Help options:", NULL },
+
#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
/*@}*/
@@ -268,15 +290,27 @@ int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv)
/** \ingroup popt
* Add alias to context.
* @todo Pass alias by reference, not value.
+ * @deprecated Use poptAddItem instead.
* @param con context
* @param alias alias to add
* @param flags (unused)
- * @return 0 always
+ * @return 0 on success
*/
+/*@unused@*/
int poptAddAlias(poptContext con, struct poptAlias alias, int flags)
/*@modifies con @*/;
/** \ingroup popt
+ * Add alias/exec item to context.
+ * @param con context
+ * @param item alias/exec item to add
+ * @param flags 0 for alias, 1 for exec
+ * @return 0 on success
+ */
+int poptAddItem(poptContext con, poptItem newItem, int flags)
+ /*@modifies con @*/;
+
+/** \ingroup popt
* Read configuration file.
* @param con context
* @param fn file name to read
diff --git a/popt/poptconfig.c b/popt/poptconfig.c
index 8fddbcdf7..6aafde893 100644
--- a/popt/poptconfig.c
+++ b/popt/poptconfig.c
@@ -9,61 +9,73 @@
#include "system.h"
#include "poptint.h"
-/*@-mustmod@*/ /* LCL: *line is modified @*/
+/*@-compmempass@*/ /* FIX: item->option.longName kept, not dependent. */
static void configLine(poptContext con, char * line)
- /*@modifies *line, con->execs, con->numExecs @*/
+ /*@modifies con @*/
{
int nameLength = strlen(con->appName);
- const char * opt;
- struct poptAlias alias;
const char * entryType;
- const char * longName = NULL;
- char shortName = '\0';
+ const char * opt;
+ poptItem item = alloca(sizeof(*item));
+ int i, j;
+ memset(item, 0, sizeof(*item));
+
if (strncmp(line, con->appName, nameLength)) return;
line += nameLength;
if (*line == '\0' || !isspace(*line)) return;
+
while (*line != '\0' && isspace(*line)) line++;
entryType = line;
-
while (*line == '\0' || !isspace(*line)) line++;
*line++ = '\0';
+
while (*line != '\0' && isspace(*line)) line++;
if (*line == '\0') return;
opt = line;
+ if (opt[0] == '-' && opt[1] == '-')
+ item->option.longName = opt + 2;
+ else if (opt[0] == '-' && !opt[2])
+ item->option.shortName = opt[1];
while (*line == '\0' || !isspace(*line)) line++;
*line++ = '\0';
while (*line != '\0' && isspace(*line)) line++;
if (*line == '\0') return;
-
- if (opt[0] == '-' && opt[1] == '-')
- longName = opt + 2;
- else if (opt[0] == '-' && !opt[2])
- shortName = opt[1];
-
- if (!strcmp(entryType, "alias")) {
- if (poptParseArgvString(line, &alias.argc, &alias.argv)) return;
- alias.longName = longName, alias.shortName = shortName;
- (void) poptAddAlias(con, alias, 0);
- } else if (!strcmp(entryType, "exec")) {
- con->execs = realloc(con->execs,
- sizeof(*con->execs) * (con->numExecs + 1));
- if (con->execs == NULL) return; /* XXX can't happen */
- if (longName)
- con->execs[con->numExecs].longName = xstrdup(longName);
- else
- con->execs[con->numExecs].longName = NULL;
-
- con->execs[con->numExecs].shortName = shortName;
- con->execs[con->numExecs].script = xstrdup(line);
-
- /*@-noeffect@*/ /* LCL: broken? */
- con->numExecs++;
- /*@=noeffect@*/
+ if (poptParseArgvString(line, &item->argc, &item->argv)) return;
+
+ /*@-modobserver@*/
+ item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
+ for (i = 0, j = 0; i < item->argc; i++, j++) {
+ const char * f;
+ if (!strncmp(item->argv[i], "--POPTdesc=", sizeof("--POPTdesc=")-1)) {
+ f = item->argv[i] + sizeof("--POPTdesc=");
+ if (f[0] == '$' && f[1] == '"') f++;
+ item->option.descrip = f;
+ item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
+ j--;
+ } else
+ if (!strncmp(item->argv[i], "--POPTargs=", sizeof("--POPTargs=")-1)) {
+ f = item->argv[i] + sizeof("--POPTargs=");
+ if (f[0] == '$' && f[1] == '"') f++;
+ item->option.argDescrip = f;
+ item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
+ item->option.argInfo |= POPT_ARG_STRING;
+ j--;
+ } else
+ if (j != i)
+ item->argv[j] = item->argv[i];
}
+ if (j != i)
+ item->argv[j] = NULL;
+ /*@=modobserver@*/
+
+ if (!strcmp(entryType, "alias"))
+ (void) poptAddItem(con, item, 0);
+ else if (!strcmp(entryType, "exec"))
+ (void) poptAddItem(con, item, 1);
}
-/*@=mustmod@*/
+/*@=compmempass@*/
int poptReadConfigFile(poptContext con, const char * fn)
{
diff --git a/popt/popthelp.c b/popt/popthelp.c
index b63a15ea9..d94b98ed0 100644
--- a/popt/popthelp.c
+++ b/popt/popthelp.c
@@ -11,6 +11,10 @@
#include "system.h"
#include "poptint.h"
+/**
+ * @param con context
+ * @param key option(s)
+ */
static void displayArgs(poptContext con,
/*@unused@*/ enum poptCallbackReason foo,
struct poptOption * key,
@@ -26,6 +30,17 @@ static void displayArgs(poptContext con,
#ifdef NOTYET
static int show_option_defaults = 0;
#endif
+
+/**
+ * Empty table marker to enable displaying popt alias/exec options.
+ */
+struct poptOption poptAliasOptions[] = {
+ POPT_TABLEEND
+};
+
+/**
+ * Auto help table options.
+ */
/*@-castfcnptr@*/
struct poptOption poptHelpOptions[] = {
{ NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
@@ -39,6 +54,9 @@ struct poptOption poptHelpOptions[] = {
} ;
/*@=castfcnptr@*/
+/**
+ * @param table option(s)
+ */
/*@observer@*/ /*@null@*/ static const char *const
getTableTranslationDomain(/*@null@*/ const struct poptOption *table)
/*@*/
@@ -53,6 +71,10 @@ getTableTranslationDomain(/*@null@*/ const struct poptOption *table)
return NULL;
}
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
/*@observer@*/ /*@null@*/ static const char *const
getArgDescrip(const struct poptOption * opt,
/*@-paramuse@*/ /* FIX: wazzup? */
@@ -79,7 +101,12 @@ getArgDescrip(const struct poptOption * opt,
}
}
-static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
+static /*@only@*/ /*@null@*/ char *
+singleOptionDefaultValue(int lineLength,
const struct poptOption * opt,
/*@-paramuse@*/ /* FIX: i18n macros disable with lclint */
/*@null@*/ const char * translation_domain)
@@ -93,7 +120,7 @@ static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
if (l == NULL) return NULL; /* XXX can't happen */
*le = '\0';
*le++ = '(';
- le = stpcpy(le, defstr);
+ strcpy(le, defstr); le += strlen(le);
*le++ = ':';
*le++ = ' ';
if (opt->arg) /* XXX programmer error */
@@ -117,14 +144,15 @@ static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
} break;
case POPT_ARG_STRING:
{ const char * s = *(const char **)opt->arg;
- if (s == NULL)
- le = stpcpy(le, "null");
- else {
+ if (s == NULL) {
+ strcpy(le, "null"); le += strlen(le);
+ } else {
size_t slen = 4*lineLength - (le - l) - sizeof("\"...\")");
*le++ = '"';
- le = stpncpy(le, s, slen);
- if (slen < strlen(s))
- le = stpcpy(le, "...");
+ strncpy(le, s, slen); le[slen] = '\0'; le += strlen(le);
+ if (slen < strlen(s)) {
+ strcpy(le, "..."); le += strlen(le);
+ }
*le++ = '"';
}
} break;
@@ -140,6 +168,11 @@ static /*@only@*/ /*@null@*/ char * singleOptionDefaultValue(int lineLength,
return l;
}
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static void singleOptionHelp(FILE * fp, int maxLeftCol,
const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
@@ -189,8 +222,11 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
if (t) {
char * te = t;
*te = '\0';
- if (help) te = stpcpy(te, help);
- (void) stpcpy( stpcpy( te, " "), defs);
+ if (help) {
+ strcpy(te, help); te += strlen(te);
+ }
+ *te++ = ' ';
+ strcpy(te, defs);
defs = _free(defs);
}
defs = t;
@@ -227,14 +263,14 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol,
case POPT_ARG_DOUBLE:
case POPT_ARG_STRING:
*le++ = '=';
- le = stpcpy(le, argDescrip);
+ strcpy(le, argDescrip); le += strlen(le);
break;
default:
break;
}
} else {
*le++ = '=';
- le = stpcpy(le, argDescrip);
+ strcpy(le, argDescrip); le += strlen(le);
}
if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
*le++ = ']';
@@ -278,6 +314,10 @@ out:
left = _free(left);
}
+/**
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static int maxArgWidth(const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
/*@*/
@@ -315,7 +355,37 @@ static int maxArgWidth(const struct poptOption * opt,
return max;
}
-static void singleTableHelp(FILE * fp,
+/**
+ * Display popt alias and exec help.
+ * @param fp output file handle
+ * @param items alias/exec array
+ * @param nitems no. of alias/exec entries
+ * @param translation_domain translation domain
+ */
+static void itemHelp(FILE * fp,
+ /*@null@*/ poptItem items, int nitems, int left,
+ /*@null@*/ const char * translation_domain)
+ /*@modifies *fp, fileSystem @*/
+{
+ poptItem item;
+ int i;
+
+ if (items != NULL)
+ for (i = 0, item = items; i < nitems; i++, item++) {
+ const struct poptOption * opt;
+ opt = &item->option;
+ if ((opt->longName || opt->shortName) &&
+ !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
+ singleOptionHelp(fp, left, opt, translation_domain);
+ }
+}
+
+/**
+ * @param fp output file handle
+ * @param table option(s)
+ * @param translation_domain translation domain
+ */
+static void singleTableHelp(poptContext con, FILE * fp,
/*@null@*/ const struct poptOption * table, int left,
/*@null@*/ const char * translation_domain)
/*@modifies *fp, fileSystem @*/
@@ -323,6 +393,12 @@ static void singleTableHelp(FILE * fp,
const struct poptOption * opt;
const char *sub_transdom;
+ if (table == poptAliasOptions) {
+ itemHelp(fp, con->aliases, con->numAliases, left, NULL);
+ itemHelp(fp, con->execs, con->numExecs, left, NULL);
+ return;
+ }
+
if (table != NULL)
for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
if ((opt->longName || opt->shortName) &&
@@ -332,19 +408,23 @@ static void singleTableHelp(FILE * fp,
if (table != NULL)
for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- sub_transdom = getTableTranslationDomain(opt->arg);
- if (sub_transdom == NULL)
- sub_transdom = translation_domain;
+ if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_INCLUDE_TABLE)
+ continue;
+ sub_transdom = getTableTranslationDomain(opt->arg);
+ if (sub_transdom == NULL)
+ sub_transdom = translation_domain;
- if (opt->descrip)
- fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
+ if (opt->descrip)
+ fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
- singleTableHelp(fp, opt->arg, left, sub_transdom);
- }
+ singleTableHelp(con, fp, opt->arg, left, sub_transdom);
}
}
+/**
+ * @param con context
+ * @param fp output file handle
+ */
static int showHelpIntro(poptContext con, FILE * fp)
/*@modifies *fp, fileSystem @*/
{
@@ -376,9 +456,14 @@ void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags)
fprintf(fp, " %s\n", POPT_("[OPTION...]"));
leftColWidth = maxArgWidth(con->options, NULL);
- singleTableHelp(fp, con->options, leftColWidth, NULL);
+ singleTableHelp(con, fp, con->options, leftColWidth, NULL);
}
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
static int singleOptionUsage(FILE * fp, int cursor,
const struct poptOption * opt,
/*@null@*/ const char *translation_domain)
@@ -419,7 +504,42 @@ static int singleOptionUsage(FILE * fp, int cursor,
return cursor + len + 1;
}
-static int singleTableUsage(FILE * fp,
+/**
+ * Display popt alias and exec usage.
+ * @param fp output file handle
+ * @param item alias/exec array
+ * @param nitems no. of ara/exec entries
+ * @param translation_domain translation domain
+ */
+static int itemUsage(FILE * fp, int cursor, poptItem item, int nitems,
+ /*@null@*/ const char * translation_domain)
+ /*@modifies *fp, fileSystem @*/
+{
+ int i;
+
+ /*@-branchstate@*/ /* FIX: W2DO? */
+ if (item != NULL)
+ for (i = 0; i < nitems; i++, item++) {
+ const struct poptOption * opt;
+ opt = &item->option;
+ if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN) {
+ translation_domain = (const char *)opt->arg;
+ } else if ((opt->longName || opt->shortName) &&
+ !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
+ cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
+ }
+ }
+ /*@=branchstate@*/
+
+ return cursor;
+}
+
+/**
+ * @param fp output file handle
+ * @param opt option(s)
+ * @param translation_domain translation domain
+ */
+static int singleTableUsage(poptContext con, FILE * fp,
int cursor, const struct poptOption * opt,
/*@null@*/ const char * translation_domain)
/*@modifies *fp, fileSystem @*/
@@ -431,7 +551,8 @@ static int singleTableUsage(FILE * fp,
translation_domain = (const char *)opt->arg;
} else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
if (opt->arg) /* XXX program error */
- cursor = singleTableUsage(fp, cursor, opt->arg, translation_domain);
+ cursor = singleTableUsage(con, fp, cursor, opt->arg,
+ translation_domain);
} else if ((opt->longName || opt->shortName) &&
!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
@@ -442,6 +563,13 @@ static int singleTableUsage(FILE * fp,
return cursor;
}
+/**
+ * Return concatenated short options for display.
+ * @param opt option(s)
+ * @param fp output file handle
+ * @retval str concatenation of short options
+ * @return length of display string
+ */
static int showShortOptions(const struct poptOption * opt, FILE * fp,
/*@null@*/ char * str)
/*@modifies *str, *fp, fileSystem @*/
@@ -478,7 +606,9 @@ void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ int flags)
cursor = showHelpIntro(con, fp);
cursor += showShortOptions(con->options, fp, NULL);
- (void) singleTableUsage(fp, cursor, con->options, NULL);
+ (void) singleTableUsage(con, fp, cursor, con->options, NULL);
+ (void) itemUsage(fp, cursor, con->aliases, con->numAliases, NULL);
+ (void) itemUsage(fp, cursor, con->execs, con->numExecs, NULL);
if (con->otherHelp) {
cursor += strlen(con->otherHelp) + 1;
diff --git a/popt/poptint.h b/popt/poptint.h
index fe8430b76..089275e53 100644
--- a/popt/poptint.h
+++ b/popt/poptint.h
@@ -45,16 +45,10 @@ struct optionStackEntry {
int next;
/*@only@*/ /*@null@*/ const char * nextArg;
/*@keep@*/ /*@null@*/ const char * nextCharArg;
-/*@dependent@*/ /*@null@*/ struct poptAlias * currAlias;
+/*@dependent@*/ /*@null@*/ poptItem currAlias;
int stuffed;
};
-struct execEntry {
-/*@owned@*/ /*@null@*/ const char * longName;
- char shortName;
-/*@only@*/ /*@null@*/ const char * script;
-};
-
struct poptContext_s {
struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
/*@dependent@*/ struct optionStackEntry * os;
@@ -64,15 +58,15 @@ struct poptContext_s {
/*@keep@*/ const struct poptOption * options;
int restLeftover;
/*@only@*/ /*@null@*/ const char * appName;
-/*@only@*/ /*@null@*/ struct poptAlias * aliases;
+/*@only@*/ /*@null@*/ poptItem aliases;
int numAliases;
int flags;
-/*@owned@*/ /*@null@*/ struct execEntry * execs;
+/*@owned@*/ /*@null@*/ poptItem execs;
int numExecs;
/*@only@*/ /*@null@*/ const char ** finalArgv;
int finalArgvCount;
int finalArgvAlloced;
-/*@dependent@*/ /*@null@*/ struct execEntry * doExec;
+/*@dependent@*/ /*@null@*/ poptItem doExec;
/*@only@*/ const char * execPath;
int execAbsolute;
/*@only@*/ const char * otherHelp;
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 96372216a..80bb2ce62 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -1534,7 +1534,7 @@ static PyTypeObject rpmtransType = {
*/
/*@{*/
-/** \ingroup python
+/**
*/
static PyObject * rpmtransCreate(PyObject * self, PyObject * args) {
rpmtransObject * o;
@@ -1558,7 +1558,7 @@ static PyObject * rpmtransCreate(PyObject * self, PyObject * args) {
return (void *) o;
}
-/** \ingroup python
+/**
*/
static PyObject * doAddMacro(PyObject * self, PyObject * args) {
char * name, * val;
@@ -1572,7 +1572,7 @@ static PyObject * doAddMacro(PyObject * self, PyObject * args) {
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * doDelMacro(PyObject * self, PyObject * args) {
char * name;
@@ -1586,7 +1586,7 @@ static PyObject * doDelMacro(PyObject * self, PyObject * args) {
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * archScore(PyObject * self, PyObject * args) {
char * arch;
@@ -1600,7 +1600,7 @@ static PyObject * archScore(PyObject * self, PyObject * args) {
return Py_BuildValue("i", score);
}
-/** \ingroup python
+/**
*/
static int psGetArchScore(Header h) {
void * pkgArch;
@@ -1613,7 +1613,7 @@ static int psGetArchScore(Header h) {
return rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch);
}
-/** \ingroup python
+/**
*/
static int pkgCompareVer(void * first, void * second) {
struct packageInfo ** a = first;
@@ -1635,7 +1635,7 @@ static int pkgCompareVer(void * first, void * second) {
return rpmVersionCompare((*b)->h, (*a)->h);
}
-/** \ingroup python
+/**
*/
static void pkgSort(struct pkgSet * psp) {
int i;
@@ -1665,7 +1665,7 @@ static void pkgSort(struct pkgSet * psp) {
psp->numPackages = i;
}
-/** \ingroup python
+/**
*/
static PyObject * findUpgradeSet(PyObject * self, PyObject * args) {
PyObject * hdrList, * result;
@@ -1716,7 +1716,7 @@ static PyObject * findUpgradeSet(PyObject * self, PyObject * args) {
return result;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
hdrObject * h;
@@ -1761,7 +1761,7 @@ static PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
return Py_BuildValue("(Ni)", h, isSource);
}
-/** \ingroup python
+/**
*/
static PyObject * hdrLoad(PyObject * self, PyObject * args) {
char * obj, * copy=NULL;
@@ -1797,7 +1797,7 @@ static PyObject * hdrLoad(PyObject * self, PyObject * args) {
return (PyObject *) h;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmInitDB(PyObject * self, PyObject * args) {
char *root;
@@ -1821,7 +1821,7 @@ static PyObject * rpmInitDB(PyObject * self, PyObject * args) {
return(Py_None);
}
-/** \ingroup python
+/**
*/
static rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) {
rpmdbObject * o;
@@ -1853,7 +1853,7 @@ static rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) {
return o;
}
-/** \ingroup python
+/**
*/
static PyObject * rebuildDB (PyObject * self, PyObject * args) {
char * root = "";
@@ -1863,7 +1863,7 @@ static PyObject * rebuildDB (PyObject * self, PyObject * args) {
return Py_BuildValue("i", rpmdbRebuild(root));
}
-/** \ingroup python
+/**
*/
static PyObject * rpmReadHeaders (FD_t fd) {
PyObject * list;
@@ -1905,7 +1905,7 @@ static PyObject * rpmReadHeaders (FD_t fd) {
return list;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) {
FD_t fd;
@@ -1921,7 +1921,7 @@ static PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) {
return list;
}
-/** \ingroup python
+/**
*/
static PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) {
char * filespec;
@@ -1942,7 +1942,7 @@ static PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) {
return list;
}
-/** \ingroup python
+/**
* This assumes the order of list matches the order of the new headers, and
* throws an exception if that isn't true.
*/
@@ -2034,11 +2034,11 @@ static PyObject * rpmMergeHeadersFromFD(PyObject * self, PyObject * args) {
return Py_None;
}
-/** \ingroup python
+/**
*/
static PyObject * errorCB = NULL, * errorData = NULL;
-/** \ingroup python
+/**
*/
static void errorcb (void)
{
@@ -2057,7 +2057,7 @@ static void errorcb (void)
Py_DECREF (result);
}
-/** \ingroup python
+/**
*/
static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
if (errorCB != NULL) {
@@ -2099,13 +2099,13 @@ static PyObject * errorSetCallback (PyObject * self, PyObject * args) {
return PyCObject_FromVoidPtr(rpmErrorSetCallback (errorcb), NULL);
}
-/** \ingroup python
+/**
*/
static PyObject * errorString (PyObject * self, PyObject * args) {
return PyString_FromString(rpmErrorString ());
}
-/** \ingroup python
+/**
*/
static PyObject * versionCompare (PyObject * self, PyObject * args) {
hdrObject * h1, * h2;
@@ -2146,7 +2146,7 @@ static PyObject * labelCompare (PyObject * self, PyObject * args) {
return Py_BuildValue("i", rpmvercmp(r1, r2));
}
-/** \ingroup python
+/**
*/
static PyObject * checkSig (PyObject * self, PyObject * args) {
char * filename;
@@ -2163,7 +2163,7 @@ static PyObject * checkSig (PyObject * self, PyObject * args) {
}
/* hack to get the current header that's in the transaction set */
-/** \ingroup python
+/**
*/
static PyObject * getTsHeader (PyObject * self, PyObject * args) {
hdrObject * h;
@@ -2181,11 +2181,11 @@ static PyObject * getTsHeader (PyObject * self, PyObject * args) {
return (PyObject *) Py_None;
}
-/** \ingroup python
+/**
*/
typedef struct FDlist_t FDlist;
-/** \ingroup python
+/**
*/
struct FDlist_t {
FILE *f;
@@ -2194,15 +2194,15 @@ struct FDlist_t {
FDlist *next;
} ;
-/** \ingroup python
+/**
*/
static FDlist *fdhead = NULL;
-/** \ingroup python
+/**
*/
static FDlist *fdtail = NULL;
-/** \ingroup python
+/**
*/
static int closeCallback(FILE * f) {
FDlist *node, *last;
@@ -2233,7 +2233,7 @@ static int closeCallback(FILE * f) {
return 0;
}
-/** \ingroup python
+/**
*/
static PyObject * doFopen(PyObject * self, PyObject * args) {
char * path, * mode;
@@ -2283,7 +2283,7 @@ static PyObject * doFopen(PyObject * self, PyObject * args) {
return PyFile_FromFile (node->f, path, mode, closeCallback);
}
-/** \ingroup python
+/**
*/
static PyMethodDef rpmModuleMethods[] = {
{ "TransactionSet", (PyCFunction) rpmtransCreate, METH_VARARGS, NULL },
@@ -2309,7 +2309,7 @@ static PyMethodDef rpmModuleMethods[] = {
{ NULL }
} ;
-/** \ingroup python
+/**
*/
void initrpm(void) {
PyObject * m, * d, *o, * tag = NULL, * dict;
diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h
index 721eafed0..202a16358 100644
--- a/rpmio/rpmio.h
+++ b/rpmio/rpmio.h
@@ -49,58 +49,58 @@ extern "C" {
*/
/*@{*/
-/** \ingroup rpmio
+/**
*/
typedef ssize_t fdio_read_function_t (void *cookie, char *buf, size_t nbytes);
-/** \ingroup rpmio
+/**
*/
typedef ssize_t fdio_write_function_t (void *cookie, const char *buf, size_t nbytes);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_seek_function_t (void *cookie, _libio_pos_t pos, int whence);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_close_function_t (void *cookie);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_ref_function_t ( /*@only@*/ void * cookie,
const char * msg, const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_deref_function_t ( /*@only@*/ FD_t fd,
const char * msg, const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef /*@only@*/ /*@null@*/ FD_t fdio_new_function_t (const char * msg,
const char * file, unsigned line);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_fileno_function_t (void * cookie);
-/** \ingroup rpmio
+/**
*/
typedef FD_t fdio_open_function_t (const char * path, int flags, mode_t mode);
-/** \ingroup rpmio
+/**
*/
typedef FD_t fdio_fopen_function_t (const char * path, const char * fmode);
-/** \ingroup rpmio
+/**
*/
typedef void * fdio_ffileno_function_t (FD_t fd);
-/** \ingroup rpmio
+/**
*/
typedef int fdio_fflush_function_t (FD_t fd);
/*@}*/
@@ -154,7 +154,7 @@ struct FDIO_s {
*/
/*@{*/
-/** \ingroup rpmio
+/**
* strerror(3) clone.
*/
/*@-redecl@*/
@@ -162,36 +162,36 @@ struct FDIO_s {
/*@*/;
/*@=redecl@*/
-/** \ingroup rpmio
+/**
* fread(3) clone.
*/
size_t Fread(/*@out@*/ void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, *buf, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fwrite(3) clone.
*/
size_t Fwrite(const void * buf, size_t size, size_t nmemb, FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fseek(3) clone.
*/
int Fseek(FD_t fd, _libio_off_t offset, int whence)
/*@modifies fileSystem @*/;
-/** \ingroup rpmio
+/**
* fclose(3) clone.
*/
int Fclose( /*@killref@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
*/
/*@null@*/ FD_t Fdopen(FD_t fd, const char * fmode)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* fopen(3) clone.
*/
/*@null@*/ FD_t Fopen(/*@null@*/ const char * path,
@@ -199,37 +199,37 @@ int Fclose( /*@killref@*/ FD_t fd)
/*@modifies fileSystem @*/;
-/** \ingroup rpmio
+/**
* fflush(3) clone.
*/
int Fflush(/*@null@*/ FD_t fd)
/*@modifies fd, fileSystem @*/;
-/** \ingroup rpmio
+/**
* ferror(3) clone.
*/
int Ferror(/*@null@*/ FD_t fd)
/*@*/;
-/** \ingroup rpmio
+/**
* fileno(3) clone.
*/
int Fileno(FD_t fd)
/*@*/;
-/** \ingroup rpmio
+/**
* fcntl(2) clone.
*/
int Fcntl(FD_t fd, int op, void *lip)
/*@modifies fd, *lip, fileSystem @*/;
-/** \ingroup rpmio
+/**
* pread(2) clone.
*/
ssize_t Pread(FD_t fd, void * buf, size_t count, _libio_off_t offset)
/*@modifies fd, *buf, fileSystem @*/;
-/** \ingroup rpmio
+/**
* pwrite(2) clone.
*/
ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset)
@@ -242,68 +242,68 @@ ssize_t Pwrite(FD_t fd, const void * buf, size_t count, _libio_off_t offset)
*/
/*@{*/
-/** \ingroup rpmrpc
+/**
* mkdir(2) clone.
*/
int Mkdir(const char * path, mode_t mode)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* chdir(2) clone.
*/
int Chdir(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* rmdir(2) clone.
*/
int Rmdir(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* rename(2) clone.
*/
int Rename(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* link(2) clone.
*/
int Link(const char * oldpath, const char * newpath)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* unlink(2) clone.
*/
int Unlink(const char * path)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* readlink(2) clone.
*/
int Readlink(const char * path, char * buf, size_t bufsiz)
/*@modifies *buf, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* stat(2) clone.
*/
int Stat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* lstat(2) clone.
*/
int Lstat(const char * path, /*@out@*/ struct stat * st)
/*@modifies *st, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* access(2) clone.
*/
int Access(const char * path, int amode)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* glob(3) clone.
*/
int Glob(const char * pattern, int flags,
@@ -311,26 +311,26 @@ int Glob(const char * pattern, int flags,
/*@out@*/ glob_t * pglob)
/*@modifies *pglob, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* globfree(3) clone.
*/
void Globfree( /*@only@*/ glob_t * pglob)
/*@modifies *pglob, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* opendir(3) clone.
*/
/*@null@*/ DIR * Opendir(const char * name)
/*@modifies fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* readdir(3) clone.
*/
/*@null@*/ struct dirent * Readdir(DIR * dir)
/*@modifies *dir, fileSystem @*/;
-/** \ingroup rpmrpc
+/**
* closedir(3) clone.
*/
int Closedir(/*@only@*/ DIR * dir)
diff --git a/rpmpopt.in b/rpmpopt.in
index 54be52bcc..168d367c7 100644
--- a/rpmpopt.in
+++ b/rpmpopt.in
@@ -6,24 +6,25 @@
# whenever a new version of RPM is installed.
rpm alias --scripts --qf '\
-%|PREIN?{preinstall script\
+%|PREIN?{preinstall scriptlet\
%|PREINPROG?{ (through %{PREINPROG})}|:\n%{PREIN}\n}:\
{%|PREINPROG?{preinstall program: %{PREINPROG}\n}|}|\
\
-%|POSTIN?{postinstall script\
+%|POSTIN?{postinstall scriptlet\
%|POSTINPROG?{ (through %{POSTINPROG})}|:\n%{POSTIN}\n}:\
{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|\
\
-%|PREUN?{preuninstall script\
+%|PREUN?{preuninstall scriptlet\
%|PREUNPROG?{ (through %{PREUNPROG})}|:\n%{PREUN}\n}:\
{%|PREUNPROG?{preuninstall program: %{PREUNPROG}\n}|}|\
\
-%|POSTUN?{postuninstall script\
+%|POSTUN?{postuninstall scriptlet\
%|POSTUNPROG?{ (through %{POSTUNPROG})}|:\n%{POSTUN}\n}:\
{%|POSTUNPROG?{postuninstall program: %{POSTUNPROG}\n}|}|\
\
-%|VERIFYSCRIPT?{verify script:\n%{VERIFYSCRIPT}\n}|\
-'
+%|VERIFYSCRIPT?{verify scriptlet:\n%{VERIFYSCRIPT}\n}|\
+' \
+ --POPTdesc=$"list install/erase scriptlets from package(s)"
rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
--pipe "grep -v \(none\) | sed 's/chmod .../chmod /' | sh"
@@ -34,17 +35,18 @@ rpm alias --setugids -q --qf \
rpm alias --conflicts --qf \
- "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]"
+ "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" \
+ --POPTdesc=$"list capabilities this package conflicts with"
rpm alias --obsoletes --qf \
- "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]"
+ "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list other packages removed by installing this package"
rpm alias --provides --qf \
- "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]"
-
-# XXX prereq output is part of requires for query
-#rpm alias --prereq --qf '[%{PREREQ}:depflags\n]'
+ "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list capabilities that this package provides"
rpm alias --requires --qf \
- "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]"
+ "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" \
+ --POPTdesc=$"list capabilities required by package(s)"
rpm alias -R --requires
rpm alias --info --qf 'Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocateable)}|\n\
@@ -56,19 +58,24 @@ Size : %-27{SIZE}%|LICENSE?{ License: %{LICENSE}}|\n\
%|PACKAGER?{Packager : %{PACKAGER}\n}|\
%|URL?{URL : %{URL}\n}|\
Summary : %{SUMMARY}\n\
-Description :\n%{DESCRIPTION}\n'
+Description :\n%{DESCRIPTION}\n' \
+ --POPTdesc=$"list descriptive information from package(s)"
-rpm alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]'
+rpm alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]' \
+ --POPTdesc=$"list change logs for this package"
rpm alias --triggerscripts --qf '\
[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n\
%{TRIGGERSCRIPTS}\n]'
-rpm alias --triggers --triggerscripts
+rpm alias --triggers --triggerscripts \
+ --POPTdesc=$"list trigger scriptlets from package(s)"
rpm alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NAME}-%{VERSION}-%{RELEASE} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
- --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' "
+ --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
+ --POPTdesc=$"list package(s) by install time, most recent first"
-rpm alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]'
+rpm alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
+ --POPTdesc=$"list all files from each package"
rpm alias --redhatprovides -q --define '_dbpath /usr/lib/rpmdb/%{_arch}-%{_vendor}-%{_os}/redhat' --whatprovides
rpm alias --redhatrequires -q --define '_dbpath /usr/lib/rpmdb/%{_arch}-%{_vendor}-%{_os}/redhat' --whatrequires
@@ -160,7 +167,9 @@ rpm exec --verify rpmv --verify
rpm alias --with --define "_with_!#:+ --with-!#:+"
rpm alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmb alias --dbpath --define '_dbpath !#:+'
+rpmb alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmb alias --ftpport --define '_ftpport !#:+'
rpmb alias --ftpproxy --define '_ftpproxy !#:+'
rpmb alias --httpport --define '_httpport !#:+'
@@ -169,7 +178,9 @@ rpmb alias --timecheck --define '_timecheck !#:+'
rpmb alias --with --define "_with_!#:+ --with-!#:+"
rpmb alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmbuild alias --dbpath --define '_dbpath !#:+'
+rpmbuild alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmbuild alias --ftpport --define '_ftpport !#:+'
rpmbuild alias --ftpproxy --define '_ftpproxy !#:+'
rpmbuild alias --httpport --define '_httpport !#:+'
@@ -178,61 +189,74 @@ rpmbuild alias --timecheck --define '_timecheck !#:+'
rpmbuild alias --with --define "_with_!#:+ --with-!#:+"
rpmbuild alias --without --define "_without_!#:+ --without-!#:+"
#==============================================================================
-rpmd alias --dbpath --define '_dbpath !#:+'
+rpmd alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmd alias --ftpport --define '_ftpport !#:+'
rpmd alias --ftpproxy --define '_ftpproxy !#:+'
rpmd alias --httpport --define '_httpport !#:+'
rpmd alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmdb alias --dbpath --define '_dbpath !#:+'
+rpmdb alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmdb alias --ftpport --define '_ftpport !#:+'
rpmdb alias --ftpproxy --define '_ftpproxy !#:+'
rpmdb alias --httpport --define '_httpport !#:+'
rpmdb alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpme alias --dbpath --define '_dbpath !#:+'
+rpme alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpme alias --ftpport --define '_ftpport !#:+'
rpme alias --ftpproxy --define '_ftpproxy !#:+'
rpme alias --httpport --define '_httpport !#:+'
rpme alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmi alias --dbpath --define '_dbpath !#:+'
+rpmi alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmi alias --ftpport --define '_ftpport !#:+'
rpmi alias --ftpproxy --define '_ftpproxy !#:+'
rpmi alias --httpport --define '_httpport !#:+'
rpmi alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmk alias --dbpath --define '_dbpath !#:+'
+rpmk alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmk alias --ftpport --define '_ftpport !#:+'
rpmk alias --ftpproxy --define '_ftpproxy !#:+'
rpmk alias --httpport --define '_httpport !#:+'
rpmk alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmq alias --dbpath --define '_dbpath !#:+'
+rpmq alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmq alias --ftpport --define '_ftpport !#:+'
rpmq alias --ftpproxy --define '_ftpproxy !#:+'
rpmq alias --httpport --define '_httpport !#:+'
rpmq alias --httpproxy --define '_httpproxy !#:+'
rpmq alias --scripts --qf '\
-%|PREIN?{preinstall script\
+%|PREIN?{preinstall scriptlet\
%|PREINPROG?{ (through %{PREINPROG})}|:\n%{PREIN}\n}:\
{%|PREINPROG?{preinstall program: %{PREINPROG}\n}|}|\
\
-%|POSTIN?{postinstall script\
+%|POSTIN?{postinstall scriptlet\
%|POSTINPROG?{ (through %{POSTINPROG})}|:\n%{POSTIN}\n}:\
{%|POSTINPROG?{postinstall program: %{POSTINPROG}\n}|}|\
\
-%|PREUN?{preuninstall script\
+%|PREUN?{preuninstall scriptlet\
%|PREUNPROG?{ (through %{PREUNPROG})}|:\n%{PREUN}\n}:\
{%|PREUNPROG?{preuninstall program: %{PREUNPROG}\n}|}|\
\
-%|POSTUN?{postuninstall script\
+%|POSTUN?{postuninstall scriptlet\
%|POSTUNPROG?{ (through %{POSTUNPROG})}|:\n%{POSTUN}\n}:\
{%|POSTUNPROG?{postuninstall program: %{POSTUNPROG}\n}|}|\
\
-%|VERIFYSCRIPT?{verify script:\n%{VERIFYSCRIPT}\n}|\
-'
+%|VERIFYSCRIPT?{verify scriptlet:\n%{VERIFYSCRIPT}\n}|\
+' \
+ --POPTdesc=$"list install/erase scriptlets from package(s)"
rpmq alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7.7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \
--pipe "grep -v \(none\) | sed 's/chmod .../chmod /' | sh"
@@ -242,17 +266,21 @@ rpmq alias --setugids -q --qf \
--pipe "(echo 'ch() { chown -- \"$1\" \"$3\";chgrp -- \"$2\" \"$3\"; }';grep -v \(none\))|sh"
rpmq alias --conflicts --qf \
- "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]"
+ "[%{CONFLICTNAME} %{CONFLICTFLAGS:depflags} %{CONFLICTVERSION}\n]" \
+ --POPTdesc=$"list capabilities this package conflicts with"
rpmq alias --obsoletes --qf \
- "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]"
+ "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list other packages removed by installing this package"
rpmq alias --provides --qf \
- "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]"
+ "[%{PROVIDENAME} %|PROVIDEFLAGS?{%{PROVIDEFLAGS:depflags} %{PROVIDEVERSION}}:{}|\n]" \
+ --POPTdesc=$"list capabilities that this package provides"
# XXX prereq output is part of requires for query
#rpmq alias --prereq --qf '[%{PREREQ}:depflags\n]'
rpmq alias --requires --qf \
- "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]"
+ "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]" \
+ --POPTdesc=$"list capabilities required by package(s)"
rpmq alias -R --requires
rpmq alias --info --qf 'Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocateable)}|\n\
@@ -264,27 +292,36 @@ Size : %-27{SIZE}%|LICENSE?{ License: %{LICENSE}}|\n\
%|PACKAGER?{Packager : %{PACKAGER}\n}|\
%|URL?{URL : %{URL}\n}|\
Summary : %{SUMMARY}\n\
-Description :\n%{DESCRIPTION}\n'
+Description :\n%{DESCRIPTION}\n' \
+ --POPTdesc=$"list descriptive information from package(s)"
-rpmq alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]'
+rpmq alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n\n%{CHANGELOGTEXT}\n\n]' \
+ --POPTdesc=$"list change logs for this package"
rpmq alias --triggerscripts --qf '\
[trigger%{TRIGGERTYPE} script (through %{TRIGGERSCRIPTPROG}) -- %{TRIGGERCONDS}\n\
%{TRIGGERSCRIPTS}\n]'
-rpmq alias --triggers --triggerscripts
+rpmq alias --triggers --triggerscripts \
+ --POPTdesc=$"list trigger scriptlets from package(s)"
rpmq alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NAME}-%{VERSION}-%{RELEASE} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
- --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' "
+ --pipe "sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
+ --POPTdesc=$"list package(s) by install time, most recent first"
-rpmq alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]'
+rpmq alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
+ --POPTdesc=$"list all files from each package"
#==============================================================================
-rpmu alias --dbpath --define '_dbpath !#:+'
+rpmu alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmu alias --ftpport --define '_ftpport !#:+'
rpmu alias --ftpproxy --define '_ftpproxy !#:+'
rpmu alias --httpport --define '_httpport !#:+'
rpmu alias --httpproxy --define '_httpproxy !#:+'
#==============================================================================
-rpmv alias --dbpath --define '_dbpath !#:+'
+rpmv alias --dbpath --define '_dbpath !#:+' \
+ --POPTdesc=$"use <dir> as the directory for the database" \
+ --POPTargs=$"<dir>"
rpmv alias --ftpport --define '_ftpport !#:+'
rpmv alias --ftpproxy --define '_ftpproxy !#:+'
rpmv alias --httpport --define '_httpport !#:+'
diff --git a/rpmqv.c b/rpmqv.c
index 6b0d883c0..324a759af 100755
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -105,10 +105,10 @@ static struct poptOption rpmAllPoptTable[] = {
N_("provide less detailed output"), NULL},
{ "verbose", 'v', 0, 0, 'v',
N_("provide more detailed output"), NULL},
- { "define", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_DEFINEMACRO,
+ { "define", '\0', POPT_ARG_STRING, 0, GETOPT_DEFINEMACRO,
N_("define macro <name> with value <body>"),
N_("'<name> <body>'") },
- { "eval", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, 0, GETOPT_EVALMACRO,
+ { "eval", '\0', POPT_ARG_STRING, 0, GETOPT_EVALMACRO,
N_("print macro expansion of <expr>+"),
N_("<expr>+") },
{ "pipe", '\0', POPT_ARG_STRING|POPT_ARGFLAG_DOC_HIDDEN, &pipeOutput, 0,
@@ -195,6 +195,7 @@ static struct poptOption optionsTable[] = {
N_("Common options for all rpm modes:"),
NULL },
+ POPT_AUTOALIAS
POPT_AUTOHELP
POPT_TABLEEND
};
@@ -417,7 +418,7 @@ int main(int argc, const char ** argv)
#ifdef IAM_RPMK
memset(ka, 0, sizeof(*ka));
- ka->addSign = RESIGN_CHK_SIGNATURE;
+ ka->addSign = RESIGN_NONE;
ka->checksigFlags = CHECKSIG_ALL;
#endif
@@ -584,6 +585,8 @@ int main(int argc, const char ** argv)
#ifdef IAM_RPMK
switch (ka->addSign) {
+ case RESIGN_NONE:
+ break;
case RESIGN_CHK_SIGNATURE:
bigMode = MODE_CHECKSIG;
break;
@@ -591,6 +594,7 @@ int main(int argc, const char ** argv)
case RESIGN_NEW_SIGNATURE:
bigMode = MODE_RESIGN;
break;
+
}
#endif /* IAM_RPMK */