diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-11-20 19:17:22 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-11-20 19:17:22 +0400 |
commit | e8e7d57b87e09493a2bb6e2dc7f6d729b85bad5e (patch) | |
tree | 03b9b5b68ecaf558e0215f158c7e99b9c2d6f007 | |
parent | 0c56ea458f9be59827e6aa7649bd72e8001517aa (diff) | |
download | make.old-sunmake.tar.gz |
Eat trailing spaces in sun modesunmake
-rw-r--r-- | read.c | 7 | ||||
-rw-r--r-- | tests/scripts/features/sun-trailing-spaces | 31 |
2 files changed, 38 insertions, 0 deletions
@@ -2418,6 +2418,13 @@ readline (struct ebuffer *ebuf) p[-1] = '\n'; } #endif + /* In SunOS mode strip trailing spaces: */ + if (sun_flag) + { + while ((p - start) > 1 && (p[-2] == ' ' || p[-2] == '\t')) + --p; + p[-1] = '\n'; + } backslash = 0; for (p2 = p - 2; p2 >= start; --p2) diff --git a/tests/scripts/features/sun-trailing-spaces b/tests/scripts/features/sun-trailing-spaces new file mode 100644 index 0000000..347e6ce --- /dev/null +++ b/tests/scripts/features/sun-trailing-spaces @@ -0,0 +1,31 @@ +# -*-perl-*- +$description = "In SunOS mode strip trailing spaces"; + +$details = ""; + +# !!! Note the spaces and tabs after hello !!! +run_make_test(' + +var_with_trailing_space = hello +var_with_trailing_tab = hello +var_with_trailing_tab_space_tab = hello + +space: + @echo "$(var_with_trailing_space)world" +tab: + @echo "$(var_with_trailing_tab)world" +tab_space_tab: + @echo "$(var_with_trailing_tab_space_tab)world" + +', +'space', +"hello world"); + +run_make_test(undef, '--sun space', "helloworld"); +run_make_test(undef, '--sun tab', "helloworld"); +run_make_test(undef, '--sun tab_space_tab', "helloworld"); +run_make_test(undef, 'tab', "hello\tworld"); +run_make_test(undef, 'tab_space_tab', "hello\t \tworld"); + +# This tells the test driver that the perl test script executed properly. +1; |