From 726ff2b6b30aac9aaab55548a986100d44e8947b Mon Sep 17 00:00:00 2001 From: Arik Devens Date: Sat, 24 Feb 2001 16:03:40 +0000 Subject: Added default text to be displayed when either a man or info page cannot be found on the system. Fixes bug 3112 and partially fixes bug 939. Will finish after sleep. --- src/info2html/main.c | 15 ++++++++++++--- src/man2html/yelp-man2html.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/info2html/main.c b/src/info2html/main.c index 7f5a1d7a..ddbc2501 100644 --- a/src/info2html/main.c +++ b/src/info2html/main.c @@ -33,6 +33,9 @@ static int file_exists(const char *fn) { struct stat sbuf; + + fprintf (stderr, "%s", fn); + return (stat(fn, &sbuf) == 0); } @@ -92,11 +95,16 @@ main(int argc, char **argv) break; ext = ".gz"; sprintf(buf, "%s/%s.info.gz", dirs[i], args[0]); + if(file_exists(buf)) break; } - if(i >= ndirs) - return 2; + if(i >= ndirs) { + printf ("Document not found\n" + "The document \"%s/%s.info\" couldn't be found. It may have been removed from your system.\n" + "\n", dirs[0], args[0]); + return 2; + } n = i; @@ -106,6 +114,7 @@ main(int argc, char **argv) sprintf(buf, "%s/%s.info-%d%s", dirs[n], args[0], i, ext); else sprintf(buf, "%s/%s.info%s", dirs[n], args[0], ext); + if(!file_exists(buf)) { fixup_args[i] = NULL; @@ -116,7 +125,7 @@ main(int argc, char **argv) } args = (const char **)fixup_args; } - + if(requested_nodename) { char *s, *t; diff --git a/src/man2html/yelp-man2html.c b/src/man2html/yelp-man2html.c index ed811b78..665d7340 100644 --- a/src/man2html/yelp-man2html.c +++ b/src/man2html/yelp-man2html.c @@ -3711,10 +3711,16 @@ main(int argc, char **argv) if(output[0]) infh = gzopen(output, "r"); + } } - if(!infh) - return 3; + if(!infh) { + printf("Document not found\n" + "The document \"%s\" couldn't be found. It may have been removed from your system.\n" + "\n", infile); + + return 3; + } buf=read_man_page(); if (!buf) { -- cgit v1.2.1