Skip to content

Instantly share code, notes, and snippets.

Created Mar 19, 2016
Embed
What would you like to do?
indexes.c
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