Lines Matching refs:cwd
106 (d)->cwd = (char *) emalloc((s)->cwd_length+1); \
107 memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
110 efree((s)->cwd); \
380 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) in php_is_dir_ok()
391 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) in php_is_file_ok()
400 CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state); in cwd_globals_ctor()
416 char cwd[MAXPATHLEN]; in virtual_cwd_main_cwd_init() local
420 free(main_cwd_state.cwd); in virtual_cwd_main_cwd_init()
424 ZeroMemory(&cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
425 result = php_win32_ioutil_getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
427 result = getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
431 cwd[0] = '\0'; in virtual_cwd_main_cwd_init()
434 main_cwd_state.cwd_length = strlen(cwd); in virtual_cwd_main_cwd_init()
436 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { in virtual_cwd_main_cwd_init()
437 cwd[0] = toupper(cwd[0]); in virtual_cwd_main_cwd_init()
440 main_cwd_state.cwd = strdup(cwd); in virtual_cwd_main_cwd_init()
468 …free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably … in virtual_cwd_shutdown()
474 if (CWDG(cwd).cwd == NULL) { in virtual_cwd_activate()
475 CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state); in virtual_cwd_activate()
483 if (CWDG(cwd).cwd != NULL) { in virtual_cwd_deactivate()
484 CWD_STATE_FREE(&CWDG(cwd)); in virtual_cwd_deactivate()
485 CWDG(cwd).cwd = NULL; in virtual_cwd_deactivate()
495 state = &CWDG(cwd); in virtual_getcwd_ex()
509 if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { in virtual_getcwd_ex()
514 memcpy(retval, state->cwd, *length); in virtual_getcwd_ex()
521 if (!state->cwd) { in virtual_getcwd_ex()
527 return estrdup(state->cwd); in virtual_getcwd_ex()
535 char *cwd; in virtual_getcwd() local
537 cwd = virtual_getcwd_ex(&length); in virtual_getcwd()
540 return cwd; in virtual_getcwd()
543 efree(cwd); in virtual_getcwd()
547 if (!cwd) { in virtual_getcwd()
550 memcpy(buf, cwd, length+1); in virtual_getcwd()
551 efree(cwd); in virtual_getcwd()
1279 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1295 if (state->cwd[1] == ':') { in virtual_file_ex()
1298 } else if (IS_UNC_PATH(state->cwd, state->cwd_length)) { in virtual_file_ex()
1301 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1304 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1305 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1308 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1311 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1312 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1321 memcpy(resolved_path, state->cwd, state_cwd_length); in virtual_file_ex()
1411 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1412 state->cwd = (char *) tmp; in virtual_file_ex()
1414 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1425 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1426 state->cwd = (char *) tmp; in virtual_file_ex()
1428 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1433 fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); in virtual_file_ex()
1441 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1483 char cwd[MAXPATHLEN]; in virtual_realpath() local
1487 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1488 new_state.cwd[0] = '\0'; in virtual_realpath()
1490 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in virtual_realpath()
1491 path = cwd; in virtual_realpath()
1494 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_realpath()
1496 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1497 new_state.cwd[0] = '\0'; in virtual_realpath()
1504 memcpy(real_path, new_state.cwd, len); in virtual_realpath()
1521 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_filepath_ex()
1524 *filepath = new_state.cwd; in virtual_filepath_ex()
1546 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_fopen()
1553 f = php_win32_ioutil_fopen(new_state.cwd, mode); in virtual_fopen()
1555 f = fopen(new_state.cwd, mode); in virtual_fopen()
1569 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_access()
1576 ret = tsrm_win32_access(new_state.cwd, mode); in virtual_access()
1578 ret = access(new_state.cwd, mode); in virtual_access()
1593 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_utime()
1600 ret = win32_utime(new_state.cwd, buf); in virtual_utime()
1602 ret = utime(new_state.cwd, buf); in virtual_utime()
1616 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chmod()
1634 ret = php_win32_ioutil_chmod(new_state.cwd, mode); in virtual_chmod()
1637 ret = chmod(new_state.cwd, mode); in virtual_chmod()
1651 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chown()
1659 ret = lchown(new_state.cwd, owner, group); in virtual_chown()
1664 ret = chown(new_state.cwd, owner, group); in virtual_chown()
1678 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_open()
1693 f = php_win32_ioutil_open(new_state.cwd, flags, mode); in virtual_open()
1695 f = open(new_state.cwd, flags, mode); in virtual_open()
1699 f = php_win32_ioutil_open(new_state.cwd, flags); in virtual_open()
1701 f = open(new_state.cwd, flags); in virtual_open()
1714 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_creat()
1720 f = creat(new_state.cwd, mode); in virtual_creat()
1733 CWD_STATE_COPY(&old_state, &CWDG(cwd)); in virtual_rename()
1738 oldname = old_state.cwd; in virtual_rename()
1740 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rename()
1746 newname = new_state.cwd; in virtual_rename()
1769 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_stat()
1775 retval = php_sys_stat(new_state.cwd, buf); in virtual_stat()
1787 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_lstat()
1793 retval = php_sys_lstat(new_state.cwd, buf); in virtual_lstat()
1805 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_unlink()
1812 retval = php_win32_ioutil_unlink(new_state.cwd); in virtual_unlink()
1814 retval = unlink(new_state.cwd); in virtual_unlink()
1827 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_mkdir()
1834 retval = php_win32_ioutil_mkdir(new_state.cwd, mode); in virtual_mkdir()
1836 retval = mkdir(new_state.cwd, mode); in virtual_mkdir()
1848 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rmdir()
1855 retval = php_win32_ioutil_rmdir(new_state.cwd); in virtual_rmdir()
1857 retval = rmdir(new_state.cwd); in virtual_rmdir()
1873 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_opendir()
1879 retval = opendir(new_state.cwd); in virtual_opendir()
1889 return popen_ex(command, type, CWDG(cwd).cwd, NULL); in virtual_popen()
1903 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1904 dir = CWDG(cwd).cwd; in virtual_popen()
1910 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1911 dir = CWDG(cwd).cwd; in virtual_popen()
1917 if (CWDG(cwd).cwd_length == 0) { in virtual_popen()
1953 char cwd[MAXPATHLEN]; in tsrm_realpath() local
1957 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1958 new_state.cwd[0] = '\0'; in tsrm_realpath()
1960 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1961 path = cwd; in tsrm_realpath()
1964 VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1965 new_state.cwd = estrdup(cwd); in tsrm_realpath()
1966 new_state.cwd_length = strlen(cwd); in tsrm_realpath()
1968 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1969 new_state.cwd[0] = '\0'; in tsrm_realpath()
1974 efree(new_state.cwd); in tsrm_realpath()
1980 memcpy(real_path, new_state.cwd, copy_len); in tsrm_realpath()
1982 efree(new_state.cwd); in tsrm_realpath()
1985 return new_state.cwd; in tsrm_realpath()