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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to