Error handlng

This commit is contained in:
Timo Schmidt 2023-03-31 18:51:18 +02:00
parent 6943a42990
commit b7ae8b79c9
1 changed files with 8 additions and 3 deletions

11
.bashrc
View File

@ -149,11 +149,16 @@ timoulinette () {
git_full="${git_base}/${subject}/${ex}/${test_file_name}" git_full="${git_base}/${subject}/${ex}/${test_file_name}"
# Name of the C testfile # Name of the C testfile
download_file_name="./timo_moulinette_${subject}_${ex}_${test_file_name}" download_file_name="./timoulinette${subject}_${ex}_${test_file_name}"
# Download tesfile # Download tesfile
curl -sL "${git_full}" -o "${download_file_name}" curl -sL "${git_full}" -o "${download_file_name}"
if [ ! "${?}" = "1" ] ; then
printf '%s\n' "There's now testfile for this task, sorry!"
return
fi
# Preprocess source file (remove comments) # Preprocess source file (remove comments)
${CC} -dD -E -o "${file_name}.nocomments" -- "${file_name}" ${CC} -dD -E -o "${file_name}.nocomments" -- "${file_name}"
@ -181,7 +186,7 @@ timoulinette () {
guard_name="$(safe_guard_name "${macro}")" guard_name="$(safe_guard_name "${macro}")"
# Endif include guard # Endif include guard
printf '%s\n' "#endif" | cat -- - "${download_file_name}" > ".tmpaddfirstlinefile.c" printf '%s\n\n' "#endif" | cat -- - "${download_file_name}" > ".tmpaddfirstlinefile.c"
mv -- ".tmpaddfirstlinefile.c" "${download_file_name}" mv -- ".tmpaddfirstlinefile.c" "${download_file_name}"
# The macro itself # The macro itself
@ -199,7 +204,7 @@ timoulinette () {
IFS="$(printf ' \n\t')" IFS="$(printf ' \n\t')"
# Compile # Compile
out_binary="timo_moulinette_${subject}_${ex}_$(basename -- "${test_file_name}" .c).out" out_binary="timoulinette${subject}_${ex}_$(basename -- "${test_file_name}" .c).out"
${CC} -Wall -Wextra -Werror -o "${out_binary}" -xc -- *.c ${CC} -Wall -Wextra -Werror -o "${out_binary}" -xc -- *.c
err_code="${?}" err_code="${?}"