Commit b02eb37e authored by abenoit's avatar abenoit
Browse files

set stat_loc with execve errno status

parent 6b8cb290
UID PID PENDING BLOCKED IGNORED CAUGHT STAT TTY TIME COMMAND
1001 2372 0000000000000000 0000000000000002 0000000000384000 0000000188013003 Ss pts/0 0:00 zsh
1001 3593 0000000000000000 0000000000000000 0000000000003000 00000001ef804eff T pts/0 0:00 vim src/parsing/check_syntax.c
1001 3713 0000000000000000 0000000000000000 0000000000000000 0000000000000006 S+ pts/0 0:00 ./minishell
1001 3722 0000000000000000 0000000000000002 0000000000384000 0000000188013003 Ss pts/1 0:00 zsh
1001 3770 0000000000000000 0000000000000000 0000000000000000 0000000000010002 S+ pts/1 0:00 sh ./test.sh
1001 3771 0000000000000000 0000000000000000 0000000000000000 00000001f3d1fef9 R+ pts/1 0:00 ps -s
5
\ No newline at end of file
7
\ No newline at end of file
ps -s > base
wc -l base | tr -dc '0-9' | cat > std
ps -s > tested
wc -l tested | tr -dc '0-9' | cat > cur
DIFF=$(diff std cur)
echo $DIFF
while [ 1 ]
do
ps -s > tested
wc -l tested | tr -dc '0-9' | cat > cur
DIFF=$(diff std cur)
if [ "$DIFF" != "" ]
then
cat tested
fi
done
......@@ -60,7 +60,13 @@ static int err_output(int err_code, t_xe *xe)
ft_putstr_fd(": ", STDERR_FILENO); // besoin de faire comme perror?
ft_putendl_fd(strerror(errno), STDERR_FILENO); // strerror error?
if (err_code == EXT_CMD_ERROR)
exit (2);
{
if (errno == ENOENT)
xe->stat_loc = 127;
else if (errno == EACCES || errno == ENOEXEC)
xe->stat_loc = 126;
exit (xe->stat_loc);
}
return (SUCCESS);
}
......
#include <curses.h>
#include <term.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main(int ac, char **av)
{
int val;
char *bp;
char *name;
name = getenv("TERM");
val = tgetent(NULL, name);
printf("%d\n", val);
printf("%s\n", bp);
printf("%s\n", name);
val = setupterm(NULL, STDOUT_FILENO, &errno);
val = tgetnum("co");
printf("%d\n", val);
val = tgetflag("os");
printf("%d\n", val);
bp = tgetstr("cl", NULL);
val = tputs(bp, 90, putchar);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment