Lines Matching refs:cwd
153 (d)->cwd = (char *) emalloc((s)->cwd_length+1); \
154 memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
157 efree((s)->cwd);
427 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) in php_is_dir_ok()
438 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) in php_is_file_ok()
447 CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state); in cwd_globals_ctor()
463 char cwd[MAXPATHLEN]; in virtual_cwd_main_cwd_init() local
467 free(main_cwd_state.cwd); in virtual_cwd_main_cwd_init()
471 result = getcwdpath(cwd, NULL, 1); in virtual_cwd_main_cwd_init()
474 char *c=cwd; in virtual_cwd_main_cwd_init()
482 ZeroMemory(&cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
483 result = php_win32_ioutil_getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
485 result = getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
488 cwd[0] = '\0'; in virtual_cwd_main_cwd_init()
491 main_cwd_state.cwd_length = (int)strlen(cwd); in virtual_cwd_main_cwd_init()
493 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { in virtual_cwd_main_cwd_init()
494 cwd[0] = toupper(cwd[0]); in virtual_cwd_main_cwd_init()
497 main_cwd_state.cwd = strdup(cwd); in virtual_cwd_main_cwd_init()
525 …free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably … in virtual_cwd_shutdown()
531 if (CWDG(cwd).cwd == NULL) { in virtual_cwd_activate()
532 CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state); in virtual_cwd_activate()
540 if (CWDG(cwd).cwd != NULL) { in virtual_cwd_deactivate()
541 CWD_STATE_FREE(&CWDG(cwd)); in virtual_cwd_deactivate()
542 CWDG(cwd).cwd = NULL; in virtual_cwd_deactivate()
552 state = &CWDG(cwd); in virtual_getcwd_ex()
569 if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { in virtual_getcwd_ex()
577 memcpy(retval, state->cwd, *length); in virtual_getcwd_ex()
584 if (!state->cwd) { in virtual_getcwd_ex()
590 return estrdup(state->cwd); in virtual_getcwd_ex()
598 char *cwd; in virtual_getcwd() local
600 cwd = virtual_getcwd_ex(&length); in virtual_getcwd()
603 return cwd; in virtual_getcwd()
606 efree(cwd); in virtual_getcwd()
610 if (!cwd) { in virtual_getcwd()
613 memcpy(buf, cwd, length+1); in virtual_getcwd()
614 efree(cwd); in virtual_getcwd()
1298 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1314 if (state->cwd[1] == ':') { in virtual_file_ex()
1317 } else if (IS_UNC_PATH(state->cwd, state->cwd_length)) { in virtual_file_ex()
1320 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1323 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1324 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1327 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1330 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1331 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1340 memcpy(resolved_path, state->cwd, state_cwd_length); in virtual_file_ex()
1441 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1449 state->cwd = (char *) tmp; in virtual_file_ex()
1451 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1462 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1469 state->cwd = (char *) tmp; in virtual_file_ex()
1471 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1476 fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); in virtual_file_ex()
1484 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1526 char cwd[MAXPATHLEN]; in virtual_realpath() local
1530 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1531 if (new_state.cwd == NULL) { in virtual_realpath()
1535 new_state.cwd[0] = '\0'; in virtual_realpath()
1537 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in virtual_realpath()
1538 path = cwd; in virtual_realpath()
1541 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_realpath()
1543 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1544 if (new_state.cwd == NULL) { in virtual_realpath()
1548 new_state.cwd[0] = '\0'; in virtual_realpath()
1555 memcpy(real_path, new_state.cwd, len); in virtual_realpath()
1573 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_filepath_ex()
1576 *filepath = new_state.cwd; in virtual_filepath_ex()
1598 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_fopen()
1605 f = php_win32_ioutil_fopen(new_state.cwd, mode); in virtual_fopen()
1607 f = fopen(new_state.cwd, mode); in virtual_fopen()
1621 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_access()
1628 ret = tsrm_win32_access(new_state.cwd, mode); in virtual_access()
1630 ret = access(new_state.cwd, mode); in virtual_access()
1645 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_utime()
1652 ret = win32_utime(new_state.cwd, buf); in virtual_utime()
1654 ret = utime(new_state.cwd, buf); in virtual_utime()
1668 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chmod()
1686 ret = php_win32_ioutil_chmod(new_state.cwd, mode); in virtual_chmod()
1689 ret = chmod(new_state.cwd, mode); in virtual_chmod()
1703 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chown()
1711 ret = lchown(new_state.cwd, owner, group); in virtual_chown()
1716 ret = chown(new_state.cwd, owner, group); in virtual_chown()
1730 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_open()
1745 f = php_win32_ioutil_open(new_state.cwd, flags, mode); in virtual_open()
1747 f = open(new_state.cwd, flags, mode); in virtual_open()
1751 f = php_win32_ioutil_open(new_state.cwd, flags); in virtual_open()
1753 f = open(new_state.cwd, flags); in virtual_open()
1766 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_creat()
1772 f = creat(new_state.cwd, mode); in virtual_creat()
1785 CWD_STATE_COPY(&old_state, &CWDG(cwd)); in virtual_rename()
1790 oldname = old_state.cwd; in virtual_rename()
1792 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rename()
1798 newname = new_state.cwd; in virtual_rename()
1821 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_stat()
1827 retval = php_sys_stat(new_state.cwd, buf); in virtual_stat()
1839 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_lstat()
1845 retval = php_sys_lstat(new_state.cwd, buf); in virtual_lstat()
1857 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_unlink()
1864 retval = php_win32_ioutil_unlink(new_state.cwd); in virtual_unlink()
1866 retval = unlink(new_state.cwd); in virtual_unlink()
1879 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_mkdir()
1886 retval = php_win32_ioutil_mkdir(new_state.cwd, mode); in virtual_mkdir()
1888 retval = mkdir(new_state.cwd, mode); in virtual_mkdir()
1900 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rmdir()
1907 retval = php_win32_ioutil_rmdir(new_state.cwd); in virtual_rmdir()
1909 retval = rmdir(new_state.cwd); in virtual_rmdir()
1925 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_opendir()
1931 retval = opendir(new_state.cwd); in virtual_opendir()
1941 return popen_ex(command, type, CWDG(cwd).cwd, NULL); in virtual_popen()
1963 VCWD_CHDIR(CWDG(cwd).cwd); in virtual_popen()
1985 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1986 dir = CWDG(cwd).cwd; in virtual_popen()
1992 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1993 dir = CWDG(cwd).cwd; in virtual_popen()
2002 if (CWDG(cwd).cwd_length == 0) { in virtual_popen()
2038 char cwd[MAXPATHLEN]; in tsrm_realpath() local
2042 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
2043 if (new_state.cwd == NULL) { in tsrm_realpath()
2046 new_state.cwd[0] = '\0'; in tsrm_realpath()
2048 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
2049 path = cwd; in tsrm_realpath()
2052 VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
2053 new_state.cwd = estrdup(cwd); in tsrm_realpath()
2054 new_state.cwd_length = (int)strlen(cwd); in tsrm_realpath()
2056 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
2057 if (new_state.cwd == NULL) { in tsrm_realpath()
2060 new_state.cwd[0] = '\0'; in tsrm_realpath()
2065 efree(new_state.cwd); in tsrm_realpath()
2071 memcpy(real_path, new_state.cwd, copy_len); in tsrm_realpath()
2073 efree(new_state.cwd); in tsrm_realpath()
2076 return new_state.cwd; in tsrm_realpath()