aboutsummaryrefslogtreecommitdiff
path: root/src/eval/local.c
blob: 089a0c72da82eb34ce958bf0aa3ef1b38f2eb4ef (plain)
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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   local.c                                            :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <me@cacharle.xyz>                  +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/08/28 16:52:54 by charles           #+#    #+#             */
/*   Updated: 2020/08/28 16:53:04 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "eval.h"

	/* while (ast->cmd_argv != NULL */
	/* 	&& ((t_token*)ast->cmd_argv->data)->tag & TAG_IS_STR */
	/* 	&& utils_start_with_valid_identifier(((t_token*)ast->cmd_argv->data)->content)) */
	/* { */
	/* 	t_ftlst *start; */
    /*  */
	/* 	id = ((t_token*)ast->cmd_argv->data)->content; */
	/* 	*ft_strchr(id, '=') = '\0'; */
	/* 	((t_token*)ast->cmd_argv->data)->content = ft_strchr(id, '\0') + 1; */
	/* 	if (*((t_token*)ast->cmd_argv->data)->content == '\0') */
	/* 		ft_lstpop_front(&ast->cmd_argv, NULL); */
	/* 	else */
	/* 	{ */
	/* 		t_ftlst *curr = ast->cmd_argv; */
	/* 		t_ftlst *prev = curr; */
    /*  */
	/* 		while (curr != NULL */
	/* 				&& ((t_token*)curr->data)->tag & TAG_STICK && ((t_token*)curr->data)->tag & TAG_IS_STR) */
	/* 		{ */
	/* 			prev = curr; */
	/* 			curr = curr->next; */
	/* 		} */
	/* 		if (curr != NULL && ((t_token*)curr->data)->tag & TAG_IS_STR) */
	/* 		{ */
	/* 			prev = curr; */
	/* 			curr = curr->next; */
	/* 		} */
    /*  */
	/* 		start = ast->cmd_argv; */
	/* 		ast->cmd_argv = prev->next; */
	/* 		prev->next = NULL; */
	/* 	} */
    /*  */
	/* 	#<{(| ft_lstiter(start, token_debug); |)}># */
	/* 	#<{(| puts(""); |)}># */
	/* 	#<{(| ft_lstiter(ast->cmd_argv, token_debug); |)}># */
    /*  */
	/* 	char **strs = preprocess(&start, env); */
    /*  */
	/* 	if (env_export(param.env_local, id, strs[0]) == NULL) */
	/* 		return (-1); */
	/* } */
	/* if (ast->cmd_argv == NULL) // FIXME special env not passed to child processes */
	/* { */
	/* 	ft_vecpop(param.env_local, NULL); */
	/* 	if (ft_vecswallow_at(env, env->size - 1, param.env_local) == NULL) */
	/* 	{ */
	/* 		ft_vecdestroy(param.env_local, free); */
	/* 		return (-1); */
	/* 	} */
	/* 	g_last_status = 0; */
	/* 	return (0); */
	/* } */