-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.c
31 lines (28 loc) · 637 Bytes
/
error.c
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
#include "minishell.h"
/**
* not_found - used to print error message when a command has not been found
*
* @argv: argument in position 0
* @count: number of shell iteration we're in
* @string: name of the command that has not been found
* @retVal: value of return
*
* Return: void
*/
void not_found(char *argv, int count, char *string, int *retVal)
{
char *mess = NULL;
int lens;
char *c = NULL;
(void)string;
c = _itoa(count);
mess = _concat(6, argv, ": ", c, ": ", string, ": not found\n");
for (lens = 0; mess[lens] != '\0'; lens++)
{
}
lens++;
write(STDERR_FILENO, mess, lens);
free(c);
free(mess);
*retVal = 127;
}