Another dead strtok.

CVS patchset: 3179
CVS date: 1999/07/19 16:20:02
This commit is contained in:
jbj 1999-07-19 16:20:02 +00:00
parent 07a1b9a39f
commit 673bd51d8b
4 changed files with 65 additions and 48 deletions

View File

@ -127,6 +127,7 @@ typedef struct _parseState
#define EXPRBUFSIZ BUFSIZ
#if defined(DEBUG_PARSER)
typedef struct exprTokTableEntry {
const char *name;
int val;
@ -165,6 +166,7 @@ static const char *prToken(int val)
}
return "???";
}
#endif /* DEBUG_PARSER */
static int rdToken(ParseState state)
{

View File

@ -165,8 +165,8 @@ extern void (*freeSpecVec) (Spec spec); /* XXX FIXME */
struct OpenFileInfo * newOpenFileInfo(void);
struct spectag *stashSt(Spec spec, Header h, int tag, const char *lang);
int addSource(Spec spec, Package pkg, char *field, int tag);
int parseNoSource(Spec spec, char *field, int tag);
int addSource(Spec spec, Package pkg, const char *field, int tag);
int parseNoSource(Spec spec, const char *field, int tag);
#ifdef __cplusplus
}

View File

@ -6,6 +6,9 @@
extern char *specedit;
extern MacroContext globalMacroContext;
#define SKIPWHITE(_x) {while(*(_x) && (isspace(*_x) || *(_x) == ',')) (_x)++;}
#define SKIPNONWHITE(_x){while(*(_x) &&!(isspace(*_x) || *(_x) == ',')) (_x)++;}
static inline void freeTriggerFiles(/*@only@*/ struct TriggerFileEntry *p)
{
struct TriggerFileEntry *o, *q = p;
@ -48,39 +51,41 @@ static inline void freeSources(/*@only@*/ struct Source *s)
int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
{
char buf[BUFSIZ];
char *n;
const char *pname;
const char *fullName;
Package p;
/* "main" package */
if (! name) {
if (pkg) {
if (name == NULL) {
if (pkg)
*pkg = spec->packages;
}
return 0;
}
/* Construct package name */
{ char *n;
if (flag == PART_SUBNAME) {
headerGetEntry(spec->packages->header, RPMTAG_NAME,
NULL, (void **) &n, NULL);
sprintf(buf, "%s-%s", n, name);
fullName = buf;
NULL, (void **) &pname, NULL);
fullName = n = alloca(strlen(pname) + 1 + strlen(name) + 1);
while (*pname) *n++ = *pname++;
*n++ = '-';
} else {
fullName = name;
fullName = n = alloca(strlen(name)+1);
}
strcpy(n, name);
}
/* Locate package with fullName */
for (p = spec->packages; p != NULL; p = p->next) {
headerGetEntry(p->header, RPMTAG_NAME, NULL, (void **) &n, NULL);
if (n && (! strcmp(fullName, n))) {
headerGetEntry(p->header, RPMTAG_NAME, NULL, (void **) &pname, NULL);
if (pname && (! strcmp(fullName, pname))) {
break;
}
}
if (pkg) {
if (pkg)
*pkg = p;
}
return ((p == NULL) ? 1 : 0);
}
@ -203,10 +208,10 @@ static char *getFullSource(Spec spec, int num, int flag)
}
#endif /* UNUSED */
int parseNoSource(Spec spec, char *field, int tag)
int parseNoSource(Spec spec, const char *field, int tag)
{
char buf[BUFSIZ];
char *s, *name;
const char *f, *fe;
const char *name;
int num, flag;
if (tag == RPMTAG_NOSOURCE) {
@ -217,12 +222,20 @@ int parseNoSource(Spec spec, char *field, int tag)
name = "patch";
}
strcpy(buf, field);
for (field = buf; (s = strtok(field, ", \t")); field = NULL) {
fe = field;
for (f = fe; *f; f = fe) {
struct Source *p;
if (parseNum(s, &num)) {
SKIPWHITE(f);
if (*f == '\0')
break;
fe = f;
SKIPNONWHITE(fe);
if (*fe) fe++;
if (parseNum(f, &num)) {
rpmError(RPMERR_BADSPEC, _("line %d: Bad number: %s"),
spec->lineNum, spec->line);
spec->lineNum, f);
return RPMERR_BADSPEC;
}
@ -239,12 +252,13 @@ int parseNoSource(Spec spec, char *field, int tag)
return 0;
}
int addSource(Spec spec, Package pkg, char *field, int tag)
int addSource(Spec spec, Package pkg, const char *field, int tag)
{
struct Source *p;
int flag = 0;
char *name = NULL;
char *nump, *fieldp = NULL;
char *nump;
const char *fieldp = NULL;
char buf[BUFSIZ];
int num = 0;
@ -261,6 +275,7 @@ int addSource(Spec spec, Package pkg, char *field, int tag)
break;
case RPMTAG_ICON:
flag = RPMBUILD_ISICON;
fieldp = NULL;
break;
}

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-07-19 08:32-0400\n"
"POT-Creation-Date: 1999-07-19 12:17-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"
@ -1248,56 +1248,56 @@ msgstr ""
msgid "Bad exit status from %s (%s)"
msgstr ""
#: ../build/expression.c:206
#: ../build/expression.c:208
msgid "syntax error while parsing =="
msgstr ""
#: ../build/expression.c:236
#: ../build/expression.c:238
msgid "syntax error while parsing &&"
msgstr ""
#: ../build/expression.c:245
#: ../build/expression.c:247
msgid "syntax error while parsing ||"
msgstr ""
#: ../build/expression.c:287
#: ../build/expression.c:289
msgid "parse error in expression"
msgstr ""
#: ../build/expression.c:317
#: ../build/expression.c:319
msgid "unmatched ("
msgstr ""
#: ../build/expression.c:335
#: ../build/expression.c:337
msgid "undefined identifier"
msgstr ""
#: ../build/expression.c:354
#: ../build/expression.c:356
msgid "- only on numbers"
msgstr ""
#: ../build/expression.c:370
#: ../build/expression.c:372
msgid "! only on numbers"
msgstr ""
#: ../build/expression.c:409 ../build/expression.c:454
#: ../build/expression.c:511 ../build/expression.c:598
#: ../build/expression.c:411 ../build/expression.c:456
#: ../build/expression.c:513 ../build/expression.c:600
msgid "types must match"
msgstr ""
#: ../build/expression.c:422
#: ../build/expression.c:424
msgid "* / not suported for strings"
msgstr ""
#: ../build/expression.c:470
#: ../build/expression.c:472
msgid "- not suported for strings"
msgstr ""
#: ../build/expression.c:611
#: ../build/expression.c:613
msgid "&& and || not suported for strings"
msgstr ""
#: ../build/expression.c:642 ../build/expression.c:687
#: ../build/expression.c:644 ../build/expression.c:689
msgid "syntax error in expression"
msgstr ""
@ -1610,29 +1610,29 @@ msgstr ""
msgid "no description in %%changelog"
msgstr ""
#: ../build/parseDescription.c:35
#: ../build/parseDescription.c:36
msgid "line %d: Error parsing %%description: %s"
msgstr ""
#: ../build/parseDescription.c:48 ../build/parseFiles.c:42
#: ../build/parseDescription.c:49 ../build/parseFiles.c:42
#: ../build/parseScript.c:170
#, c-format
msgid "line %d: Bad option %s: %s"
msgstr ""
#: ../build/parseDescription.c:62 ../build/parseFiles.c:56
#: ../build/parseDescription.c:63 ../build/parseFiles.c:56
#: ../build/parseScript.c:184
#, c-format
msgid "line %d: Too many names: %s"
msgstr ""
#: ../build/parseDescription.c:72 ../build/parseFiles.c:66
#: ../build/parseDescription.c:73 ../build/parseFiles.c:66
#: ../build/parseScript.c:194
#, c-format
msgid "line %d: Package does not exist: %s"
msgstr ""
#: ../build/parseDescription.c:84
#: ../build/parseDescription.c:85
#, c-format
msgid "line %d: Second description"
msgstr ""
@ -1907,22 +1907,22 @@ msgstr ""
msgid "Package has no %%description: %s"
msgstr ""
#: ../build/spec.c:28
#: ../build/spec.c:31
#, c-format
msgid "archive = %s, fs = %s\n"
msgstr ""
#: ../build/spec.c:224
#: ../build/spec.c:237
#, c-format
msgid "line %d: Bad number: %s"
msgstr ""
#: ../build/spec.c:230
#: ../build/spec.c:243
#, c-format
msgid "line %d: Bad no%s number: %d"
msgstr ""
#: ../build/spec.c:286
#: ../build/spec.c:301
#, c-format
msgid "line %d: Bad %s number: %s\n"
msgstr ""