popt: heavy dose of const.
CVS patchset: 3206 CVS date: 1999/07/27 22:05:43
This commit is contained in:
parent
12dacc46fb
commit
3952d8e797
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "rpmlead.h"
|
||||
#include "signature.h"
|
||||
#include "misc.h" /* XXX fpor makeTempFile() */
|
||||
|
||||
int rpmReSign(int add, char *passPhrase, const char **argv)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: macros.in,v 1.32 1999/07/23 19:19:15 jbj Exp $
|
||||
# $Id: macros.in,v 1.33 1999/07/27 22:05:43 jbj Exp $
|
||||
#==============================================================================
|
||||
# Macro naming conventions (preliminary):
|
||||
#
|
||||
|
@ -70,8 +70,8 @@
|
|||
#%__find_obsoletes ???
|
||||
#
|
||||
# XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
|
||||
%_fixowner [ `%{__id} -u` = '0' ] && %{__chown} -Rf root
|
||||
%_fixgroup [ `%{__id} -u` = '0' ] && %{__chgrp} -Rf @ROOT_GROUP@
|
||||
%_fixowner [ `%{__id} -u` = '0' ] && %{__chown} -Rhf root
|
||||
%_fixgroup [ `%{__id} -u` = '0' ] && %{__chgrp} -Rhf @ROOT_GROUP@
|
||||
%_fixperms %{__chmod} -Rf @FIXPERMS@
|
||||
#
|
||||
%_gzipbin @GZIPBIN@
|
||||
|
|
46
po/rpm.pot
46
po/rpm.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 1999-07-26 17:44-0400\n"
|
||||
"POT-Creation-Date: 1999-07-27 17:31-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1503,7 +1503,7 @@ msgstr ""
|
|||
msgid "Unable to write package: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../build/pack.c:330 ../lib/rpmchecksig.c:93
|
||||
#: ../build/pack.c:330 ../lib/rpmchecksig.c:94
|
||||
#, c-format
|
||||
msgid "Generating signature: %d\n"
|
||||
msgstr ""
|
||||
|
@ -1962,17 +1962,17 @@ msgstr ""
|
|||
msgid "cannot open file %s: %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/dbindex.c:77
|
||||
#: ../lib/dbindex.c:80
|
||||
#, c-format
|
||||
msgid "error getting record %s from %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/dbindex.c:104
|
||||
#: ../lib/dbindex.c:107
|
||||
#, c-format
|
||||
msgid "error storing record %s into %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/dbindex.c:111
|
||||
#: ../lib/dbindex.c:114
|
||||
#, c-format
|
||||
msgid "error removing record %s into %s"
|
||||
msgstr ""
|
||||
|
@ -2714,83 +2714,83 @@ msgstr ""
|
|||
msgid "failed to remove directory %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:29 ../lib/rpmchecksig.c:167
|
||||
#: ../lib/rpmchecksig.c:30 ../lib/rpmchecksig.c:168
|
||||
#, c-format
|
||||
msgid "%s: Open failed\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:33 ../lib/rpmchecksig.c:172
|
||||
#: ../lib/rpmchecksig.c:34 ../lib/rpmchecksig.c:173
|
||||
#, c-format
|
||||
msgid "%s: readLead failed\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:37
|
||||
#: ../lib/rpmchecksig.c:38
|
||||
#, c-format
|
||||
msgid "%s: Can't sign v1.0 RPM\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:41
|
||||
#: ../lib/rpmchecksig.c:42
|
||||
#, c-format
|
||||
msgid "%s: Can't re-sign v2.0 RPM\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:45 ../lib/rpmchecksig.c:182
|
||||
#: ../lib/rpmchecksig.c:46 ../lib/rpmchecksig.c:183
|
||||
#, c-format
|
||||
msgid "%s: rpmReadSignature failed\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:58 ../lib/rpmchecksig.c:196
|
||||
#: ../lib/rpmchecksig.c:59 ../lib/rpmchecksig.c:197
|
||||
msgid "Couldn't read the header/archive"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:65
|
||||
#: ../lib/rpmchecksig.c:66
|
||||
msgid "Couldn't write header/archive to temp file"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:116
|
||||
#: ../lib/rpmchecksig.c:117
|
||||
msgid "Couldn't read sigtarget"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:125
|
||||
#: ../lib/rpmchecksig.c:126
|
||||
msgid "Couldn't write package"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:177
|
||||
#: ../lib/rpmchecksig.c:178
|
||||
#, c-format
|
||||
msgid "%s: No signature available (v1.0 RPM)\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:187
|
||||
#: ../lib/rpmchecksig.c:188
|
||||
#, c-format
|
||||
msgid "%s: No signature available\n"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:203
|
||||
#: ../lib/rpmchecksig.c:204
|
||||
#, c-format
|
||||
msgid "Unable to write %s"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:329
|
||||
#: ../lib/rpmchecksig.c:330
|
||||
msgid "NOT OK"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:330 ../lib/rpmchecksig.c:344
|
||||
#: ../lib/rpmchecksig.c:331 ../lib/rpmchecksig.c:345
|
||||
msgid " (MISSING KEYS:"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:332 ../lib/rpmchecksig.c:346
|
||||
#: ../lib/rpmchecksig.c:333 ../lib/rpmchecksig.c:347
|
||||
msgid ") "
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:333 ../lib/rpmchecksig.c:347
|
||||
#: ../lib/rpmchecksig.c:334 ../lib/rpmchecksig.c:348
|
||||
msgid " (UNTRUSTED KEYS:"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:335 ../lib/rpmchecksig.c:349
|
||||
#: ../lib/rpmchecksig.c:336 ../lib/rpmchecksig.c:350
|
||||
msgid ")"
|
||||
msgstr ""
|
||||
|
||||
#: ../lib/rpmchecksig.c:343
|
||||
#: ../lib/rpmchecksig.c:344
|
||||
msgid "OK"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
1.3 ->
|
||||
- heavy dose of const's
|
||||
|
||||
1.2.3 -> 1.3
|
||||
- added support for single -
|
||||
- misc bug fixes
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "findme.h"
|
||||
|
||||
char * findProgramPath(char * argv0) {
|
||||
const char * findProgramPath(const char * argv0) {
|
||||
char * path = getenv("PATH");
|
||||
char * pathbuf;
|
||||
char * start, * chptr;
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
#ifndef H_FINDME
|
||||
#define H_FINDME
|
||||
|
||||
char * findProgramPath(char * argv0);
|
||||
const char * findProgramPath(const char * argv0);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 1999-07-15 16:51-0400\n"
|
||||
"POT-Creation-Date: 1999-07-27 17:51-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
78
popt/popt.c
78
popt/popt.c
|
@ -36,7 +36,7 @@ static char * strerror(int errno) {
|
|||
#endif
|
||||
|
||||
void poptSetExecPath(poptContext con, const char * path, int allowAbsolute) {
|
||||
if (con->execPath) free(con->execPath);
|
||||
if (con->execPath) xfree(con->execPath);
|
||||
con->execPath = strdup(path);
|
||||
con->execAbsolute = allowAbsolute;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static void invokeCallbacks(poptContext con, const struct poptOption * table,
|
|||
}
|
||||
}
|
||||
|
||||
poptContext poptGetContext(char * name, int argc, char ** argv,
|
||||
poptContext poptGetContext(const char * name, int argc, char ** argv,
|
||||
const struct poptOption * options, int flags) {
|
||||
poptContext con = malloc(sizeof(*con));
|
||||
|
||||
|
@ -68,7 +68,7 @@ poptContext poptGetContext(char * name, int argc, char ** argv,
|
|||
|
||||
con->os = con->optionStack;
|
||||
con->os->argc = argc;
|
||||
con->os->argv = argv;
|
||||
con->os->argv = (const char **)argv; /* XXX don't change the API */
|
||||
|
||||
if (!(flags & POPT_CONTEXT_KEEP_FIRST))
|
||||
con->os->next = 1; /* skip argv[0] */
|
||||
|
@ -106,7 +106,7 @@ void poptResetContext(poptContext con) {
|
|||
con->doExec = NULL;
|
||||
|
||||
for (i = 0; i < con->finalArgvCount; i++)
|
||||
free(con->finalArgv[i]);
|
||||
xfree(con->finalArgv[i]);
|
||||
|
||||
con->finalArgvCount = 0;
|
||||
}
|
||||
|
@ -143,18 +143,20 @@ static int handleExec(poptContext con, char * longName, char shortName) {
|
|||
}
|
||||
|
||||
i = con->finalArgvCount++;
|
||||
con->finalArgv[i] = malloc((longName ? strlen(longName) : 0) + 3);
|
||||
{ char *s = malloc((longName ? strlen(longName) : 0) + 3);
|
||||
if (longName)
|
||||
sprintf(con->finalArgv[i], "--%s", longName);
|
||||
sprintf(s, "--%s", longName);
|
||||
else
|
||||
sprintf(con->finalArgv[i], "-%c", shortName);
|
||||
sprintf(s, "-%c", shortName);
|
||||
con->finalArgv[i] = s;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Only one of longName, shortName may be set at a time */
|
||||
static int handleAlias(poptContext con, char * longName, char shortName,
|
||||
char * nextCharArg) {
|
||||
static int handleAlias(poptContext con, const char * longName, char shortName,
|
||||
const char * nextCharArg) {
|
||||
int i;
|
||||
|
||||
if (con->os->currAlias && con->os->currAlias->longName && longName &&
|
||||
|
@ -194,9 +196,9 @@ static int handleAlias(poptContext con, char * longName, char shortName,
|
|||
}
|
||||
|
||||
static void execCommand(poptContext con) {
|
||||
char ** argv;
|
||||
const char ** argv;
|
||||
int pos = 0;
|
||||
char * script = con->doExec->script;
|
||||
const char * script = con->doExec->script;
|
||||
|
||||
argv = malloc(sizeof(*argv) *
|
||||
(6 + con->numLeftovers + con->finalArgvCount));
|
||||
|
@ -204,8 +206,9 @@ static void execCommand(poptContext con) {
|
|||
if (!con->execAbsolute && strchr(script, '/')) return;
|
||||
|
||||
if (!strchr(script, '/') && con->execPath) {
|
||||
argv[pos] = alloca(strlen(con->execPath) + strlen(script) + 2);
|
||||
sprintf(argv[pos], "%s/%s", con->execPath, script);
|
||||
char *s = alloca(strlen(con->execPath) + strlen(script) + 2);
|
||||
sprintf(s, "%s/%s", con->execPath, script);
|
||||
argv[pos] = s;
|
||||
} else {
|
||||
argv[pos] = script;
|
||||
}
|
||||
|
@ -243,14 +246,14 @@ static void execCommand(poptContext con) {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
execvp(argv[0], argv);
|
||||
execvp(argv[0], (char *const *)argv);
|
||||
}
|
||||
|
||||
static const struct poptOption * findOption(const struct poptOption * table,
|
||||
const char * longName,
|
||||
char shortName,
|
||||
poptCallbackType * callback,
|
||||
void ** callbackData,
|
||||
const void ** callbackData,
|
||||
int singleDash) {
|
||||
const struct poptOption * opt = table;
|
||||
const struct poptOption * opt2;
|
||||
|
@ -296,15 +299,15 @@ static const struct poptOption * findOption(const struct poptOption * table,
|
|||
/* returns 'val' element, -1 on last item, POPT_ERROR_* on error */
|
||||
int poptGetNextOpt(poptContext con) {
|
||||
char * optString, * chptr, * localOptString;
|
||||
char * longArg = NULL;
|
||||
char * origOptString;
|
||||
const char * longArg = NULL;
|
||||
const char * origOptString;
|
||||
long aLong;
|
||||
char * end;
|
||||
const struct poptOption * opt = NULL;
|
||||
int done = 0;
|
||||
int i;
|
||||
poptCallbackType cb;
|
||||
void * cbData;
|
||||
const void * cbData;
|
||||
int singleDash;
|
||||
|
||||
while (!done) {
|
||||
|
@ -412,7 +415,7 @@ int poptGetNextOpt(poptContext con) {
|
|||
if (opt->arg) {
|
||||
switch (opt->argInfo & POPT_ARG_MASK) {
|
||||
case POPT_ARG_STRING:
|
||||
*((char **) opt->arg) = con->os->nextArg;
|
||||
*((const char **) opt->arg) = con->os->nextArg;
|
||||
break;
|
||||
|
||||
case POPT_ARG_INT:
|
||||
|
@ -452,12 +455,13 @@ int poptGetNextOpt(poptContext con) {
|
|||
}
|
||||
|
||||
i = con->finalArgvCount++;
|
||||
con->finalArgv[i] =
|
||||
malloc((opt->longName ? strlen(opt->longName) : 0) + 3);
|
||||
{ char *s = malloc((opt->longName ? strlen(opt->longName) : 0) + 3);
|
||||
if (opt->longName)
|
||||
sprintf(con->finalArgv[i], "--%s", opt->longName);
|
||||
sprintf(s, "--%s", opt->longName);
|
||||
else
|
||||
sprintf(con->finalArgv[i], "-%c", opt->shortName);
|
||||
sprintf(s, "-%c", opt->shortName);
|
||||
con->finalArgv[i] = s;
|
||||
}
|
||||
|
||||
if (opt->arg && (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE
|
||||
&& (opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL)
|
||||
|
@ -468,22 +472,22 @@ int poptGetNextOpt(poptContext con) {
|
|||
}
|
||||
|
||||
char * poptGetOptArg(poptContext con) {
|
||||
char * ret = con->os->nextArg;
|
||||
char * ret = (char *)con->os->nextArg; /* XXX don't change the API */
|
||||
con->os->nextArg = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char * poptGetArg(poptContext con) {
|
||||
if (con->numLeftovers == con->nextLeftover) return NULL;
|
||||
return (con->leftovers[con->nextLeftover++]);
|
||||
return (char *)con->leftovers[con->nextLeftover++]; /* XXX don't change the API */
|
||||
}
|
||||
|
||||
char * poptPeekArg(poptContext con) {
|
||||
const char * poptPeekArg(poptContext con) {
|
||||
if (con->numLeftovers == con->nextLeftover) return NULL;
|
||||
return (con->leftovers[con->nextLeftover]);
|
||||
return con->leftovers[con->nextLeftover];
|
||||
}
|
||||
|
||||
char ** poptGetArgs(poptContext con) {
|
||||
const char ** poptGetArgs(poptContext con) {
|
||||
if (con->numLeftovers == con->nextLeftover) return NULL;
|
||||
|
||||
/* some apps like [like RPM ;-) ] need this NULL terminated */
|
||||
|
@ -496,24 +500,24 @@ void poptFreeContext(poptContext con) {
|
|||
int i;
|
||||
|
||||
for (i = 0; i < con->numAliases; i++) {
|
||||
if (con->aliases[i].longName) free(con->aliases[i].longName);
|
||||
if (con->aliases[i].longName) xfree(con->aliases[i].longName);
|
||||
free(con->aliases[i].argv);
|
||||
}
|
||||
|
||||
for (i = 0; i < con->numExecs; i++) {
|
||||
if (con->execs[i].longName) free(con->execs[i].longName);
|
||||
free(con->execs[i].script);
|
||||
if (con->execs[i].longName) xfree(con->execs[i].longName);
|
||||
xfree(con->execs[i].script);
|
||||
}
|
||||
|
||||
for (i = 0; i < con->finalArgvCount; i++)
|
||||
free(con->finalArgv[i]);
|
||||
xfree(con->finalArgv[i]);
|
||||
|
||||
free(con->leftovers);
|
||||
free(con->finalArgv);
|
||||
if (con->appName) free(con->appName);
|
||||
if (con->appName) xfree(con->appName);
|
||||
if (con->aliases) free(con->aliases);
|
||||
if (con->otherHelp) free(con->otherHelp);
|
||||
if (con->execPath) free(con->execPath);
|
||||
if (con->otherHelp) xfree(con->otherHelp);
|
||||
if (con->execPath) xfree(con->execPath);
|
||||
free(con);
|
||||
}
|
||||
|
||||
|
@ -539,7 +543,7 @@ int poptAddAlias(poptContext con, struct poptAlias newAlias, int flags) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
char * poptBadOption(poptContext con, int flags) {
|
||||
const char * poptBadOption(poptContext con, int flags) {
|
||||
struct optionStackEntry * os;
|
||||
|
||||
if (flags & POPT_BADOPTION_NOALIAS)
|
||||
|
@ -577,7 +581,7 @@ const char * poptStrerror(const int error) {
|
|||
}
|
||||
}
|
||||
|
||||
int poptStuffArgs(poptContext con, char ** argv) {
|
||||
int poptStuffArgs(poptContext con, const char ** argv) {
|
||||
int i;
|
||||
|
||||
if ((con->os - con->optionStack) == POPT_OPTION_DEPTH)
|
||||
|
|
22
popt/popt.h
22
popt/popt.h
|
@ -57,15 +57,15 @@ struct poptOption {
|
|||
int argInfo;
|
||||
void * arg; /* depends on argInfo */
|
||||
int val; /* 0 means don't return, just update flag */
|
||||
char * descrip; /* description for autohelp -- may be NULL */
|
||||
char * argDescrip; /* argument description for autohelp */
|
||||
const char * descrip; /* description for autohelp -- may be NULL */
|
||||
const char * argDescrip; /* argument description for autohelp */
|
||||
};
|
||||
|
||||
struct poptAlias {
|
||||
char * longName; /* may be NULL */
|
||||
const char * longName; /* may be NULL */
|
||||
char shortName; /* may be '\0' */
|
||||
int argc;
|
||||
char ** argv; /* must be free()able */
|
||||
const char ** argv; /* must be free()able */
|
||||
};
|
||||
|
||||
extern struct poptOption poptHelpOptions[];
|
||||
|
@ -83,9 +83,9 @@ enum poptCallbackReason { POPT_CALLBACK_REASON_PRE,
|
|||
typedef void (*poptCallbackType)(poptContext con,
|
||||
enum poptCallbackReason reason,
|
||||
const struct poptOption * opt,
|
||||
const char * arg, void * data);
|
||||
const char * arg, const void * data);
|
||||
|
||||
poptContext poptGetContext(char * name, int argc, char ** argv,
|
||||
poptContext poptGetContext(const char * name, int argc, char ** argv,
|
||||
const struct poptOption * options, int flags);
|
||||
void poptResetContext(poptContext con);
|
||||
|
||||
|
@ -95,14 +95,14 @@ int poptGetNextOpt(poptContext con);
|
|||
char * poptGetOptArg(poptContext con);
|
||||
/* returns NULL if no more options are available */
|
||||
char * poptGetArg(poptContext con);
|
||||
char * poptPeekArg(poptContext con);
|
||||
char ** poptGetArgs(poptContext con);
|
||||
const char * poptPeekArg(poptContext con);
|
||||
const char ** poptGetArgs(poptContext con);
|
||||
/* returns the option which caused the most recent error */
|
||||
char * poptBadOption(poptContext con, int flags);
|
||||
const char * poptBadOption(poptContext con, int flags);
|
||||
void poptFreeContext(poptContext con);
|
||||
int poptStuffArgs(poptContext con, char ** argv);
|
||||
int poptStuffArgs(poptContext con, const char ** argv);
|
||||
int poptAddAlias(poptContext con, struct poptAlias alias, int flags);
|
||||
int poptReadConfigFile(poptContext con, char * fn);
|
||||
int poptReadConfigFile(poptContext con, const char * fn);
|
||||
/* like above, but reads /etc/popt and $HOME/.popt along with environment
|
||||
vars */
|
||||
int poptReadDefaultConfig(poptContext con, int useEnv);
|
||||
|
|
|
@ -51,7 +51,7 @@ static void configLine(poptContext con, char * line) {
|
|||
shortName = opt[1];
|
||||
|
||||
if (!strcmp(entryType, "alias")) {
|
||||
if (poptParseArgvString(line, &alias.argc, &alias.argv)) return;
|
||||
if (poptParseArgvString(line, &alias.argc, (char ***)&alias.argv)) return;
|
||||
alias.longName = longName, alias.shortName = shortName;
|
||||
poptAddAlias(con, alias, 0);
|
||||
} else if (!strcmp(entryType, "exec")) {
|
||||
|
@ -69,7 +69,7 @@ static void configLine(poptContext con, char * line) {
|
|||
}
|
||||
}
|
||||
|
||||
int poptReadConfigFile(poptContext con, char * fn) {
|
||||
int poptReadConfigFile(poptContext con, const char * fn) {
|
||||
char * file, * chptr, * end;
|
||||
char * buf, * dst;
|
||||
int fd, rc;
|
||||
|
|
|
@ -180,7 +180,7 @@ static void singleTableHelp(FILE * f, const struct poptOption * table,
|
|||
|
||||
static int showHelpIntro(poptContext con, FILE * f) {
|
||||
int len = 6;
|
||||
char * fn;
|
||||
const char * fn;
|
||||
|
||||
fprintf(f, POPT_("Usage:"));
|
||||
if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) {
|
||||
|
@ -306,6 +306,6 @@ void poptPrintUsage(poptContext con, FILE * f, int flags) {
|
|||
}
|
||||
|
||||
void poptSetOtherOptionHelp(poptContext con, const char * text) {
|
||||
if (con->otherHelp) free(con->otherHelp);
|
||||
if (con->otherHelp) xfree(con->otherHelp);
|
||||
con->otherHelp = strdup(text);
|
||||
}
|
||||
|
|
|
@ -7,42 +7,44 @@
|
|||
|
||||
struct optionStackEntry {
|
||||
int argc;
|
||||
char ** argv;
|
||||
const char ** argv;
|
||||
int next;
|
||||
char * nextArg;
|
||||
char * nextCharArg;
|
||||
const char * nextArg;
|
||||
const char * nextCharArg;
|
||||
struct poptAlias * currAlias;
|
||||
int stuffed;
|
||||
};
|
||||
|
||||
struct execEntry {
|
||||
char * longName;
|
||||
const char * longName;
|
||||
char shortName;
|
||||
char * script;
|
||||
const char * script;
|
||||
};
|
||||
|
||||
struct poptContext_s {
|
||||
struct optionStackEntry optionStack[POPT_OPTION_DEPTH], * os;
|
||||
char ** leftovers;
|
||||
const char ** leftovers;
|
||||
int numLeftovers;
|
||||
int nextLeftover;
|
||||
const struct poptOption * options;
|
||||
int restLeftover;
|
||||
char * appName;
|
||||
const char * appName;
|
||||
struct poptAlias * aliases;
|
||||
int numAliases;
|
||||
int flags;
|
||||
struct execEntry * execs;
|
||||
int numExecs;
|
||||
char ** finalArgv;
|
||||
const char ** finalArgv;
|
||||
int finalArgvCount;
|
||||
int finalArgvAlloced;
|
||||
struct execEntry * doExec;
|
||||
char * execPath;
|
||||
const char * execPath;
|
||||
int execAbsolute;
|
||||
char * otherHelp;
|
||||
const char * otherHelp;
|
||||
};
|
||||
|
||||
#define xfree(_a) free((void *)_a)
|
||||
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,7 @@ int poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
|
|||
char quote = '\0';
|
||||
int argvAlloced = POPT_ARGV_ARRAY_GROW_DELTA;
|
||||
char ** argv = malloc(sizeof(*argv) * argvAlloced);
|
||||
char ** argv2;
|
||||
const char ** argv2;
|
||||
int argc = 0;
|
||||
int i, buflen;
|
||||
|
||||
|
@ -105,7 +105,7 @@ int poptParseArgvString(const char * s, int * argcPtr, char *** argvPtr) {
|
|||
|
||||
free(argv);
|
||||
|
||||
*argvPtr = argv2;
|
||||
*argvPtr = (char **)argv2; /* XXX don't change the API */
|
||||
*argcPtr = argc;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -59,7 +59,7 @@ static struct poptOption options[] = {
|
|||
int main(int argc, char ** argv) {
|
||||
int rc;
|
||||
poptContext optCon;
|
||||
char ** rest;
|
||||
const char ** rest;
|
||||
int help = 0;
|
||||
int usage = 0;
|
||||
|
||||
|
|
4
rpm.c
4
rpm.c
|
@ -519,8 +519,8 @@ int main(int argc, char ** argv)
|
|||
const char * pkg;
|
||||
char * errString = NULL;
|
||||
poptContext optCon;
|
||||
char * infoCommand[] = { "--info", NULL };
|
||||
char * installCommand[] = { "--install", NULL };
|
||||
const char * infoCommand[] = { "--info", NULL };
|
||||
const char * installCommand[] = { "--install", NULL };
|
||||
int ec = 0;
|
||||
int status;
|
||||
int p[2];
|
||||
|
|
Loading…
Reference in New Issue