Lines Matching refs:cwd
104 (d)->cwd = (char *) emalloc((s)->cwd_length+1); \
105 memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
108 efree((s)->cwd); \
125 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) in php_is_dir_ok()
136 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) in php_is_file_ok()
145 CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state); in cwd_globals_ctor()
177 char cwd[MAXPATHLEN]; in virtual_cwd_main_cwd_init() local
181 free(main_cwd_state.cwd); in virtual_cwd_main_cwd_init()
185 ZeroMemory(&cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
186 result = php_win32_ioutil_getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
188 result = getcwd(cwd, sizeof(cwd)); in virtual_cwd_main_cwd_init()
192 cwd[0] = '\0'; in virtual_cwd_main_cwd_init()
195 main_cwd_state.cwd_length = strlen(cwd); in virtual_cwd_main_cwd_init()
197 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { in virtual_cwd_main_cwd_init()
198 cwd[0] = toupper(cwd[0]); in virtual_cwd_main_cwd_init()
201 main_cwd_state.cwd = strdup(cwd); in virtual_cwd_main_cwd_init()
229 …free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably … in virtual_cwd_shutdown()
235 if (CWDG(cwd).cwd == NULL) { in virtual_cwd_activate()
236 CWD_STATE_COPY(&CWDG(cwd), &main_cwd_state); in virtual_cwd_activate()
244 if (CWDG(cwd).cwd != NULL) { in virtual_cwd_deactivate()
245 CWD_STATE_FREE(&CWDG(cwd)); in virtual_cwd_deactivate()
246 CWDG(cwd).cwd = NULL; in virtual_cwd_deactivate()
256 state = &CWDG(cwd); in virtual_getcwd_ex()
270 if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { in virtual_getcwd_ex()
275 memcpy(retval, state->cwd, *length); in virtual_getcwd_ex()
282 if (!state->cwd) { in virtual_getcwd_ex()
288 return estrdup(state->cwd); in virtual_getcwd_ex()
296 char *cwd; in virtual_getcwd() local
298 cwd = virtual_getcwd_ex(&length); in virtual_getcwd()
301 return cwd; in virtual_getcwd()
304 efree(cwd); in virtual_getcwd()
308 if (!cwd) { in virtual_getcwd()
311 memcpy(buf, cwd, length+1); in virtual_getcwd()
312 efree(cwd); in virtual_getcwd()
1029 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1045 if (state->cwd[1] == ':') { in virtual_file_ex()
1048 } else if (IS_UNC_PATH(state->cwd, state->cwd_length)) { in virtual_file_ex()
1051 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1054 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1055 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1058 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1061 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1062 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1076 memcpy(resolved_path, state->cwd, state_cwd_length); in virtual_file_ex()
1167 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1168 state->cwd = (char *) tmp; in virtual_file_ex()
1170 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1181 tmp = erealloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1182 state->cwd = (char *) tmp; in virtual_file_ex()
1184 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1189 fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); in virtual_file_ex()
1197 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH) ? FAILURE : SUCCESS; in virtual_chdir()
1241 char cwd[MAXPATHLEN]; in virtual_realpath() local
1245 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1246 new_state.cwd[0] = '\0'; in virtual_realpath()
1248 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in virtual_realpath()
1249 path = cwd; in virtual_realpath()
1252 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_realpath()
1254 new_state.cwd = (char*)emalloc(1); in virtual_realpath()
1255 new_state.cwd[0] = '\0'; in virtual_realpath()
1262 memcpy(real_path, new_state.cwd, len); in virtual_realpath()
1280 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_filepath_ex()
1283 *filepath = new_state.cwd; in virtual_filepath_ex()
1306 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_fopen()
1313 f = php_win32_ioutil_fopen(new_state.cwd, mode); in virtual_fopen()
1315 f = fopen(new_state.cwd, mode); in virtual_fopen()
1329 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_access()
1336 ret = tsrm_win32_access(new_state.cwd, mode); in virtual_access()
1338 ret = access(new_state.cwd, mode); in virtual_access()
1353 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_utime()
1360 ret = win32_utime(new_state.cwd, buf); in virtual_utime()
1362 ret = utime(new_state.cwd, buf); in virtual_utime()
1376 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chmod()
1394 ret = php_win32_ioutil_chmod(new_state.cwd, mode); in virtual_chmod()
1397 ret = chmod(new_state.cwd, mode); in virtual_chmod()
1411 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chown()
1419 ret = lchown(new_state.cwd, owner, group); in virtual_chown()
1424 ret = chown(new_state.cwd, owner, group); in virtual_chown()
1438 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_open()
1453 f = php_win32_ioutil_open(new_state.cwd, flags, mode); in virtual_open()
1455 f = open(new_state.cwd, flags, mode); in virtual_open()
1459 f = php_win32_ioutil_open(new_state.cwd, flags); in virtual_open()
1461 f = open(new_state.cwd, flags); in virtual_open()
1474 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_creat()
1480 f = creat(new_state.cwd, mode); in virtual_creat()
1493 CWD_STATE_COPY(&old_state, &CWDG(cwd)); in virtual_rename()
1498 oldname = old_state.cwd; in virtual_rename()
1500 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rename()
1506 newname = new_state.cwd; in virtual_rename()
1529 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_stat()
1535 retval = php_sys_stat(new_state.cwd, buf); in virtual_stat()
1547 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_lstat()
1553 retval = php_sys_lstat(new_state.cwd, buf); in virtual_lstat()
1565 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_unlink()
1572 retval = php_win32_ioutil_unlink(new_state.cwd); in virtual_unlink()
1574 retval = unlink(new_state.cwd); in virtual_unlink()
1587 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_mkdir()
1594 retval = php_win32_ioutil_mkdir(new_state.cwd, mode); in virtual_mkdir()
1596 retval = mkdir(new_state.cwd, mode); in virtual_mkdir()
1608 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rmdir()
1615 retval = php_win32_ioutil_rmdir(new_state.cwd); in virtual_rmdir()
1617 retval = rmdir(new_state.cwd); in virtual_rmdir()
1633 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_opendir()
1639 retval = opendir(new_state.cwd); in virtual_opendir()
1649 return popen_ex(command, type, CWDG(cwd).cwd, NULL); in virtual_popen()
1663 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1664 dir = CWDG(cwd).cwd; in virtual_popen()
1670 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1671 dir = CWDG(cwd).cwd; in virtual_popen()
1677 if (CWDG(cwd).cwd_length == 0) { in virtual_popen()
1713 char cwd[MAXPATHLEN]; in tsrm_realpath() local
1717 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1718 new_state.cwd[0] = '\0'; in tsrm_realpath()
1720 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1721 path = cwd; in tsrm_realpath()
1724 VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1725 new_state.cwd = estrdup(cwd); in tsrm_realpath()
1726 new_state.cwd_length = strlen(cwd); in tsrm_realpath()
1728 new_state.cwd = (char*)emalloc(1); in tsrm_realpath()
1729 new_state.cwd[0] = '\0'; in tsrm_realpath()
1734 efree(new_state.cwd); in tsrm_realpath()
1740 memcpy(real_path, new_state.cwd, copy_len); in tsrm_realpath()
1742 efree(new_state.cwd); in tsrm_realpath()
1745 return new_state.cwd; in tsrm_realpath()