diff options
author | Bram Moolenaar <bram@vim.org> | 2013-02-26 14:14:07 +0100 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-02-26 14:14:07 +0100 |
commit | 8290e2ac244cfe6a5925a53ca4c526effcb7a7fc (patch) | |
tree | 187b219c842d742f2bbb09472a85304b25a1cfb0 | |
parent | 78b425b0e747ddb8bd7cd29d8646796314ffc605 (diff) | |
download | vim-8290e2ac244cfe6a5925a53ca4c526effcb7a7fc.tar.gz |
Problem: "xxd -i" fails on an empty file.
Solution: Do output the closing } for an empty file. (partly by Lawrence
Woodman)
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/xxd/xxd.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/version.c b/src/version.c index 309732af..f1a09092 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 835, +/**/ 834, /**/ 833, diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index 85300dc9..209ede43 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -729,9 +729,10 @@ main(argc, argv) if (c == EOF && ferror(fp)) die(2); - if (p) - if (fputs("\n};\n" + 3 * (fp == stdin), fpo) == EOF) - die(3); + if (p && fputs("\n", fpo) == EOF) + die(3); + if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF) + die(3); if (fp != stdin) { |