expand twiddles in macrofiles list.

CVS patchset: 2931
CVS date: 1999/03/31 16:57:01
This commit is contained in:
jbj 1999-03-31 16:57:01 +00:00
parent b4dfd488b0
commit f0a088596e
4 changed files with 42 additions and 15 deletions

View File

@ -14,6 +14,7 @@
- fix: create ppc directories correctly.
- (re-)enable fixowner/fixgroup macros.
- fix: specfile BuildRoot was masking rpmrc macro.
- expand twiddles in macrofiles list.
2.91 -> 2.92
- update with libtool-2.4f.

View File

@ -1144,7 +1144,7 @@ rpmDefineMacro(MacroContext *mc, const char *macro, int level)
}
void
initMacros(MacroContext *mc, const char *macrofile)
initMacros(MacroContext *mc, const char *macrofiles)
{
char *m, *mfile, *me;
static int first = 1;
@ -1157,10 +1157,10 @@ initMacros(MacroContext *mc, const char *macrofile)
first = 0;
}
if (macrofile == NULL)
if (macrofiles == NULL)
return;
for (mfile = m = strdup(macrofile); *mfile; mfile = me) {
for (mfile = m = strdup(macrofiles); *mfile; mfile = me) {
FILE *fp;
char buf[BUFSIZ];
@ -1169,7 +1169,20 @@ initMacros(MacroContext *mc, const char *macrofile)
else
me = mfile + strlen(mfile);
if ((fp=fopen(mfile, "r")) == NULL)
/* Expand ~/ to $HOME */
buf[0] = '\0';
if (mfile[0] == '~' && mfile[1] == '/') {
char *home;
if ((home = getenv("HOME")) != NULL) {
mfile += 2;
strncpy(buf, home, sizeof(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
}
}
strncat(buf, mfile, sizeof(buf) - strlen(buf));
buf[sizeof(buf)-1] = '\0';
if ((fp=fopen(buf, "r")) == NULL)
continue;
/* XXX Assume new fangled macro expansion */
@ -1346,7 +1359,7 @@ rpmGetPath(const char *path, ...)
#ifdef DEBUG_MACROS
MacroContext mc = { NULL, 0, 0};
char *macrofile = "./paths:./environment:./macros";
char *macrofiles = "./paths:./environment:./macros";
char *testfile = "./test";
int
@ -1356,7 +1369,7 @@ main(int argc, char *argv[])
FILE *fp;
int x;
initMacros(&mc, macrofile);
initMacros(&mc, macrofiles);
dumpMacroTable(&mc, NULL);
if ((fp = fopen(testfile, "r")) != NULL) {

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-03-31 08:13-0500\n"
"POT-Creation-Date: 1999-03-31 11:39-0500\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"
@ -2597,12 +2597,12 @@ msgstr ""
msgid "Target buffer overflow"
msgstr ""
#: ../lib/macro.c:1225 ../lib/macro.c:1233
#: ../lib/macro.c:1239 ../lib/macro.c:1247
#, c-format
msgid "File %s: %s"
msgstr ""
#: ../lib/macro.c:1236
#: ../lib/macro.c:1250
#, c-format
msgid "File %s is smaller than %d bytes"
msgstr ""

View File

@ -1144,7 +1144,7 @@ rpmDefineMacro(MacroContext *mc, const char *macro, int level)
}
void
initMacros(MacroContext *mc, const char *macrofile)
initMacros(MacroContext *mc, const char *macrofiles)
{
char *m, *mfile, *me;
static int first = 1;
@ -1157,10 +1157,10 @@ initMacros(MacroContext *mc, const char *macrofile)
first = 0;
}
if (macrofile == NULL)
if (macrofiles == NULL)
return;
for (mfile = m = strdup(macrofile); *mfile; mfile = me) {
for (mfile = m = strdup(macrofiles); *mfile; mfile = me) {
FILE *fp;
char buf[BUFSIZ];
@ -1169,7 +1169,20 @@ initMacros(MacroContext *mc, const char *macrofile)
else
me = mfile + strlen(mfile);
if ((fp=fopen(mfile, "r")) == NULL)
/* Expand ~/ to $HOME */
buf[0] = '\0';
if (mfile[0] == '~' && mfile[1] == '/') {
char *home;
if ((home = getenv("HOME")) != NULL) {
mfile += 2;
strncpy(buf, home, sizeof(buf));
strncat(buf, "/", sizeof(buf) - strlen(buf));
}
}
strncat(buf, mfile, sizeof(buf) - strlen(buf));
buf[sizeof(buf)-1] = '\0';
if ((fp=fopen(buf, "r")) == NULL)
continue;
/* XXX Assume new fangled macro expansion */
@ -1346,7 +1359,7 @@ rpmGetPath(const char *path, ...)
#ifdef DEBUG_MACROS
MacroContext mc = { NULL, 0, 0};
char *macrofile = "./paths:./environment:./macros";
char *macrofiles = "./paths:./environment:./macros";
char *testfile = "./test";
int
@ -1356,7 +1369,7 @@ main(int argc, char *argv[])
FILE *fp;
int x;
initMacros(&mc, macrofile);
initMacros(&mc, macrofiles);
dumpMacroTable(&mc, NULL);
if ((fp = fopen(testfile, "r")) != NULL) {