Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit c9e290a2746ce60edce933ce41d0bb82118fa3ad Author: Raniconduh <clagv.randomgames@gmail.com> Date: Mon Oct 18 20:39:01 2021 +0000 use chdir() instead of setting the PWD environ var diff --git a/src/dir.c b/src/dir.c index fab2201..f136ad2 100644 --- a/src/dir.c +++ b/src/dir.c @@ -46 +47 @@  #include <sys/stat.h>  #include <stdio.h>  #include <stdbool.h> +#include <unistd.h>    #include "dir.h"  #include "io.h" @@ -1217 +1227 @@ void cd_back(void) {   cwd[0] = '/';   cwd[1] = '\0';   } - setenv("PWD", cwd, true); + chdir(cwd);  }     @@ -1317 +1327 @@ void enter_dir(char * name) {   sprintf(cwd, "%s/%s", cwd, name);   else   strcat(cwd, name); - setenv("PWD", cwd, true); + chdir(cwd);  }     diff --git a/src/main.c b/src/main.c index 08a4b79..3d32222 100644 --- a/src/main.c +++ b/src/main.c @@ -36 +37 @@  #include <stdbool.h>  #include <ncurses.h>  #include <string.h> +#include <unistd.h>    #include "commands.h"  #include "main.h" @@ -167 +177 @@ int main(int argc, char ** argv) {   print_path = true;   } else {   cwd = realpath(argv[1], NULL); - setenv("PWD", cwd, true); + chdir(cwd);   }   }   }