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