-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp_cmd.c
More file actions
executable file
·107 lines (83 loc) · 2.36 KB
/
help_cmd.c
File metadata and controls
executable file
·107 lines (83 loc) · 2.36 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include "main.h"
#include "main.h"
/**
* general_help - help info
*/
void general_help(void)
{
char *help = "$ bash, version 1.0(1)-release\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "These commands are defined internally.Type 'help' to see the list";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "Type 'help name' to find out more about the function 'name'.\n\n ";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = " alias: alias [name=['string']]\n cd: cd [-L|[-P [-e]] [-@]] ";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "[dir]\nexit: exit [n]\n env: env [option] [name=value] [command ";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "[args]]\n setenv: setenv [variable] [value]\n unsetenv: ";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "unsetenv [variable]\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
}
/**
* help_only - Help info
*/
void help_only(void)
{
char *help = "help: help [-dms] [pattern ...]\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "\tDisplay information about builtin commands.\n ";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "Displays brief summaries of builtin commands.\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
}
/**
* help_env - Help info
*/
void help_env(void)
{
char *help = "env: env [option] [name=value] [command [args]]\n\t";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "Print the enviroment of the shell.\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
}
/**
* help_setenv - Help info
*/
void help_setenv(void)
{
char *help = "setenv: setenv (const char *name, const char *value,";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "int replace)\n\t";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "Add a new definition to the environment\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
}
/**
* help_unsetenv - Help info
*/
void help_unsetenv(void)
{
char *help = "unsetenv: unsetenv (const char *name)\n\t";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
help = "Remove an entry completely from the environment\n";
write(STDOUT_FILENO, help, _strlen(help));
fflush(stdout);
}