aboutsummaryrefslogtreecommitdiff
path: root/etc/flncat.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-12-02 15:20:50 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-12-02 15:32:28 +0200
commit9123a024f14da7ce48cdf7f0cadfe6850be7501e (patch)
tree3e2b53306d253f2e4b86a8f0be46ffbc581eb32c /etc/flncat.c
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 (limited to 'etc/flncat.c')
-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.