Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. /*
  2. ** EPITECH PROJECT, 2018
  3. ** main.c
  4. ** File description:
  5. ** main.c
  6. */
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include "include/gnl.h"
  10. #include "include/my.h"
  11.  
  12. int get_path(char **env)
  13. {
  14. char *str;
  15. int i = 0;
  16. int j = 0;
  17. int x = 0;
  18.  
  19. while (env[i][j]) {
  20. if (env[i][j] != 'P' && env[i][j] != 'A' && env[i][j] != 'T' && env[i][j] != 'H')
  21. while (env[i][j] != '\n') {
  22. str[x] = env[i][j];
  23. j++;
  24. }
  25. i++;
  26. }
  27. return (str);
  28. }
  29.  
  30. int interpreteur(char *str, char **env)
  31. {
  32.  
  33. int *str2;
  34.  
  35. my_strcat(str2, str);
  36. my_putstr(str2);
  37. }
  38.  
  39.  
  40. int entered_line(char **PATH)
  41. {
  42. char *buffer;
  43. size_t bufsize = 32;
  44. size_t characters;
  45.  
  46. int *cwd;
  47. int s = 0;
  48. int end = 0;
  49.  
  50. buffer = (char *)malloc(bufsize * sizeof(char));
  51. while (!end) {
  52. printf("Solthario's Shell: ");
  53. getline(&buffer, &bufsize, stdin);
  54. cwd = get_path(PATH);
  55. my_putstr(buffer);
  56. my_putstr(cwd);
  57. //interpreteur(buffer, env);
  58. end = !end;
  59. }
  60. return (0);
  61. }
  62. int main(int ac, char **av, char **env)
  63. {
  64. char *str = get_path(env);
  65. entered_line(str);
  66. return (0);
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement