Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jul 2001 15:59:41 +0200
From:      Jens Schweikhardt <schweikh@schweikhardt.net>
To:        hackers@freebsd.org
Subject:   Whitespace at end of line
Message-ID:  <20010715155941.C1165@schweikhardt.net>

next in thread | raw e-mail | index | archive | help

hello, world\n

Dima and /me recently started weeding out white space at end of line for
the man pages. I want to widen the weeding to include as much files as
possible under /usr/src. We currently have 280kbytes (yes, more than a
quarter meg) sitting there; that's counting only the spaces and tabs at
EOL, not the whole line.

I've got a perl script that removes the white space at EOL
automagically, but before I break anything I would like to ask the
combined hacker wisdom if you can think of any occasion where whitespace
at EOL would be significant and must not be removed. The script already
skips non-plain and binary files (as detected by perl's -T/-B file test
operators).

The only case I can think of right now is a file where we have a
backslash followed by whitespace followed by EOL. Removing the
whitespace may change semantics if the file type supports the notion of
backslash continuation lines, eg. a shell script with

	echo foo\      <- with a space after the \
    bar

in it, which would turn to echo "foobar" instead of echo "foo " and
executing bar.

However, C source should be safe to just s/[ \t]+$//g, I can't think of
a valid way to have {backslash whitespace EOL} in C source outside of
comments (where the whitespace can safely be removed because the backslash
has no continuation semantics.)

Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010715155941.C1165>