diff options
author | Ali Abdin <aliabdin@aucegypt.edu> | 2000-12-23 14:14:28 +0000 |
---|---|---|
committer | Ali Abdin <rakholh@src.gnome.org> | 2000-12-23 14:14:28 +0000 |
commit | f4dceb153c9e931baa7e054c088cb8c35430e760 (patch) | |
tree | fa3053e2c5fd91f56de248d90674ddc56a281c42 | |
parent | 08e278c58108b1c1108b0c8d2cfb48b2e4214280 (diff) | |
download | nautilus-f4dceb153c9e931baa7e054c088cb8c35430e760.tar.gz |
So, I thought I was fixing this bug in the Eazel bugtracker. I hack away,
2000-12-23 Ali Abdin <aliabdin@aucegypt.edu>
So, I thought I was fixing this bug in the Eazel bugtracker. I hack
away, and get gzipped man files showing up in the Help sidebar. Turns
out, that the bug I /should/ have been working on was some info-files
now showing up in the Help sidebar.
Oh well, at least we now get gzipp'd man files showing up in the
sidebar (which is most man files nowadays).
So I continuied hacking and fixd bug #4414 (info files in Debian do
not show up in Help sidebar)
* components/help/hyperbola-filefmt.c:
(extract_secnum_from_filename),
(name_without_suffix): New functions
(fmt_man_populate_tree_from_subdir):
gnome-man2html2 actually supports gzip'd files. So this needed some
major work to get it to support them gzip'd files.
(fmt_info_populate_tree):
Also populate tree from the /usr/share/info subdir. I think this helps
destroy bug #4414
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | components/help/hyperbola-filefmt.c | 59 |
2 files changed, 77 insertions, 7 deletions
@@ -1,5 +1,30 @@ 2000-12-23 Ali Abdin <aliabdin@aucegypt.edu> + So, I thought I was fixing this bug in the Eazel bugtracker. I hack + away, and get gzipped man files showing up in the Help sidebar. Turns + out, that the bug I /should/ have been working on was some info-files + now showing up in the Help sidebar. + + Oh well, at least we now get gzipp'd man files showing up in the + sidebar (which is most man files nowadays). + + So I continuied hacking and fixd bug #4414 (info files in Debian do + not show up in Help sidebar) + + * components/help/hyperbola-filefmt.c: + (extract_secnum_from_filename), + (name_without_suffix): New functions + + (fmt_man_populate_tree_from_subdir): + gnome-man2html2 actually supports gzip'd files. So this needed some + major work to get it to support them gzip'd files. + + (fmt_info_populate_tree): + Also populate tree from the /usr/share/info subdir. I think this helps + destroy bug #4414 + +2000-12-23 Ali Abdin <aliabdin@aucegypt.edu> + More Fixing for bug #5118 (tags within a title do not appear in the TOC). There are a few 'difficult' cases that are still not supported and we probably won't support. diff --git a/components/help/hyperbola-filefmt.c b/components/help/hyperbola-filefmt.c index 0a4ff86f9..18a0ddeff 100644 --- a/components/help/hyperbola-filefmt.c +++ b/components/help/hyperbola-filefmt.c @@ -325,6 +325,39 @@ fmt_map_entry(HyperbolaDocTree *tree, const char *name, char section) } /******** Man page format ********/ + +/* Caller must free this */ +static char * +extract_secnum_from_filename (const char *filename) { + char *end_string; + + end_string = strstr (filename, ".gz"); + if (!end_string) { + /* Not a gzipped man file */ + return g_strdup (strrchr (filename, '.')); + } else { + /* Its a gzipped man file so we need to return the + * secnum */ + return g_strndup (end_string-2, 2); + } + +} + +/* Caller must free this */ +static char * +man_name_without_suffix (const char *filename) { + char *end_string; + + end_string = strstr (filename, ".gz"); + if (end_string) { + /* e.g. manfile.1.gz would return manfile */ + return g_strndup (filename, end_string-filename-2); + } else { + /* e.g. manfile.1 would return manfile */ + return g_strndup (filename, strlen (filename)-2); + } +} + static void fmt_man_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, char **defpath, char secnum) { @@ -343,18 +376,28 @@ fmt_man_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, ch while((dent = readdir(dirh))) { char *ctmp; + char *manname; if(dent->d_name[0] == '.') - continue; + continue; - ctmp = strrchr(dent->d_name, '.'); + ctmp = extract_secnum_from_filename (dent->d_name); if(!ctmp) continue; - if(ctmp[1] != secnum) - continue; /* maybe the extension was '.gz' or something, which we most definitely don't handle right now */ + if(ctmp[1] != secnum) { + g_free (ctmp); + continue; + } - g_snprintf(namebuf, sizeof(namebuf), "%.*s", (int)(ctmp - dent->d_name), dent->d_name); + manname = man_name_without_suffix (dent->d_name); + if (strstr (dent->d_name, ".gz")) { + g_snprintf (namebuf, sizeof(namebuf), "%.*s", (int)strlen (manname), manname); + } else { + /* g_snprintf (namebuf, sizeof(namebuf), "%.*s", (int)(ctmp - dent->d_name), dent->d_name); */ + g_snprintf (namebuf, sizeof(namebuf), "%.*s", (int)strlen (manname), manname); + } + g_free (manname); strcpy(titlebuf, namebuf); strcat(titlebuf, " (man)"); @@ -366,6 +409,7 @@ fmt_man_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, ch make_treesection(tree, thispath); hyperbola_doc_tree_add(tree, HYP_TREE_NODE_PAGE, (const char **)(thispath?thispath:defpath), titlebuf, uribuf); + g_free (ctmp); } closedir(dirh); @@ -549,7 +593,7 @@ fmt_info_populate_tree_for_subdir(HyperbolaDocTree *tree, const char *basedir, c if(dent->d_name[0] == '.') continue; - + do { if(ctmp) *ctmp = '\0'; ctmp = strrchr(dent->d_name, '.'); @@ -586,7 +630,8 @@ fmt_info_populate_tree(HyperbolaDocTree *tree) translate_array(defpath); make_treesection(tree, defpath); - fmt_info_populate_tree_for_subdir(tree, "/usr/info", defpath); + fmt_info_populate_tree_for_subdir (tree, "/usr/info", defpath); + fmt_info_populate_tree_for_subdir (tree, "/usr/share/info", defpath); if(strcmp(INFODIR, "/usr/info")) fmt_info_populate_tree_for_subdir(tree, INFODIR, defpath); |