[genius] Wed Apr 26 21:11:54 2017 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Wed Apr 26 21:11:54 2017 Jiri (George) Lebl <jirka 5z com>
- Date: Thu, 27 Apr 2017 02:12:21 +0000 (UTC)
commit 567010d8af82c5afb8435166aa2e1fbf5153b2d6
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Wed Apr 26 21:11:57 2017 -0500
Wed Apr 26 21:11:54 2017 Jiri (George) Lebl <jirka 5z com>
* src/genius.c: make genius show the HTML version of the manual in
lynx, links, or w3m
ChangeLog | 5 +
doc/.cvsignore | 2 -
doc/Makefile.am | 7 -
doc/manual.txt | 908 -------------------------------------------------------
src/genius.c | 60 +++--
5 files changed, 44 insertions(+), 938 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e2c7708..b88f75f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 26 21:11:54 2017 Jiri (George) Lebl <jirka 5z com>
+
+ * src/genius.c: make genius show the HTML version of the manual in
+ lynx, links, or w3m
+
Wed Apr 26 20:00:02 2017 Jiri (George) Lebl <jirka 5z com>
* help/C/genius.xml: Fixes from Anders Jonsson, plus some other minor
diff --git a/src/genius.c b/src/genius.c
index e723db1..62bb0f3 100644
--- a/src/genius.c
+++ b/src/genius.c
@@ -131,6 +131,36 @@ gel_printout_infos (void)
errors_printed = 0;
}
+static char *
+get_help_index (const char *datadir)
+{
+ const char * const* langs;
+ int i;
+
+ langs = g_get_language_names ();
+ for (i = 0; langs[i] != NULL; i++) {
+ char *file;
+ file = g_build_filename (datadir,
+ "genius",
+ "help",
+ langs[i],
+ "html",
+ "index.html",
+ NULL);
+ if (access (file, F_OK) == 0) {
+ return file;
+ }
+ g_free (file);
+ }
+ return g_build_filename (datadir,
+ "genius",
+ "help",
+ "C",
+ "html",
+ "index.html",
+ NULL);
+}
+
void
gel_call_help (const char *function)
{
@@ -143,16 +173,13 @@ gel_call_help (const char *function)
return;
}
- /*fp = fopen ("../doc/genius.txt", "r");
- if G_LIKELY (fp == NULL)*/
-
str = gbr_find_data_dir (DATADIR);
- file = g_build_filename (str, "genius", "genius.txt", NULL);
+ file = get_help_index (str);
g_free (str);
if G_UNLIKELY (access (file, R_OK) != 0) {
g_free (file);
- file = g_build_filename (DATADIR, "genius", "genius.txt", NULL);
+ file = get_help_index (DATADIR);
if G_UNLIKELY (access (file, R_OK) != 0) {
puterror (_("Cannot locate the manual"));
g_free (file);
@@ -160,9 +187,11 @@ gel_call_help (const char *function)
}
}
- str = g_find_program_in_path ("less");
+ str = g_find_program_in_path ("lynx");
if (str == NULL)
- str = g_find_program_in_path ("more");
+ str = g_find_program_in_path ("links");
+ if (str == NULL)
+ str = g_find_program_in_path ("w3m");
if G_LIKELY (str != NULL) {
char *argv[3];
@@ -173,27 +202,16 @@ gel_call_help (const char *function)
g_spawn_sync (NULL /* wd */,
argv,
NULL /* envp */,
- 0 /* flags */,
+ G_SPAWN_CHILD_INHERITS_STDIN /* flags */,
NULL /* child_setup */,
NULL /* user_data */,
NULL /*stdout*/,
NULL /*stderr*/,
NULL /* status */,
NULL /* error */);
- } else {
- /* No less or more, hence just type out the
- * manual */
- FILE *fp;
-
- fp = fopen (file, "r");
- if G_LIKELY (fp != NULL) {
- char buf[256];
- while (fgets (buf, sizeof(buf), fp) != NULL) {
- g_print ("%s\n", buf);
- }
- fclose (fp);
- }
+ } else {
+ puterror (_("Cannot run lynx/links/w3m to show the manual"));
}
g_free (file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]