diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/defidx.html | 6 | ||||
-rw-r--r-- | src/idx.c | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/defidx.html b/src/defidx.html index fa3cc66..12bea9f 100644 --- a/src/defidx.html +++ b/src/defidx.html @@ -53,10 +53,10 @@ {% loop %} <tr class="{% $ROWCLASS %}"> <td class="indexcolicon"> - {% if $(icon $FILETYPE) %} - <img src="{% $(icon $FILETYPE) %}" alt="[{% $(alt $FILETYPE) %}]"> + {% if $(icon $MIMETYPE) %} + <img src="{% $(icon $MIMETYPE) %}" alt="[{% $(alt $MIMETYPE) %}]"> {% else %} - [{% $(alt $FILETYPE) %}] + [{% $FILETYPE %}] {% endif %} </td> <td class="indexcolname"> @@ -597,6 +597,16 @@ exp_filetime(char **ret, EVAL_ENV *env) return WRDSE_UNDEF; } +static int +exp_filetype(char **ret, EVAL_ENV *env) +{ + char const *s = " "; + if (env->ent) + s = S_ISDIR(env->ent->st.st_mode) ? "DIR" : "FILE"; + *ret = xstrdup(s); + return WRDSE_OK; +} + struct var_dcl { char const *name; int (*exp)(char **, EVAL_ENV *); @@ -607,6 +617,7 @@ static struct var_dcl var_dcl[] = { { "FILENAME", exp_filename }, { "FILESIZE", exp_filesize }, { "FILETIME", exp_filetime }, + { "FILETYPE", exp_filetype }, { "MIMETYPE", exp_mimetype }, { NULL } }; |