-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhelpBuiltIn.c
More file actions
38 lines (38 loc) · 905 Bytes
/
helpBuiltIn.c
File metadata and controls
38 lines (38 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "shell.h"
/**
* helpBuiltIn - finds the desired help page of the builtin
* @file: a string of the desired help page
*
* Return: 1 if page found and -1 if no page is found
*/
int helpBuiltIn(char *file)
{
if (file == NULL || file[0] == '\0')
{
_putstring("Select a built-in: alias, cd, env, exit,");
_putstring(" help, history, setenv, unsetenv\n");
return (-1);
}
if (_strcmp(file, "exit") == 0)
helpExit();
else if (_strcmp(file, "env") == 0)
helpEnv();
else if (_strcmp(file, "setenv") == 0)
helpSetEnv();
else if (_strcmp(file, "unsetenv") == 0)
helpUnsetEnv();
else if (_strcmp(file, "cd") == 0)
helpCD();
else if (_strcmp(file, "help") == 0)
helpHelp();
else if (_strcmp(file, "alias") == 0)
helpAlias();
else if (_strcmp(file, "history") == 0)
helpHistory();
else
{
_putstring("Not a built-in of simple_shell.\n");
return (-1);
}
return (1);
}