-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilt_in_env.c
More file actions
30 lines (28 loc) · 775 Bytes
/
built_in_env.c
File metadata and controls
30 lines (28 loc) · 775 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
#include "main.h"
/**
* _env - prints the environment variables.
*
* @command: the command that the user type.
* @lastSignal: last signal from executed functions.
* @cmdNum: the executed command number.
* @programName: the running executable name.
* @buffer: the original buffer from getline function.
*
* Return: (0) always success, (1) otherwise.
*/
int _env(__attribute__((unused)) Commands * command,
int *lastSignal, int cmdNum, char *programName, char *buffer)
{
size_t index, stringLen;
(void) lastSignal;
(void) buffer;
(void) programName;
(void) cmdNum;
for (index = 0; environ[index] != NULL; index++)
{
stringLen = _strlen(environ[index]);
write(STDOUT_FILENO, environ[index], stringLen);
write(STDOUT_FILENO, "\n", 1);
}
return (0);
}