Revision: 2074 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2074&view=re... Author: codebrainz Date: 2011-05-23 07:18:58 +0000 (Mon, 23 May 2011)
Log Message: ----------- Disable manpage code when no 'man' program is available at compile time.
Modified Paths: -------------- trunk/geany-plugins/devhelp/src/devhelpplugin.h trunk/geany-plugins/devhelp/src/manpages.c
Modified: trunk/geany-plugins/devhelp/src/devhelpplugin.h =================================================================== --- trunk/geany-plugins/devhelp/src/devhelpplugin.h 2011-05-23 02:15:56 UTC (rev 2073) +++ trunk/geany-plugins/devhelp/src/devhelpplugin.h 2011-05-23 07:18:58 UTC (rev 2074) @@ -87,7 +87,10 @@ void devhelp_plugin_activate_ui (DevhelpPlugin *self, gboolean show_search_tab); void devhelp_plugin_search (DevhelpPlugin *self, const gchar *term); void devhelp_plugin_search_books (DevhelpPlugin *self, const gchar *term); +#ifdef HAVE_MAN void devhelp_plugin_search_manpages (DevhelpPlugin *self, const gchar *term); +#endif +void devhelp_plugin_search_code (DevhelpPlugin *self, const gchar *term, const gchar *lang);
const gchar* devhelp_plugin_get_last_uri (DevhelpPlugin *self); void devhelp_plugin_set_last_uri (DevhelpPlugin *self, const gchar *uri);
Modified: trunk/geany-plugins/devhelp/src/manpages.c =================================================================== --- trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 02:15:56 UTC (rev 2073) +++ trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 07:18:58 UTC (rev 2074) @@ -1,11 +1,13 @@ -#ifdef HAVE_MAN - #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <glib.h>
+#include "devhelpplugin.h" + +#ifdef HAVE_MAN + #define DEVHELP_MANPAGE_NUM_SECTIONS 8 /* In order of most likely sections */ static gint sections[DEVHELP_MANPAGE_NUM_SECTIONS] = { 3, 2, 1, 8, 5, 4, 7, 6 }; @@ -119,8 +121,8 @@ { FILE *fp; gint fd, len; - gchar *man_fn, *tmp_fn, *uri, *text; - const gchar *tmpl = "devhelp_manpage_XXXXXX.txt"; + gchar *man_fn, *tmp_fn, *uri, *text, *html_text; + const gchar *tmpl = "devhelp_manpage_XXXXXX.html";
man_fn = find_manpage(term, section); if (man_fn == NULL) @@ -145,19 +147,22 @@ fclose(fp); return NULL; } + html_text = g_strdup_printf("<html><head><title>%s</title></head>" + "<body><pre>%s</pre></body></html>", term, text+6 /* wtf? */); + g_free(text);
- len = strlen(text); - if (fwrite(text, sizeof(gchar), len, fp) != len) + len = strlen(html_text); + if (fwrite(html_text, sizeof(gchar), len, fp) != len) { g_free(man_fn); g_free(tmp_fn); - g_free(text); + g_free(html_text); fclose(fp); return NULL; }
g_free(man_fn); - g_free(text); + g_free(html_text); fclose(fp);
temp_files = g_list_append(temp_files, tmp_fn);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org