diff --git a/Assignment1/.idea/runConfigurations/Assignment1.xml b/Assignment1/.idea/runConfigurations/Assignment1.xml index 725844c..351a202 100644 --- a/Assignment1/.idea/runConfigurations/Assignment1.xml +++ b/Assignment1/.idea/runConfigurations/Assignment1.xml @@ -1,5 +1,5 @@ - + diff --git a/Assignment1/.idea/runConfigurations/For_Testing.xml b/Assignment1/.idea/runConfigurations/For_Testing.xml index 20c9e8c..58eb5d6 100644 --- a/Assignment1/.idea/runConfigurations/For_Testing.xml +++ b/Assignment1/.idea/runConfigurations/For_Testing.xml @@ -1,5 +1,5 @@ - + diff --git a/Assignment1/.idea/runConfigurations/Test.xml b/Assignment1/.idea/runConfigurations/Test.xml index 4dfb1db..7b75734 100644 --- a/Assignment1/.idea/runConfigurations/Test.xml +++ b/Assignment1/.idea/runConfigurations/Test.xml @@ -13,7 +13,7 @@ \ No newline at end of file diff --git a/Assignment1/main.c b/Assignment1/main.c index 3b36ea6..c9ecc85 100644 --- a/Assignment1/main.c +++ b/Assignment1/main.c @@ -16,7 +16,12 @@ int main() { bool stopLoop = false; while (!stopLoop) { - fgets(buffer, MAX_LEN * 2, stdin); + char *result = fgets(buffer, MAX_LEN * 2, stdin); + if (result == NULL) { + // If we get null, there has been an error reading from stdin + fprintf(stderr, "Error reading from stdin\n"); + return EXIT_FAILURE; + } buffer[strcspn(buffer, "\r\n")] = 0; if (buffer[0] == 'a') { buffer[MAX_LEN - 1] = '\0'; // Prevent buffer overflow diff --git a/Assignment1/tests/build.ps1 b/Assignment1/tests/build.ps1 index a2617c2..8c3b405 100644 --- a/Assignment1/tests/build.ps1 +++ b/Assignment1/tests/build.ps1 @@ -1,3 +1,3 @@ -ssh ishoebot@remotelabm35.cs.unb.ca "cd ~/build/; rm -rf $($args[0]); mkdir $($args[0])" +ssh ishoebot@remotelabm35.cs.unb.ca "cd ~/build/; rm -rf $($args[0])/; mkdir $($args[0])" scp -r $(Get-Location) ishoebot@remotelabm35.cs.unb.ca:~/build/ ssh ishoebot@remotelabm35.cs.unb.ca "cd ~/build/$($args[0])/; rm -rf build/; chmod +x ./tests/build.sh; ./tests/build.sh $($args[0])" \ No newline at end of file diff --git a/Assignment1/tests/build.sh b/Assignment1/tests/build.sh index 68836d6..107d249 100644 --- a/Assignment1/tests/build.sh +++ b/Assignment1/tests/build.sh @@ -1,5 +1,5 @@ cd ~/build/"$1"/ || exit mkdir build cd build || exit -cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" ../ +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -G "CodeBlocks - Unix Makefiles" ../ make \ No newline at end of file