maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
unset.c File Reference
#include "shell.h"
#include "env.h"
#include "libft.h"
#include <unistd.h>
#include "exit_status.h"
#include <stdio.h>
Include dependency graph for unset.c:

Go to the source code of this file.

Functions

int builtin_unset (t_ms_data *data)
 

Function Documentation

◆ builtin_unset()

int builtin_unset ( t_ms_data data)

Definition at line 29 of file unset.c.

30{
31 int i;
32 char *key;
33
34 i = 0;
35 while (data->args[++i])
36 {
37 key = data->args[i];
38 if (unset_env(&data->envp, key) == -1)
39 {
40 return (EXIT_SUCCESS);
41 }
42 }
43 return (EXIT_SUCCESS);
44}
int unset_env(t_env **env, const char *name)
Definition env.c:96
#define EXIT_SUCCESS
Definition exit_status.h:16
t_env * envp
Definition shell.h:24
char ** args
Definition shell.h:23

References s_ms_data::args, s_ms_data::envp, EXIT_SUCCESS, and unset_env().

Referenced by execute().

Here is the call graph for this function:
Here is the caller graph for this function: