functions: use g.eftv.co service to display favicons
This commit is contained in:
parent
9ca0fcb65a
commit
7d2a532478
@ -627,26 +627,25 @@ int scansdir(const char *dir, struct dirent ***namelist,
|
|||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define favicon_url_prefix "http://g.etfv.co/"
|
||||||
|
|
||||||
int
|
int
|
||||||
get_favicon_from_url(const char* url,char *buf,int bufsize) {
|
get_favicon_from_url(const char* url,char *buf,int bufsize) {
|
||||||
|
|
||||||
int i=0,l=0;
|
int i=0,l=0;
|
||||||
|
|
||||||
|
strncpy(buf, favicon_url_prefix, bufsize);
|
||||||
|
|
||||||
/* expecting urls in the form http://address/... */
|
/* expecting urls in the form http://address/... */
|
||||||
if (url) {
|
if (url) {
|
||||||
while ((i<bufsize) && url[i]) {
|
while ((i<bufsize) && url[i]) {
|
||||||
buf[i]=url[i];
|
if (url[i] == '/') {
|
||||||
if (buf[i] == '/') {
|
|
||||||
l++;
|
l++;
|
||||||
if (l == 3) break;
|
if (l == 3) break;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
buf[i]='\0';
|
|
||||||
} else {
|
|
||||||
/* use current site as default icon */
|
|
||||||
buf[0]='\0';
|
|
||||||
}
|
}
|
||||||
strcat(buf,"/favicon.ico");
|
strncpy(&buf[strlen(buf)], url, i);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user