# HG changeset patch # User Mike Becker # Date 1535046336 -7200 # Node ID 68018eac46c3f3b8bd68667ad409277fb6699877 # Parent ed65f8c73fb235f7af917d97b3fa9fd328b54e4d adds simple tiny test suite and updates license headers diff -r ed65f8c73fb2 -r 68018eac46c3 LICENSE --- a/LICENSE Thu Aug 23 17:58:38 2018 +0200 +++ b/LICENSE Thu Aug 23 19:45:36 2018 +0200 @@ -1,4 +1,4 @@ -Copyright 2017 Mike Becker. All rights reserved. +Copyright 2018 Mike Becker. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff -r ed65f8c73fb2 -r 68018eac46c3 Makefile.am --- a/Makefile.am Thu Aug 23 17:58:38 2018 +0200 +++ b/Makefile.am Thu Aug 23 19:45:36 2018 +0200 @@ -1,4 +1,4 @@ -# Copyright 2017 Mike Becker. All rights reserved. +# Copyright 2018 Mike Becker. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff -r ed65f8c73fb2 -r 68018eac46c3 README --- a/README Thu Aug 23 17:58:38 2018 +0200 +++ b/README Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ cline _________________________________________ - Copyright (C) 2017 Mike Becker + Copyright (C) 2018 Mike Becker Contents: 1) About ................................................................... 12 @@ -47,7 +47,7 @@ 4) License ____________________________________________________________________ -Copyright 2017 Mike Becker. All rights reserved. +Copyright 2018 Mike Becker. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff -r ed65f8c73fb2 -r 68018eac46c3 configure.ac --- a/configure.ac Thu Aug 23 17:58:38 2018 +0200 +++ b/configure.ac Thu Aug 23 19:45:36 2018 +0200 @@ -1,4 +1,4 @@ -# Copyright 2017 Mike Becker. All rights reserved. +# Copyright 2018 Mike Becker. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -22,7 +22,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AC_PREREQ([2.69]) -AC_INIT(cline, 1.1, universe@uap-core.de) +AC_INIT(cline, 1.2, universe@uap-core.de) AM_INIT_AUTOMAKE # Conditionals diff -r ed65f8c73fb2 -r 68018eac46c3 prebuild.sh --- a/prebuild.sh Thu Aug 23 17:58:38 2018 +0200 +++ b/prebuild.sh Thu Aug 23 19:45:36 2018 +0200 @@ -1,4 +1,4 @@ -# Copyright 2017 Mike Becker. All rights reserved. +# Copyright 2018 Mike Becker. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff -r ed65f8c73fb2 -r 68018eac46c3 src/Makefile.am --- a/src/Makefile.am Thu Aug 23 17:58:38 2018 +0200 +++ b/src/Makefile.am Thu Aug 23 19:45:36 2018 +0200 @@ -1,4 +1,4 @@ -# Copyright 2017 Mike Becker. All rights reserved. +# Copyright 2018 Mike Becker. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff -r ed65f8c73fb2 -r 68018eac46c3 src/arguments.c --- a/src/arguments.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/arguments.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,13 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * arguments.c - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "arguments.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/arguments.h --- a/src/arguments.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/arguments.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * arguments.h - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef ARGUMENTS_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/bfile_heuristics.c --- a/src/bfile_heuristics.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/bfile_heuristics.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * bfile_heuristics.c - * - * Created on: 20.10.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "bfile_heuristics.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/bfile_heuristics.h --- a/src/bfile_heuristics.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/bfile_heuristics.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * bfile_heuristics.h - * - * Created on: 20.10.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef BFILE_HEURISTICS_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/cline.c --- a/src/cline.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/cline.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * cline.c - * - * Created on: 23.05.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "cline.h" @@ -58,8 +53,8 @@ "\n -v, --version - print out version information" "\n -V - turn verbose output off, print the result only" "\n\nShortcuts:" - "\n --exclude-cstyle-comments" - "\n = -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\"" + "\n --exclude-cstyle-comments : -E '\\s*//' -e '\\s*/\\*' '\\*/\\s*'" + "\n --exclude-blank-lines : -E '^\\s*$'" "\n\n" "The default call without any options is:" "\n cline ./\n\n" @@ -205,12 +200,14 @@ } if (argflags == 0) { /* SHORTCUTS */ - /* exclude-cstyle-comments */ if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) { add_string(settings->regex->pattern_list, "\\s*//"); add_string(settings->regex->pattern_list, "$"); add_string(settings->regex->pattern_list, "\\s*/\\*"); add_string(settings->regex->pattern_list, "\\*/\\s*"); + } else if (strcmp(argv[t], "--exclude-blank-lines") == 0) { + add_string(settings->regex->pattern_list, "^\\s*$"); + add_string(settings->regex->pattern_list, "$"); } /* Path */ else { diff -r ed65f8c73fb2 -r 68018eac46c3 src/cline.h --- a/src/cline.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/cline.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * cline.h - * - * Created on: 23.05.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CLINE_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/regex_parser.c --- a/src/regex_parser.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/regex_parser.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * regex_parser.c - * - * Created on: 26.01.2012 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "regex_parser.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/regex_parser.h --- a/src/regex_parser.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/regex_parser.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * regex_parser.h - * - * Created on: 26.01.2012 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef REGEX_PARSER_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/scanner.c --- a/src/scanner.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/scanner.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * scanner.c - * - * Created on: 23.05.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ diff -r ed65f8c73fb2 -r 68018eac46c3 src/scanner.h --- a/src/scanner.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/scanner.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * scanner.h - * - * Created on: 23.05.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SCANNER_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/settings.c --- a/src/settings.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/settings.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * settings.c - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "settings.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/settings.h --- a/src/settings.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/settings.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * settings.h - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef SETTINGS_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/stdinc.h --- a/src/stdinc.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/stdinc.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * stdinc.h - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef STDINC_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/string_list.c --- a/src/string_list.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/string_list.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * string_list.c - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "string_list.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/string_list.h --- a/src/string_list.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/string_list.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -21,12 +21,7 @@ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * string_list.h - * - * Created on: 15.09.2011 - * Author: Mike + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef STRING_LIST_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 src/suffix_fnc.c --- a/src/suffix_fnc.c Thu Aug 23 17:58:38 2018 +0200 +++ b/src/suffix_fnc.c Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -22,11 +22,6 @@ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * suffix_fnc.c - * - * Created on: 15.09.2011 - * Author: Mike */ #include "suffix_fnc.h" diff -r ed65f8c73fb2 -r 68018eac46c3 src/suffix_fnc.h --- a/src/suffix_fnc.h Thu Aug 23 17:58:38 2018 +0200 +++ b/src/suffix_fnc.h Thu Aug 23 19:45:36 2018 +0200 @@ -1,6 +1,6 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * Copyright 2017 Mike Becker. All rights reserved. + * Copyright 2018 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -23,10 +23,6 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * suffix_fnc.h - * - * Created on: 15.09.2011 - * Author: Mike */ #ifndef SUFFIX_FNC_H_ diff -r ed65f8c73fb2 -r 68018eac46c3 test/Makefile.am --- a/test/Makefile.am Thu Aug 23 17:58:38 2018 +0200 +++ b/test/Makefile.am Thu Aug 23 19:45:36 2018 +0200 @@ -22,4 +22,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. TESTS = $(check_SCRIPTS) -check_SCRIPTS = total.sh nocomments.sh codeonly.sh \ No newline at end of file +check_SCRIPTS = total.sh nocomments.sh codeonly.sh diff -r ed65f8c73fb2 -r 68018eac46c3 test/codeonly.sh --- a/test/codeonly.sh Thu Aug 23 17:58:38 2018 +0200 +++ b/test/codeonly.sh Thu Aug 23 19:45:36 2018 +0200 @@ -27,5 +27,18 @@ # POSSIBILITY OF SUCH DAMAGE. # -echo "Verifying correctness of total line count." +echo -n "Verifying correctness of code only line count: " +clineprg="$(pwd)/../src/cline" + +cd $srcdir +count=`$clineprg -Vs testfile.c --exclude-cstyle-comments --exclude-blank-lines` +expected=5 + +if [ "$count" -eq "$expected" ]; then + echo "OK." + exit 0; +else + echo "FAIL! $count is not $expected" + exit 1; +fi diff -r ed65f8c73fb2 -r 68018eac46c3 test/nocomments.sh --- a/test/nocomments.sh Thu Aug 23 17:58:38 2018 +0200 +++ b/test/nocomments.sh Thu Aug 23 19:45:36 2018 +0200 @@ -27,5 +27,18 @@ # POSSIBILITY OF SUCH DAMAGE. # -echo "Verifying correctness of total line count." +echo -n "Verifying correctness of line count without comments: " +clineprg="$(pwd)/../src/cline" + +cd $srcdir +count=`$clineprg -Vs testfile.c --exclude-cstyle-comments` +expected=12 + +if [ "$count" -eq "$expected" ]; then + echo "OK." + exit 0; +else + echo "FAIL! $count is not $expected" + exit 1; +fi diff -r ed65f8c73fb2 -r 68018eac46c3 test/testfile.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/testfile.c Thu Aug 23 19:45:36 2018 +0200 @@ -0,0 +1,21 @@ +/* + * Many Files have license headers. + */ +// And add other stuff below. + + +int main(int argc, char* argv) { // comments behind code don't matter + + int zero /* in block comments we are genius enough to + * detect, if there is still some code in the line + */ = 0; + + /* otherwise the whole comment is + * not counted*/ + + // this holds also for this empty line + + return zero; +} + +/* rare case, but must also work: last line is a comment */ \ No newline at end of file diff -r ed65f8c73fb2 -r 68018eac46c3 test/total.sh --- a/test/total.sh Thu Aug 23 17:58:38 2018 +0200 +++ b/test/total.sh Thu Aug 23 19:45:36 2018 +0200 @@ -27,5 +27,18 @@ # POSSIBILITY OF SUCH DAMAGE. # -echo "Verifying correctness of total line count." +echo -n "Verifying correctness of total line count: " +clineprg="$(pwd)/../src/cline" + +cd $srcdir +count=`$clineprg -Vs testfile.c` +expected=21 + +if [ "$count" -eq "$expected" ]; then + echo "OK." + exit 0; +else + echo "FAIL! $count is not $expected" + exit 1; +fi