codecrafters-shell-c

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 814901f0dd9151beec25ba3624259487cb8ab8e6
parent 3cf52192b0ac9b57f6d79d4c5dd7b4bdf163e26f
Author: 5hif7y <[email protected]>
Date:   Mon, 30 Dec 2024 14:37:53 -0300

3 handle invalid commands

Diffstat:
Mapp/main.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/app/main.c b/app/main.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <string.h> int main() { // Flush after every printf @@ -10,5 +11,8 @@ int main() { // Wait for user input char input[100]; fgets(input, 100, stdin); + // task 3 + input[strlen(input) - 1] = '\0'; + printf("%s: command not found\n", input); return 0; }