Lines Matching refs:cwd
152 (d)->cwd = (char *) emalloc((s)->cwd_length+1); \
153 memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
156 efree((s)->cwd);
412 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) in php_is_dir_ok()
423 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) in php_is_file_ok()
432 CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state); in cwd_globals_ctor()
448 char cwd[MAXPATHLEN]; in virtual_cwd_startup() local
452 result = getcwdpath(cwd, NULL, 1); in virtual_cwd_startup()
455 char *c=cwd; in virtual_cwd_startup()
463 result = getcwd(cwd, sizeof(cwd)); in virtual_cwd_startup()
466 cwd[0] = '\0'; in virtual_cwd_startup()
469 main_cwd_state.cwd_length = strlen(cwd); in virtual_cwd_startup()
471 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { in virtual_cwd_startup()
472 cwd[0] = toupper(cwd[0]); in virtual_cwd_startup()
475 main_cwd_state.cwd = strdup(cwd); in virtual_cwd_startup()
498 …free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably … in virtual_cwd_shutdown()
504 if (CWDG(cwd).cwd == NULL) { in virtual_cwd_activate()
505 CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state); in virtual_cwd_activate()
513 if (CWDG(cwd).cwd != NULL) { in virtual_cwd_deactivate()
514 CWD_STATE_FREE(&CWDG(cwd)); in virtual_cwd_deactivate()
515 CWDG(cwd).cwd = NULL; in virtual_cwd_deactivate()
525 state = &CWDG(cwd); in virtual_getcwd_ex()
542 if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { in virtual_getcwd_ex()
550 memcpy(retval, state->cwd, *length); in virtual_getcwd_ex()
558 return estrdup(state->cwd); in virtual_getcwd_ex()
566 char *cwd; in virtual_getcwd() local
568 cwd = virtual_getcwd_ex(&length TSRMLS_CC); in virtual_getcwd()
571 return cwd; in virtual_getcwd()
574 efree(cwd); in virtual_getcwd()
578 memcpy(buf, cwd, length+1); in virtual_getcwd()
579 efree(cwd); in virtual_getcwd()
1207 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1223 if (state->cwd[1] == ':') { in virtual_file_ex()
1226 } else if (IS_UNC_PATH(state->cwd, state->cwd_length)) { in virtual_file_ex()
1229 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1232 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1233 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1236 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1239 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1240 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1249 memcpy(resolved_path, state->cwd, state_cwd_length); in virtual_file_ex()
1350 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1357 state->cwd = (char *) tmp; in virtual_file_ex()
1359 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1370 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1377 state->cwd = (char *) tmp; in virtual_file_ex()
1379 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1384 fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); in virtual_file_ex()
1392 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH TSRMLS_CC)?-1:0; in virtual_chdir()
1434 char cwd[MAXPATHLEN]; in virtual_realpath() local
1438 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1439 if (new_state.cwd == NULL) { in virtual_realpath()
1443 new_state.cwd[0] = '\0'; in virtual_realpath()
1445 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in virtual_realpath()
1446 path = cwd; in virtual_realpath()
1449 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_realpath()
1451 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1452 if (new_state.cwd == NULL) { in virtual_realpath()
1456 new_state.cwd[0] = '\0'; in virtual_realpath()
1463 memcpy(real_path, new_state.cwd, len); in virtual_realpath()
1481 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_filepath_ex()
1484 *filepath = new_state.cwd; in virtual_filepath_ex()
1506 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_fopen()
1512 f = fopen(new_state.cwd, mode); in virtual_fopen()
1525 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_access()
1532 ret = tsrm_win32_access(new_state.cwd, mode TSRMLS_CC); in virtual_access()
1534 ret = access(new_state.cwd, mode); in virtual_access()
1598 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_utime()
1605 ret = win32_utime(new_state.cwd, buf); in virtual_utime()
1607 ret = utime(new_state.cwd, buf); in virtual_utime()
1621 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chmod()
1627 ret = chmod(new_state.cwd, mode); in virtual_chmod()
1640 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chown()
1648 ret = lchown(new_state.cwd, owner, group); in virtual_chown()
1653 ret = chown(new_state.cwd, owner, group); in virtual_chown()
1667 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_open()
1681 f = open(new_state.cwd, flags, mode); in virtual_open()
1683 f = open(new_state.cwd, flags); in virtual_open()
1695 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_creat()
1701 f = creat(new_state.cwd, mode); in virtual_creat()
1714 CWD_STATE_COPY(&old_state, &CWDG(cwd)); in virtual_rename()
1719 oldname = old_state.cwd; in virtual_rename()
1721 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rename()
1727 newname = new_state.cwd; in virtual_rename()
1750 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_stat()
1756 retval = php_sys_stat(new_state.cwd, buf); in virtual_stat()
1768 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_lstat()
1774 retval = php_sys_lstat(new_state.cwd, buf); in virtual_lstat()
1786 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_unlink()
1792 retval = unlink(new_state.cwd); in virtual_unlink()
1804 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_mkdir()
1811 retval = mkdir(new_state.cwd); in virtual_mkdir()
1813 retval = mkdir(new_state.cwd, mode); in virtual_mkdir()
1825 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rmdir()
1831 retval = rmdir(new_state.cwd); in virtual_rmdir()
1847 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_opendir()
1853 retval = opendir(new_state.cwd); in virtual_opendir()
1863 return popen_ex(command, type, CWDG(cwd).cwd, NULL TSRMLS_CC); in virtual_popen()
1885 VCWD_CHDIR(CWDG(cwd).cwd); in virtual_popen()
1907 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1908 dir = CWDG(cwd).cwd; in virtual_popen()
1914 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1915 dir = CWDG(cwd).cwd; in virtual_popen()
1924 if (CWDG(cwd).cwd_length == 0) { in virtual_popen()
1960 char cwd[MAXPATHLEN]; in tsrm_realpath() local
1964 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1965 if (new_state.cwd == NULL) { in tsrm_realpath()
1968 new_state.cwd[0] = '\0'; in tsrm_realpath()
1970 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1971 path = cwd; in tsrm_realpath()
1974 VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1975 new_state.cwd = estrdup(cwd); in tsrm_realpath()
1976 new_state.cwd_length = strlen(cwd); in tsrm_realpath()
1978 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1979 if (new_state.cwd == NULL) { in tsrm_realpath()
1982 new_state.cwd[0] = '\0'; in tsrm_realpath()
1987 efree(new_state.cwd); in tsrm_realpath()
1993 memcpy(real_path, new_state.cwd, copy_len); in tsrm_realpath()
1995 efree(new_state.cwd); in tsrm_realpath()
1998 return new_state.cwd; in tsrm_realpath()