diff --git a/src/HeaderParser.c b/src/HeaderParser.c index f7ce346..d0171ad 100644 --- a/src/HeaderParser.c +++ b/src/HeaderParser.c @@ -1,3 +1,26 @@ +/* + * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #include #include diff --git a/src/include/HeaderParser.h b/src/include/HeaderParser.h index 072db25..a0ee6e3 100644 --- a/src/include/HeaderParser.h +++ b/src/include/HeaderParser.h @@ -1,4 +1,4 @@ -/** +/* * Copyright (C) 2022-2023 Jordan Bancino <@jordan:bancino.net> * * Permission is hereby granted, free of charge, to any person diff --git a/tools/bin/td b/tools/bin/td index 751e996..022675d 100644 --- a/tools/bin/td +++ b/tools/bin/td @@ -182,20 +182,28 @@ recipe_clean() { rm -r build } -# Format the source code by updating the copyright headers and -# then running indent(1) on each source code file. -recipe_format() { - find . -name '*.c' -or -name '*.h' | while IFS= read -r src; do +# Update copyright comments in sources and header files. +recipe_license() { + find . -name '*.[ch]' | while IFS= read -r src; do if [ -t 1 ]; then - printf "FMT %s%*c\r" $(basename "$src") "16" " " + printf "LICENSE %s%*c\r" $(basename "$src") "16" " " fi - # Update the headers srcHeader=$(grep -n -m 1 '^ \*/' "$src" | cut -d ':' -f 1) head "-n$srcHeader" "$src" | diff -u -p - LICENSE.txt | patch "$src" | grep -v "^Hmm" + done + if [ -t 1 ]; then + printf "%*c\n" "50" " " + fi +} - # Format the source code +# Format source code files by running indent(1) on them. +recipe_format() { + find . -name '*.c' | while IFS= read -r src; do + if [ -t 1 ]; then + printf "FMT %s%*c\r" $(basename "$src") "16" " " + fi if indent "$src"; then rm $(basename "$src").BAK fi diff --git a/tools/src/hdoc.c b/tools/src/hdoc.c index 54a5319..74fb530 100644 --- a/tools/src/hdoc.c +++ b/tools/src/hdoc.c @@ -108,7 +108,7 @@ main(int argc, char **argv) char comment[HEADER_EXPR_MAX]; int isDocumented = 0; - Stream *in = NULL; + Stream *in = NULL; Stream *out = NULL; int opt; @@ -135,7 +135,7 @@ main(int argc, char **argv) if (!in) { StreamPrintf(StreamStderr(), "Error: %s:%s", - optarg, strerror(errno)); + optarg, strerror(errno)); exit = EXIT_FAILURE; goto finish; } @@ -168,7 +168,7 @@ main(int argc, char **argv) if (!out) { StreamPrintf(StreamStderr(), "Error: %s:%s", - optarg, strerror(errno)); + optarg, strerror(errno)); exit = EXIT_FAILURE; goto finish; } @@ -183,7 +183,7 @@ main(int argc, char **argv) if (!*val || *val != '=') { StreamPrintf(StreamStderr(), "Bad register definition: %s", - optarg); + optarg); exit = EXIT_FAILURE; goto finish; }