From: Mark Wooding Date: Fri, 10 Jan 2014 14:46:06 +0000 (+0000) Subject: Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/misc X-Git-Tag: 1.2.9~2 X-Git-Url: https://git.distorted.org.uk/~mdw/misc/commitdiff_plain/ed9fbd4e74d974c1961bcacf7a271bf7f170c9b8?hp=4641d6e29bb77342a80a494484f5575ad39bf3f8 Merge branch 'master' of git.distorted.org.uk:~mdw/publish/public-git/misc * 'master' of git.distorted.org.uk:~mdw/publish/public-git/misc: space.c: Fix trailing-newline misreporting in `-c' mode. space.[c1]: Document the `-v' option finally. --- diff --git a/space.1 b/space.1 index d1dc55a..f38793f 100644 --- a/space.1 +++ b/space.1 @@ -65,6 +65,12 @@ report if the file has trailing blank lines; without .BR \-c , remove these trailing blank lines from the output. .TP +.BR \-v +Report detailed messages about whitespace problems encountered. Useful +with +.BR \-c , +for example. +.TP .BR \-i [ \fIbackup ] Modify all the .IR file s diff --git a/space.c b/space.c index e9fa0df..07ea82a 100644 --- a/space.c +++ b/space.c @@ -220,7 +220,7 @@ static int space(const char *name) nnl = 1; } } - if (fout) while (nnl--) putc('\n', fout); + if (fout) while (nnl--) putc('\n', fout); else nnl = 0; } goto end; case '\n': @@ -237,7 +237,8 @@ static int space(const char *name) else if (fout) { while (nnl) { putc('\n', fout); nnl--; } putc(ch, fout); - } + } else + nnl = 0; f |= f_newline; f &= ~(f_tab | f_warnspacetab | f_warntabs | f_warnspaces); if (flags & F_TABIFY) @@ -247,7 +248,7 @@ static int space(const char *name) last = '\n'; break; default: - if (fout) while (nnl) { putc('\n', fout); nnl--; } + if (fout) while (nnl) { putc('\n', fout); nnl--; } else nnl = 0; if (nwsp) { if (flags & F_UNTABIFY) { if (fout) for (; ohpos < hpos; ohpos++) putc(' ', fout); @@ -365,6 +366,7 @@ int main(int argc, char *argv[]) -m Fix spaces followed by tabs in mid-line\n\ -t Tabify file completely\n\ -u Untabify file completely\n\ + -v Report verbose messages\n\ -i[BKP] Modify files in place; leave FILEBKP as copy of old FILE\n\ ", stdout); exit(0);