Added helpful hints
This commit is contained in:
21
cmd/shell.c
21
cmd/shell.c
@@ -8,6 +8,8 @@ int main() {
|
||||
int status_return = 0;
|
||||
char *cmd;
|
||||
char **args;
|
||||
int numFail = 0;
|
||||
int numSuccess = 0;
|
||||
|
||||
init_shell();
|
||||
|
||||
@@ -18,6 +20,25 @@ int main() {
|
||||
|
||||
free(cmd);
|
||||
free(args);
|
||||
|
||||
// Check exit status for feedback
|
||||
if ( status_return > 0 ) {
|
||||
numFail++;
|
||||
// Check for fail help messages
|
||||
if ( numFail == 2 ) {
|
||||
printf("Have you read the output of the `author` command?\n");
|
||||
} else if ( numFail == 10 ) {
|
||||
printf("Maybe we try typing backwards?\n");
|
||||
}
|
||||
} else if ( status_return == 0 ) {
|
||||
numSuccess++;
|
||||
// Check for success help messages
|
||||
if ( numSuccess == 4 ) {
|
||||
printf("Might be worth trying to figure out why this is your shell?\n");
|
||||
} else if ( numSuccess == 10 ) {
|
||||
printf("Random trivia: Shells are defined in /etc/passwd\n");
|
||||
}
|
||||
} // else command was NULL and skip
|
||||
} while(status_return != 255);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user