aboutsummaryrefslogtreecommitdiff
path: root/src/error.c
blob: 2ca60b24b1aac61e6c407879bfec6028c6ff7277 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   error.c                                            :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2025/01/15 16:35:53 by dkaiser           #+#    #+#             */
/*   Updated: 2025/01/20 18:12:40 by dkaiser          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "minishell.h"
#include <errno.h>

void	*error(int err_code, char *err_text, int exit_code, int *ret_code)
{
	errno = err_code;
	perror(err_text);
	if (ret_code != NULL)
		*ret_code = exit_code;
	return (NULL);
}

void	command_not_found_error(char *cmd)
{
	ft_printf("%s:", cmd);
	ft_putstr_fd(" command not found", 2);
	ft_printf("\n");
}