From 2beb742f95f5ff5f9f22670d06632ede41e02a57 Mon Sep 17 00:00:00 2001 From: abraham5500 <127844431+abraham5500@users.noreply.github.com> Date: Mon, 24 Jun 2024 11:06:08 +0200 Subject: [PATCH 1/6] Update autotest-validate.c --- examples/autotest-validate/autotest-validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/autotest-validate/autotest-validate.c b/examples/autotest-validate/autotest-validate.c index 4ff9fb5..1055724 100644 --- a/examples/autotest-validate/autotest-validate.c +++ b/examples/autotest-validate/autotest-validate.c @@ -27,5 +27,5 @@ bool this_function_returns_false() */ const char *my_username() { - return "todo-please-enter-your-username-here-in-my_username"; + return "abraham5500"; } From ce8017763147a09e87b070768da260894273a4c2 Mon Sep 17 00:00:00 2001 From: abraham5500 <127844431+abraham5500@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:15:02 +0200 Subject: [PATCH 2/6] Update autotest-validate.c --- examples/autotest-validate/autotest-validate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/autotest-validate/autotest-validate.c b/examples/autotest-validate/autotest-validate.c index 1055724..c8af7ac 100644 --- a/examples/autotest-validate/autotest-validate.c +++ b/examples/autotest-validate/autotest-validate.c @@ -27,5 +27,6 @@ bool this_function_returns_false() */ const char *my_username() { - return "abraham5500"; + return "todo-please-enter-your-username-here-in-my_username"; +} } From edda2e76824db8a5b6f9e677f03ed02ed607a8cd Mon Sep 17 00:00:00 2001 From: abraham5500 <127844431+abraham5500@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:16:01 +0200 Subject: [PATCH 3/6] Update autotest-validate.c --- examples/autotest-validate/autotest-validate.c | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/autotest-validate/autotest-validate.c b/examples/autotest-validate/autotest-validate.c index c8af7ac..4ff9fb5 100644 --- a/examples/autotest-validate/autotest-validate.c +++ b/examples/autotest-validate/autotest-validate.c @@ -29,4 +29,3 @@ const char *my_username() { return "todo-please-enter-your-username-here-in-my_username"; } -} From a1c7aaaf9cd4e62da2a226941ccdb35f66888d9b Mon Sep 17 00:00:00 2001 From: abraham5500 Date: Wed, 26 Jun 2024 15:20:05 +0200 Subject: [PATCH 4/6] username changes --- conf/username.txt | 2 +- examples/autotest-validate/autotest-validate.c | 3 ++- student-test/assignment1/Test_validate_username.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/conf/username.txt b/conf/username.txt index d37e02c..bb7b199 100644 --- a/conf/username.txt +++ b/conf/username.txt @@ -1 +1 @@ -your-github-username-here-in-conf-file +abraham5500 diff --git a/examples/autotest-validate/autotest-validate.c b/examples/autotest-validate/autotest-validate.c index 4ff9fb5..d14ec84 100644 --- a/examples/autotest-validate/autotest-validate.c +++ b/examples/autotest-validate/autotest-validate.c @@ -27,5 +27,6 @@ bool this_function_returns_false() */ const char *my_username() { - return "todo-please-enter-your-username-here-in-my_username"; +// return "todo-please-enter-your-username-here-in-my_username"; + return "abraham5500"; } diff --git a/student-test/assignment1/Test_validate_username.c b/student-test/assignment1/Test_validate_username.c index f2882da..303188e 100644 --- a/student-test/assignment1/Test_validate_username.c +++ b/student-test/assignment1/Test_validate_username.c @@ -18,5 +18,6 @@ void test_validate_my_username() * TODO: Replace the line below with your code here as described above to verify your /conf/username.txt * config file and my_username() functions are setup properly */ - TEST_ASSERT_TRUE_MESSAGE(false,"AESD students, please fix me!"); + //TEST_ASSERT_TRUE_MESSAGE(false,"AESD students, please fix me!"); + TEST_ASSERT_EQUAL_STRING_MESSAGE(my_username(),malloc_username_from_conf_file(),"Passed"); } From d62da2b94f9a9b5258586e026683665e6c3a1004 Mon Sep 17 00:00:00 2001 From: abraham5500 Date: Wed, 26 Jun 2024 15:32:46 +0200 Subject: [PATCH 5/6] finder changes --- finder-app/finder.sh | 29 +++++++++++++++++++++++++++++ finder-app/writer.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 finder-app/finder.sh create mode 100755 finder-app/writer.sh diff --git a/finder-app/finder.sh b/finder-app/finder.sh new file mode 100755 index 0000000..3f0436f --- /dev/null +++ b/finder-app/finder.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +# Check if both arguments are provided +if [ "$#" -ne 2 ]; then + echo "Error: Two arguments are required." + echo "Usage: $0 " + exit 1 +fi + +# Assign arguments to variables +filesdir=$1 +searchstr=$2 + +# Check if filesdir is a directory +if [ ! -d "$filesdir" ]; then + echo "Error: $filesdir is not a directory" + exit 1 +fi + +# Count the number of files in the directory and its subdirectories +num_files=$(find "$filesdir" -type f | wc -l) + +# Count the number of matching lines in those files +num_matching_lines=$(grep -r "$searchstr" "$filesdir" 2>/dev/null | wc -l) + +# Print the result +echo "The number of files are $num_files and the number of matching lines are $num_matching_lines" + +exit 0 diff --git a/finder-app/writer.sh b/finder-app/writer.sh new file mode 100755 index 0000000..ca1ce3b --- /dev/null +++ b/finder-app/writer.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Check if both arguments are provided +if [ "$#" -ne 2 ]; then + echo "Error: Two arguments are required." + echo "Usage: $0 " + exit 1 +fi + +# Assign arguments to variables +writefile=$1 +writestr=$2 + +# Extract the directory path from the file path +writedir=$(dirname "$writefile") + +# Create the directory path if it doesn't exist +mkdir -p "$writedir" +if [ $? -ne 0 ]; then + echo "Error: Could not create directory $writedir" + exit 1 +fi + +# Write the string to the file, overwriting any existing file +echo "$writestr" > "$writefile" +if [ $? -ne 0 ]; then + echo "Error: Could not write to file $writefile" + exit 1 +fi + +echo "File $writefile created with content: $writestr" +exit 0 From 26684db227d86d1004d0258a3467a90b2eb83458 Mon Sep 17 00:00:00 2001 From: abraham5500 <127844431+abraham5500@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:50:21 +0200 Subject: [PATCH 6/6] Create c-cpp.yml --- .github/workflows/c-cpp.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..fbf32ec --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,23 @@ +name: C/C++ CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: configure + run: ./configure + - name: make + run: make + - name: make check + run: make check + - name: make distcheck + run: make distcheck