build/unix/print-non-newline.sh

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/unix/print-non-newline.sh	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +#!/bin/sh
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +
     1.9 +#
    1.10 +# The purpose of this file is to find the files that do not end with a
    1.11 +# newline.  Some compilers fail if the source files do not end with a
    1.12 +# newline.
    1.13 +#
    1.14 +
    1.15 +#
    1.16 +test_file=newline_test
    1.17 +test_dummy=newline_testee
    1.18 +inlist="$*"
    1.19 +broken_list=
    1.20 +
    1.21 +if test "$inlist" = ""; then
    1.22 +    echo "Usage: $0 *.c *.cpp";
    1.23 +    exit 0;
    1.24 +fi
    1.25 +
    1.26 +echo "" > $test_file
    1.27 +
    1.28 +for f in $inlist; do
    1.29 +    if test -f $f; then
    1.30 +	tail -c 1 $f > $test_dummy
    1.31 +	if ! `cmp -s $test_file $test_dummy`; then
    1.32 +	    broken_list="$broken_list $f"
    1.33 +        fi
    1.34 +    fi
    1.35 +done
    1.36 +
    1.37 +rm -f $test_file $test_dummy
    1.38 +echo $broken_list

mercurial