comparison src/xxd/xxd.c @ 4166:d356b5ce84ce v7.3.835

updated for version 7.3.835 Problem: "xxd -i" fails on an empty file. Solution: Do output the closing } for an empty file. (partly by Lawrence Woodman)
author Bram Moolenaar <bram@vim.org>
date Tue, 26 Feb 2013 14:14:07 +0100
parents 25672ad7f377
children 0a379dea13c9
comparison
equal deleted inserted replaced
4165:59b67ae4abc7 4166:d356b5ce84ce
727 p++; 727 p++;
728 } 728 }
729 if (c == EOF && ferror(fp)) 729 if (c == EOF && ferror(fp))
730 die(2); 730 die(2);
731 731
732 if (p) 732 if (p && fputs("\n", fpo) == EOF)
733 if (fputs("\n};\n" + 3 * (fp == stdin), fpo) == EOF) 733 die(3);
734 die(3); 734 if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF)
735 die(3);
735 736
736 if (fp != stdin) 737 if (fp != stdin)
737 { 738 {
738 if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0) 739 if (fprintf(fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : "") < 0)
739 die(3); 740 die(3);