Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* indexes(const char* path)
- {
- char* html_path = realloc((char*)path, strlen("index.html") + strlen(path) + 1);
- char* php_path = realloc((char*)path, strlen("index.php") + strlen(path) + 1);
- char* index_html = "index.html";
- char* index_php = "index.php";
- if (access(index_html, F_OK) == 0)
- {
- strcpy((char*)path, html_path);
- free(html_path);
- free(php_path);
- return strcat((char*)path, index_html);
- }
- else if (access(index_php, F_OK) == 0)
- {
- strcpy((char*)path, php_path);
- free(html_path);
- free(php_path);
- return strcat((char*)path, index_php);
- }
- free(php_path);
- free(html_path);
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement