inhibitors working but pre process made by aliases makes some limits

This commit is contained in:
Clément Le Bihan
2020-05-20 12:12:07 +02:00
parent 04403899b8
commit 9de01be5d1
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -14,4 +14,5 @@ typedef struct parser_map {
int (*parser)(char *, char **);
} parser_map;
char **parse_input(char *cmd);
int parse_quotes(char *ptr, char **data);
+2 -1
View File
@@ -10,6 +10,7 @@
#include "redirections.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
@@ -77,7 +78,7 @@ char **parse_input(char *cmd)
new = strndup(ptr, inc);
if (!new)
return (NULL);
new[strlen(new) - 1] = '\0';
new[inc - 1] = '\0';
ret[ret_inc++] = new;
ptr = cmd + i + 1;
inc = 0;
+7 -1
View File
@@ -10,6 +10,7 @@
#include "shell.h"
#include "builtin.h"
#include "redirections.h"
#include "parser.h"
#include "utility.h"
#include <unistd.h>
#include <malloc.h>
@@ -32,8 +33,13 @@ const builtin builtins[] = {
int prompt_run(char *cmd, redirection *inout[2], env_t *env)
{
char **argv = get_argv(cmd);
//char **argv = get_argv(cmd);
char **argv = parse_input(cmd);
for (int i = 0; argv[i]; i++) {
printf("'%s'\n", argv[i]);
}
return (0);
if (!argv) {
perror("mysh");
return (-1);