Lines Matching refs:cwd

152 	(d)->cwd = (char *) malloc((s)->cwd_length+1);	\
153 memcpy((d)->cwd, (s)->cwd, (s)->cwd_length+1);
156 free((s)->cwd);
414 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) in php_is_dir_ok()
425 if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) in php_is_file_ok()
434 CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state); in cwd_globals_ctor()
444 CWD_STATE_FREE(&cwd_g->cwd); in cwd_globals_dtor()
451 char cwd[MAXPATHLEN]; in virtual_cwd_startup() local
455 result = getcwdpath(cwd, NULL, 1); in virtual_cwd_startup()
458 char *c=cwd; in virtual_cwd_startup()
466 result = getcwd(cwd, sizeof(cwd)); in virtual_cwd_startup()
469 cwd[0] = '\0'; in virtual_cwd_startup()
472 main_cwd_state.cwd_length = strlen(cwd); in virtual_cwd_startup()
474 if (main_cwd_state.cwd_length >= 2 && cwd[1] == ':') { in virtual_cwd_startup()
475 cwd[0] = toupper(cwd[0]); in virtual_cwd_startup()
478 main_cwd_state.cwd = strdup(cwd); in virtual_cwd_startup()
501 …free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably … in virtual_cwd_shutdown()
509 state = &CWDG(cwd); in virtual_getcwd_ex()
526 if (state->cwd_length == 2 && state->cwd[state->cwd_length-1] == ':') { in virtual_getcwd_ex()
534 memcpy(retval, state->cwd, *length); in virtual_getcwd_ex()
542 return strdup(state->cwd); in virtual_getcwd_ex()
550 char *cwd; in virtual_getcwd() local
552 cwd = virtual_getcwd_ex(&length TSRMLS_CC); in virtual_getcwd()
555 return cwd; in virtual_getcwd()
558 free(cwd); in virtual_getcwd()
562 memcpy(buf, cwd, length+1); in virtual_getcwd()
563 free(cwd); in virtual_getcwd()
1190 fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path); in virtual_file_ex()
1206 if (state->cwd[1] == ':') { in virtual_file_ex()
1209 } else if (IS_UNC_PATH(state->cwd, state->cwd_length)) { in virtual_file_ex()
1212 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1215 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1216 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1219 while (IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1222 while (state->cwd[state_cwd_length] && in virtual_file_ex()
1223 !IS_SLASH(state->cwd[state_cwd_length])) { in virtual_file_ex()
1232 memcpy(resolved_path, state->cwd, state_cwd_length); in virtual_file_ex()
1333 tmp = realloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1340 state->cwd = (char *) tmp; in virtual_file_ex()
1342 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1353 tmp = realloc(state->cwd, state->cwd_length+1); in virtual_file_ex()
1360 state->cwd = (char *) tmp; in virtual_file_ex()
1362 memcpy(state->cwd, resolved_path, state->cwd_length+1); in virtual_file_ex()
1367 fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd); in virtual_file_ex()
1375 return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0; in virtual_chdir()
1417 char cwd[MAXPATHLEN]; in virtual_realpath() local
1421 new_state.cwd = (char*)malloc(1); in virtual_realpath()
1422 if (new_state.cwd == NULL) { in virtual_realpath()
1426 new_state.cwd[0] = '\0'; in virtual_realpath()
1428 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in virtual_realpath()
1429 path = cwd; in virtual_realpath()
1432 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_realpath()
1434 new_state.cwd = (char*)malloc(1); in virtual_realpath()
1435 if (new_state.cwd == NULL) { in virtual_realpath()
1439 new_state.cwd[0] = '\0'; in virtual_realpath()
1446 memcpy(real_path, new_state.cwd, len); in virtual_realpath()
1464 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_filepath_ex()
1467 *filepath = new_state.cwd; in virtual_filepath_ex()
1489 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_fopen()
1495 f = fopen(new_state.cwd, mode); in virtual_fopen()
1507 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_access()
1514 ret = tsrm_win32_access(new_state.cwd, mode); in virtual_access()
1516 ret = access(new_state.cwd, mode); in virtual_access()
1580 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_utime()
1587 ret = win32_utime(new_state.cwd, buf); in virtual_utime()
1589 ret = utime(new_state.cwd, buf); in virtual_utime()
1603 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chmod()
1609 ret = chmod(new_state.cwd, mode); in virtual_chmod()
1622 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_chown()
1630 ret = lchown(new_state.cwd, owner, group); in virtual_chown()
1635 ret = chown(new_state.cwd, owner, group); in virtual_chown()
1649 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_open()
1663 f = open(new_state.cwd, flags, mode); in virtual_open()
1665 f = open(new_state.cwd, flags); in virtual_open()
1677 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_creat()
1683 f = creat(new_state.cwd, mode); in virtual_creat()
1696 CWD_STATE_COPY(&old_state, &CWDG(cwd)); in virtual_rename()
1701 oldname = old_state.cwd; in virtual_rename()
1703 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rename()
1709 newname = new_state.cwd; in virtual_rename()
1732 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_stat()
1738 retval = php_sys_stat(new_state.cwd, buf); in virtual_stat()
1750 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_lstat()
1756 retval = php_sys_lstat(new_state.cwd, buf); in virtual_lstat()
1768 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_unlink()
1774 retval = unlink(new_state.cwd); in virtual_unlink()
1786 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_mkdir()
1793 retval = mkdir(new_state.cwd); in virtual_mkdir()
1795 retval = mkdir(new_state.cwd, mode); in virtual_mkdir()
1807 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_rmdir()
1813 retval = rmdir(new_state.cwd); in virtual_rmdir()
1829 CWD_STATE_COPY(&new_state, &CWDG(cwd)); in virtual_opendir()
1835 retval = opendir(new_state.cwd); in virtual_opendir()
1845 return popen_ex(command, type, CWDG(cwd).cwd, NULL); in virtual_popen()
1867 VCWD_CHDIR(CWDG(cwd).cwd); in virtual_popen()
1889 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1890 dir = CWDG(cwd).cwd; in virtual_popen()
1896 dir_length = CWDG(cwd).cwd_length; in virtual_popen()
1897 dir = CWDG(cwd).cwd; in virtual_popen()
1906 if (CWDG(cwd).cwd_length == 0) { in virtual_popen()
1942 char cwd[MAXPATHLEN]; in tsrm_realpath() local
1946 new_state.cwd = (char*)malloc(1); in tsrm_realpath()
1947 if (new_state.cwd == NULL) { in tsrm_realpath()
1950 new_state.cwd[0] = '\0'; in tsrm_realpath()
1952 if (VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1953 path = cwd; in tsrm_realpath()
1956 VCWD_GETCWD(cwd, MAXPATHLEN)) { in tsrm_realpath()
1957 new_state.cwd = strdup(cwd); in tsrm_realpath()
1958 new_state.cwd_length = strlen(cwd); in tsrm_realpath()
1960 new_state.cwd = (char*)malloc(1); in tsrm_realpath()
1961 if (new_state.cwd == NULL) { in tsrm_realpath()
1964 new_state.cwd[0] = '\0'; in tsrm_realpath()
1969 free(new_state.cwd); in tsrm_realpath()
1975 memcpy(real_path, new_state.cwd, copy_len); in tsrm_realpath()
1977 free(new_state.cwd); in tsrm_realpath()
1980 return new_state.cwd; in tsrm_realpath()