Another version of cleanfile/cleanpatch (Re: [PATCH 08/19] scripts: Make cleanfile/cleanpatch warn about long lines)



While i'm against whitespace damaged files or patches since my very
first patch, and don't like brain damaged programmer's tools called
text editors, i also want to encourage UNIX-way of using userspace.

Of course, i might be wrong and foolish. Anyway, what i'm trying to do
is not to become new generation of Visual Perl#(R) implemented in
Java(R) using XML with userspace, that suck.

Many things in XXI century still can be done by tools founded 20-30
years ago. Why not try to?

Here is script proposal and test case, just for interested parties.
--
-o--=O`C info emacs : faq
#oo'L O info make : not found
<___=E M man gcc : not found

Attachment: clean-whitespace.sh
Description: Bourne shell script

# last spaces must NOT be striped to two tabs
tabspace spaces tab spaces tab
# trailing tabs mixed with spaces

2x8 spaces, must be 2xtabs
tab spaces tab, bust be 2 tabs

# more trailing whitespace
bar


## Automatically generated incremental diff
## From: linux-2.6.21-rc4
## To: linux-2.6.21-rc5
## Robot: $Id: make-incremental-diff,v 1.12 2004/01/06 07:19:36 hpa Exp $

--- linux-2.6.21-rc4/Documentation/kernel-parameters.txt 2007-03-25 23:12:16.654792317 +0000
# dont strip trailing whitespace
+++ linux-2.6.21-rc5/Documentation/kernel-parameters.txt 2007-03-25 23:12:21.243287617 +0000
@@ -138,6 +138,12 @@

- int gpio_direction_output(unsigned gpio);
# tab space tab -> tab tab, strip trailing whitespace
+ int gpio_direction_output(unsigned gpio, int value);

The return value is zero for success, else a negative errno. It should
be checked, since the get/set calls don't have error returns and since
misconfiguration is possible. (These calls could sleep.)
# dont touch space

+ tester, add space for wide line ... vided becomes the initial output value.

# end of file, must be one new line
efwef







Relevant Pages

  • Re: sscanf or vsscanf : want to scan a list of integers in c
    ... Is the whitespace significant? ... You can't do that with any standard sscanf(): ... space, tab, newline, or other whitespace: ...
    (comp.lang.c)
  • Text Form Field Too Small
    ... If I click slightly to the right of that field it tries to tab to ... They would have to click directly on the single character because the ... rest of the area is now uneditable whitespace. ... When they edit this field it will either shrink the field down ...
    (microsoft.public.word.docmanagement)
  • Re: Grub not starting Windows
    ... antonio montagnani wrote: ... >> conventionally start with whitespace (a tab), ... >> Phil Schaffner ...
    (Fedora)
  • SUMMARY: simple regex question
    ... > where foo starts the line, there can be one or more whitespace characters ... and the bar, and there can be zero or more whitespace ... > RE that will see a tab character? ... character in a regex, hit the tab key. ...
    (SunManagers)
  • Re: [patch 00/21] mutex subsystem, -V14
    ... > Here is a first pass at a powerpc file for the fast paths just as an ... space vs tab on the above 4 lines ...
    (Linux-Kernel)