msh.c
int cdhandle(char *args[]) {
    if(args[1] == NULL) {
        chdir(getenv("HOME"));
        return 1;
    }
/*
    if(strcmp(args[1], "..") == 0) {
        // go back a directory TODO
        char cwd[1024];
        printf("%s\n", getcwd(cwd, 1024));
        int i = 0;
        while(cwd[i]!='\0') {
            i++;
        }
        for(; i>0; i--) {
            if(cwd[i] == '/') {
                cwd[i] = '\0';
                break;
            }
        }
        chdir(cwd);
        return 1;
    }*/ else {
        if(chdir(args[1]) == -1) {
            printf("Invalid directory path.\n");
            return 1;
        }
    }

    return 0;
}
//handles cd command , takes in parameters of the call
handles cd command , takes in parameters of the call
handles cd command takes in parameters of the call
int cdhandle(char *args[]) {
    if(args[1] == NULL) {
        chdir(getenv("HOME"));
        return 1;
    }
 else {
        if(chdir(args[1]) == -1) {
            printf("Invalid directory path.\n");
            return 1;
        }
    }
    return 0;
}
int cdhandle ( char * args [ ] ) { if ( args [ 1 ] == NULL ) { chdir ( getenv ( " " ) ) ; return 1 ; } else { if ( chdir ( args [ 1 ] ) == -1 ) { printf ( " \n " ) ; return 1 ; } } return 0 ; }
handles cd command , takes in parameters of the call
handles cd command takes in parameters of the call
/*
    if(strcmp(args[1], "..") == 0) {
        // go back a directory TODO
        char cwd[1024];
        printf("%s\n", getcwd(cwd, 1024));
        int i = 0;
        while(cwd[i]!='\0') {
            i++;
        }
        for(; i>0; i--) {
            if(cwd[i] == '/') {
                cwd[i] = '\0';
                break;
            }
        }
        chdir(cwd);
        return 1;
    }*/