Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cd built_in and PWD env var #22

Open
jovanbulck opened this issue Oct 10, 2014 · 1 comment
Open

cd built_in and PWD env var #22

jovanbulck opened this issue Oct 10, 2014 · 1 comment

Comments

@jovanbulck
Copy link
Owner

cd also updates the PWD env var, but the supplied dir can also be relative (. or ..) and should then be resolved in the PWD var. Here's the code:

        case CD: ; // (hackhackhack to allow declarions inside a switch)
            char *dir;
            if (comd->length == 1)
                dir = getenv("HOME");
            else {
                CHK_ARGC("cd",1);
                dir = comd->cmd[1];
            }
            CHK_ERR(chdir(dir), "cd");
            setenv("PWD", dir, 1);   // BUG: dir can be relative and should then be resolved
            return EXIT_SUCCESS;
            break;
@jovanbulck
Copy link
Owner Author

See issue #51 for further discussion

Repository owner locked and limited conversation to collaborators Oct 31, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant