/* ** Add the directory icon. */ PUBLIC BOOL HTIcon_addDir (const char * url, const char * prefix, char * alt) { if ((icon_dir = (HTIconNode *) HT_CALLOC(1,sizeof(HTIconNode))) == NULL) HT_OUTOFMEM("HTAddBlankIcon"); if (url) icon_dir->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(icon_dir->icon_alt, alt); alt_resize(alt); HTTRACE(PROT_TRACE, "Icon add.... DIRECTORY => SRC=\"%s\" ALT=\"%s\"\n" _ url _ alt ? alt : ""); return YES; }
/* ** HTAddParentIcon(url,alt) adds the parent directory icon. */ PUBLIC void HTAddParentIcon ARGS2(char *, url, char *, alt) { icon_parent = (HTIconNode*)calloc(1,sizeof(HTIconNode)); if (!icon_parent) outofmem(__FILE__, "HTAddBlankIcon"); if (url) StrAllocCopy(icon_parent->icon_url, url); if (alt) StrAllocCopy(icon_parent->icon_alt, alt); alt_resize(alt); CTRACE(stderr,"AddIcon..... PARENT => SRC=\"%s\" ALT=\"%s\"\n",url, alt ? alt : ""); }
/* ** HTAddDirIcon(url,alt) adds the directory icon. */ PUBLIC void HTAddDirIcon ARGS2(char *, url, char *, alt) { icon_dir = (HTIconNode*)calloc(1,sizeof(HTIconNode)); if (!icon_dir) outofmem(__FILE__, "HTAddBlankIcon"); if (url) StrAllocCopy(icon_dir->icon_url, url); if (alt) StrAllocCopy(icon_dir->icon_alt, alt); alt_resize(alt); CTRACE(stderr, "AddIcon..... DIRECTORY => SRC=\"%s\" ALT=\"%s\"\n",url, alt ? alt : ""); }
/* ** HTAddUnknownIcon(url,alt) adds the icon used for files for which ** no other icon seems appropriate (unknown type). */ PUBLIC void HTAddUnknownIcon ARGS2(char *, url, char *, alt) { icon_unknown = (HTIconNode*)calloc(1,sizeof(HTIconNode)); if (!icon_unknown) outofmem(__FILE__, "HTAddUnknownIcon"); if (url) StrAllocCopy(icon_unknown->icon_url, url); if (alt) StrAllocCopy(icon_unknown->icon_alt, alt); alt_resize(alt); CTRACE(stderr,"AddIcon..... UNKNOWN => SRC=\"%s\" ALT=\"%s\"\n",url, alt ? alt : ""); }
/* ** HTAddIcon(url, alt, type_templ) adds icon: ** ** <IMG SRC="url" ALT="[alt]"> ** ** for files for which content-type or content-encoding matches ** type_templ. If type_templ contains a slash, it is taken to be ** a content-type template. Otherwise, it is a content-encoding ** template. */ PUBLIC BOOL HTIcon_add (const char * url, const char * prefix, char * alt, char * type_templ) { if (url && type_templ) { HTIconNode * node; if ((node = (HTIconNode *) HT_CALLOC(1,sizeof(HTIconNode))) == NULL) HT_OUTOFMEM("HTAddIcon"); if (url) node->icon_url = prefixed(url, prefix); if (alt) StrAllocCopy(node->icon_alt, alt); if (type_templ) StrAllocCopy(node->type_templ, type_templ); if (!icons) icons = HTList_new(); HTList_addObject(icons, (void *) node); alt_resize(alt); HTTRACE(PROT_TRACE, "AddIcon..... %s => SRC=\"%s\" ALT=\"%s\"\n" _ type_templ _ url _ alt ? alt : ""); return YES; } return NO; }
/* ** HTAddIcon(url, alt, type_templ) adds icon: ** ** <IMG SRC="url" ALT="[alt]"> ** ** for files for which content-type or content-encoding matches ** type_templ. If type_templ contains a slash, it is taken to be ** a content-type template. Otherwise, it is a content-encoding ** template. */ PUBLIC void HTAddIcon ARGS3(char *, url, char *, alt, char *, type_templ) { HTIconNode * node; if (!url || !type_templ) return; node = (HTIconNode*)calloc(1,sizeof(HTIconNode)); if (!node) outofmem(__FILE__, "HTAddIcon"); if (url) StrAllocCopy(node->icon_url, url); if (alt) StrAllocCopy(node->icon_alt, alt); if (type_templ) StrAllocCopy(node->type_templ, type_templ); if (!icons) icons = HTList_new(); HTList_addObject(icons, (void*)node); alt_resize(alt); CTRACE(stderr, "AddIcon..... %s => SRC=\"%s\" ALT=\"%s\"\n",type_templ,url, alt ? alt : ""); }