summaryrefslogtreecommitdiffstats
path: root/src/p_lblock_more.c
blob: ac61605feb0d7b46a972e7ec91220cf62e27a810 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   p_lblock_more.c                                    :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: rbousset <marvin@42.fr>                    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/02/14 17:19:27 by rbousset          #+#    #+#             */
/*   Updated: 2020/02/14 17:19:29 by rbousset         ###   ########lyon.fr   */
/*                                                                            */
/* ************************************************************************** */

#include <stddef.h>

#include "s_struct.h"
#include "u_vars_next.h"

void	p_register_word(char word[], t_msh *msh)
{
	char	val[ARG_MAX];
	char	name[255];
	char	*ptr;
	size_t	i;

	name[0] = '$';
	ptr = word;
	i = 1;
	while (*ptr != '\0' && *ptr != '=')
	{
		name[i] = *ptr;
		i++;
		ptr++;
	}
	name[i] = '\0';
	ptr++;
	i = 0;
	while (*ptr != '\0')
	{
		val[i] = *ptr;
		i++;
		ptr++;
	}
	val[i] = '\0';
	u_subst_var_value(name, val, msh);
}