Created
March 19, 2016 07:23
-
-
Save anonymous/9b456e088be7e3854b7d to your computer and use it in GitHub Desktop.
indexes.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
char* indexes(const char* path) | |
{ | |
char* a = "/index.html"; | |
char* b = "/index.php"; | |
char* indexhtml = malloc(strlen(a) + strlen(path) + 1); | |
strcpy(indexhtml, path); | |
strcat(indexhtml, a); | |
char* indexphp = malloc(strlen(b) + strlen(path) + 1); | |
strcpy(indexphp, path); | |
strcat(indexphp, b); | |
if(access(indexhtml, F_OK) == 1) | |
{ | |
return indexhtml; | |
} | |
else if(access(indexphp, F_OK) == 1) | |
{ | |
return indexphp; | |
} | |
return NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment