From 87321ba6b3131cc387e676f90a57f8985928b6e2 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 9 Aug 2006 15:30:28 +0000 Subject: fix options link order add fallbacks --- math/math.c | 8 ++++---- math/mkdb.c | 8 ++++++++ math/readmeta.c | 3 --- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/math/math.c b/math/math.c index 0f00140..d3f5ebd 100644 --- a/math/math.c +++ b/math/math.c @@ -150,8 +150,8 @@ pr_opts(struct meta *mp) } *op, o[] = { { mp->html, "HTML", "htmlicon.gif", 'h', "View HTML version" }, { mp->pdf, "PDF", "pdficon.gif", 'p', "View as PDF" }, - { mp->mws, "MWS", "mwicon.gif", 's', "Download Maple classic worksheet" }, { mp->mw, "MW", "mwicon.gif", 'm', "Download Maple worksheet" }, + { mp->mws, "MWS", "mwsicon.gif", 's', "Download Maple classic worksheet" }, { mp->code, "CODE", "codeicon.gif", 'c', "Download Maple code" }, { mp->email, "EMAIL", "emailicon.gif", 'e', "E-mail to a colleague" }, { NULL, NULL, NULL, 0, NULL } @@ -160,9 +160,9 @@ pr_opts(struct meta *mp) puts("

"); for (op = o; op->str != NULL; ++op) { if (*op->str != '\0') { - printf("", sname, mp->id, op->trg); - printf("\"%s\" ", op->alt, "images", op->img); - printf("%s
\n", op->dsc); + printf("\"%s\"\n", op->alt, "images", op->img); + printf("%s", sname, mp->id, op->trg, op->dsc); + puts("
"); } } puts("

"); diff --git a/math/mkdb.c b/math/mkdb.c index db07eff..f4a6469 100644 --- a/math/mkdb.c +++ b/math/mkdb.c @@ -96,9 +96,17 @@ walk(char **fname) mp->pdf = strdup(p); else if (strstr(p, ".zip") != NULL) mp->code = strdup(p); + /* TODO: add doc, rtf, etc. */ } } + /* fallbacks */ + if (mp->title == NULL) + mp->title = mp->dir; + if (mp->author == NULL) + mp->author = strdup("unknown"); + if (mp->language == NULL) + mp->language = strdup("en"); db_add(mp, parent, id); closemeta(mp); diff --git a/math/readmeta.c b/math/readmeta.c index 33fc5f7..f337f1d 100644 --- a/math/readmeta.c +++ b/math/readmeta.c @@ -127,9 +127,6 @@ openmeta(char *fname) free(buf); - if (mp->language == NULL) - mp->language = "en"; - return mp; } -- cgit v1.2.3