Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ** EPITECH PROJECT, 2018
- ** main.c
- ** File description:
- ** main.c
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include "include/gnl.h"
- #include "include/my.h"
- int get_path(char **env)
- {
- char *str;
- int i = 0;
- int j = 0;
- int x = 0;
- while (env[i][j]) {
- if (env[i][j] != 'P' && env[i][j] != 'A' && env[i][j] != 'T' && env[i][j] != 'H')
- while (env[i][j] != '\n') {
- str[x] = env[i][j];
- j++;
- }
- i++;
- }
- return (str);
- }
- int interpreteur(char *str, char **env)
- {
- int *str2;
- my_strcat(str2, str);
- my_putstr(str2);
- }
- int entered_line(char **PATH)
- {
- char *buffer;
- size_t bufsize = 32;
- size_t characters;
- int *cwd;
- int s = 0;
- int end = 0;
- buffer = (char *)malloc(bufsize * sizeof(char));
- while (!end) {
- printf("Solthario's Shell: ");
- getline(&buffer, &bufsize, stdin);
- cwd = get_path(PATH);
- my_putstr(buffer);
- my_putstr(cwd);
- //interpreteur(buffer, env);
- end = !end;
- }
- return (0);
- }
- int main(int ac, char **av, char **env)
- {
- char *str = get_path(env);
- entered_line(str);
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement