lkml.org 
[lkml]   [2007]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] cleanfile: a script to clean up stealth whitespace
Date
Lundi 12 mars 2007, vers 20:16:30 (+0100), H. Peter Anvin a écrit:

> This script cleans up various classes of stealth whitespace. In
> particular, it cleans up:
>
> - Whitespace (spaces or tabs)before newline;
> - DOS line endings (CR before LF);
> - Space before tab (spaces are deleted or converted to tabs);
> - Empty lines at end of file.

What about checking for a newline at end of file? Something like:

[...]

> + if ($is_binary) {
> + print STDERR "$name: $f: binary file\n";
> + next;
> + }

# Add a newline at end of file, if needed.
seek(FILE, -1, 2);
if (read(FILE, $last_char, 1) == 1 && $last_char ne "\n") {
seek(FILE, 0, 2);
print FILE "\n";
}

> + seek(FILE, 0, 0);
> +
> + $in_bytes = 0;
> + $out_bytes = 0;
> + $blank_bytes = 0;

[...]

Regards,
Arnaud Giersch
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-13 15:21    [W:1.481 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site