diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-03-02 13:25:37 +0330 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-03-02 14:03:29 +0330 |
commit | f6993c880345b45abc0f7e7f0bb14dd0ddae0caa (patch) | |
tree | dfe33e64b50f01785ad3f0af6dbcf7d74d9b38a2 /fc-lang | |
parent | abe0e056d5a93dee80d8e964569563dc4d131a90 (diff) |
[fc-lang] Continue parsing after an "include" (#20179)
Diffstat (limited to 'fc-lang')
-rw-r--r-- | fc-lang/fc-lang.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/fc-lang/fc-lang.c b/fc-lang/fc-lang.c index 40f3bfea..8f50133a 100644 --- a/fc-lang/fc-lang.c +++ b/fc-lang/fc-lang.c @@ -138,18 +138,25 @@ scan (FILE *f, char *file, FcCharSetFreezer *freezer) { if (!strncmp (line, "include", 7)) { - file = strchr (line, ' '); - if (!file) - fatal (line, lineno, + FILE *included_f; + char *included_file; + included_file = strchr (line, ' '); + if (!included_file) + fatal (file, lineno, "invalid syntax, expected: include filename"); - while (isspace(*file)) - file++; - f = scanopen (file); - if (!f) - fatal (file, 0, "can't open"); - n = scan (f, file, freezer); - fclose (f); - return n; + while (isspace(*included_file)) + included_file++; + included_f = scanopen (included_file); + if (!included_f) + fatal (included_file, 0, "can't open"); + n = scan (included_f, included_file, freezer); + fclose (included_f); + if (!c) + c = FcCharSetCreate (); + if (!FcCharSetMerge (c, n, NULL)) + fatal (file, lineno, "out of memory"); + FcCharSetDestroy (n); + continue; } if (strchr (line, '-')) { |