summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2014-12-02 13:20:50 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2014-12-02 13:32:28 (GMT)
commit9123a024f14da7ce48cdf7f0cadfe6850be7501e (patch) (side-by-side diff)
tree3e2b53306d253f2e4b86a8f0be46ffbc581eb32c
parent71642ab4e5501d116854ad878f8778380506f6c5 (diff)
downloadeclat-9123a024f14da7ce48cdf7f0cadfe6850be7501e.tar.gz
eclat-9123a024f14da7ce48cdf7f0cadfe6850be7501e.tar.bz2
Fix generation of consolidated format file.
* etc/flncat.c (main): Reset outchars after opening a new file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--etc/flncat.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/etc/flncat.c b/etc/flncat.c
index 5168cd6..6d57956 100644
--- a/etc/flncat.c
+++ b/etc/flncat.c
@@ -83,26 +83,29 @@ main(int argc, char **argv)
while ((c = fgetc(fp)) != EOF && isspace(c))
if (i == 1) fputc(c, stdout);
} while (c != EOF && comment(fp, c, i == 1));
-
- if (outchars) {
- printf(" else ");
- }
-
- while ((c = fgetc(fp)) != EOF) {
- outchars = 1;
- putchar(c);
- if (c == '}') {
- lev = 0;
- while ((c = fgetc(fp)) != EOF &&
- isspace(c)) {
- assert(lev < sizeof(buf));
- buf[lev++] = c;
- }
- if (c == EOF)
- break;
- else {
- buf[lev++] = c;
- fwrite(buf, lev, 1, stdout);
+
+ if (c != EOF) {
+ if (outchars) {
+ printf(" else ");
+ outchars = 0;
+ }
+
+ while ((c = fgetc(fp)) != EOF) {
+ outchars = 1;
+ putchar(c);
+ if (c == '}') {
+ lev = 0;
+ while ((c = fgetc(fp)) != EOF &&
+ isspace(c)) {
+ assert(lev < sizeof(buf));
+ buf[lev++] = c;
+ }
+ if (c == EOF)
+ break;
+ else {
+ buf[lev++] = c;
+ fwrite(buf, lev, 1, stdout);
+ }
}
}
}

Return to:

Send suggestions and report system problems to the System administrator.