From 816ca6b54c3a4e5776bc091bfe3e754f77704231 Mon Sep 17 00:00:00 2001 From: jbj Date: Mon, 19 Jul 1999 21:25:53 +0000 Subject: [PATCH] debug multiline macro expansion. CVS patchset: 3182 CVS date: 1999/07/19 21:25:53 --- CHANGES | 2 +- build/parseSpec.c | 23 +++++++++++++++-------- build/rpmspec.h | 3 ++- po/rpm.pot | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CHANGES b/CHANGES index c485a7e..b128268 100644 --- a/CHANGES +++ b/CHANGES @@ -8,7 +8,7 @@ - add python bindings to rpm-devel (linux only). - make query (rpm -qvl) behave like (POSIX?) ls for older files (#4050). - fix: %if parsing skipped 3 chars too many. - - permit multiline macro expansions. + - permit multiline macro expansions with comments and %if. 3.0.1 -> 3.0.2 - eliminate armv4 entries from rpmrc (Andrew E. Mileski). diff --git a/build/parseSpec.c b/build/parseSpec.c index 72464d6..27a1492 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -108,10 +108,11 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip) /* Expand next line from file into line buffer */ if (!(spec->nextline && *spec->nextline)) { char *from, *to; - to = last = spec->nextline = spec->lbuf; + to = last = spec->lbuf; from = ofi->readPtr; - while ((ch = *from) && ch != '\n') - *to++ = *from++; + ch = ' '; + while (*from && ch != '\n') + ch = *to++ = *from++; *to++ = '\0'; ofi->readPtr = from; @@ -119,17 +120,23 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip) rpmError(RPMERR_BADSPEC, _("line %d: %s"), spec->lineNum, spec->lbuf); return RPMERR_BADSPEC; } + spec->nextline = spec->lbuf; } /* Find next line in expanded line buffer */ - spec->line = spec->nextline; - while ((ch = *spec->nextline) && ch != '\n') { - spec->nextline++; + spec->line = last = spec->nextline; + if (spec->line != spec->lbuf) + *spec->line = spec->nextpeekc; + ch = ' '; + while (*spec->nextline && ch != '\n') { + ch = *spec->nextline++; if (!isspace(ch)) last = spec->nextline; } - if (ch == '\n') - *spec->nextline++ = '\0'; + if (*spec->nextline) { + spec->nextpeekc = *spec->nextline; + *spec->nextline = '\0'; + } if (strip & STRIP_COMMENTS) handleComments(spec->line); diff --git a/build/rpmspec.h b/build/rpmspec.h index 208c3a8..206d54b 100644 --- a/build/rpmspec.h +++ b/build/rpmspec.h @@ -81,8 +81,9 @@ struct SpecStruct { /*@owned@*/ struct OpenFileInfo *fileStack; char lbuf[BUFSIZ]; - char *line; + char nextpeekc; char *nextline; + char *line; int lineNum; /*@only@*/ struct ReadLevelEntry *readStack; diff --git a/po/rpm.pot b/po/rpm.pot index cbb3766..9eff7c1 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 1999-07-19 14:32-0400\n" +"POT-Creation-Date: 1999-07-19 17:14-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1861,49 +1861,49 @@ msgstr "" msgid "line %d: Second %s" msgstr "" -#: ../build/parseSpec.c:119 +#: ../build/parseSpec.c:120 #, c-format msgid "line %d: %s" msgstr "" -#: ../build/parseSpec.c:159 +#: ../build/parseSpec.c:166 #, c-format msgid "Unable to open: %s\n" msgstr "" -#: ../build/parseSpec.c:171 +#: ../build/parseSpec.c:178 msgid "Unclosed %%if" msgstr "" -#: ../build/parseSpec.c:230 +#: ../build/parseSpec.c:237 #, c-format msgid "%s:%d: parseExpressionBoolean returns %d" msgstr "" #. Got an else with no %if ! -#: ../build/parseSpec.c:238 +#: ../build/parseSpec.c:245 msgid "%s:%d: Got a %%else with no if" msgstr "" #. Got an end with no %if ! -#: ../build/parseSpec.c:249 +#: ../build/parseSpec.c:256 msgid "%s:%d: Got a %%endif with no if" msgstr "" -#: ../build/parseSpec.c:263 ../build/parseSpec.c:272 +#: ../build/parseSpec.c:270 ../build/parseSpec.c:279 msgid "malformed %%include statement" msgstr "" -#: ../build/parseSpec.c:353 +#: ../build/parseSpec.c:360 #, c-format msgid "Timecheck value must be an integer: %s" msgstr "" -#: ../build/parseSpec.c:436 +#: ../build/parseSpec.c:443 msgid "No buildable architectures" msgstr "" -#: ../build/parseSpec.c:481 +#: ../build/parseSpec.c:488 msgid "Package has no %%description: %s" msgstr "" -- 2.7.4