/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   last_exit_status.c                                 :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: lperrey <lperrey@student.42.fr>            +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2021/11/26 19:02:27 by lperrey           #+#    #+#             */
/*   Updated: 2021/11/26 20:48:11 by lperrey          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "minishell.h"

int	set_last_exit_status(int new_value) 
{
	static int	last_exit_status = 0;

	if (new_value >= 0)
		last_exit_status = new_value;
	return (last_exit_status);
}

int	get_last_exit_status(void)
{
	return (set_last_exit_status(-1));
}

/* void	ALT_set_last_exit_status(int new_value, int *set_last_exit_status_ptr)
{
	static int	*last_exit_status_ptr = NULL;

	if (set_last_exit_status_ptr)
		last_exit_status_ptr = set_last_exit_status_ptr;
	else if (new_value >= 0)
		*last_exit_status_ptr = new_value;
} */
