+ gchar **tokens = NULL;
+ const int maxtokens = 5;
+ int idx = 0;
+ argv[1] = g_strdup_printf ("file://%s#%s",
+ relocate (DOCDIR "/pspp.xml"), page);
+ /* The page will be translated to the htmlfilename
+ page htmlfilename
+ GRAPH#SCATTERPLOT SCATTERPLOT.html
+ QUICK-CLUSTER QUICK-CLUSTER.html
+ which is valid for the multiple page html doc*/
+ tokens = g_strsplit (page, "#", maxtokens);
+ for(;tokens[idx] && idx < maxtokens;idx++);
+ htmlfilename = g_strdup_printf ("%s.html", tokens[idx-1]);
+ g_strfreev (tokens);
+ }
+ /* Hint: pspp.html is a directory...*/
+ htmlfullname = g_strdup_printf ("%s/%s", relocate (DOCDIR "/pspp.html"),
+ htmlfilename);
+ if (g_file_test (relocate (DOCDIR "/pspp.html"), G_FILE_TEST_IS_DIR))
+ {
+ GError *urierr = NULL;
+ htmluri = g_filename_to_uri (htmlfullname,NULL, &urierr);
+ if (!htmluri)
+ {
+ msg (ME, _("Help path conversion error: %s"), urierr->message);
+ htmluri = htmlfullname;
+ }
+ g_clear_error (&urierr);
+ }
+ else
+ htmluri = g_strdup_printf (PACKAGE_URL "manual/html_node/%s",
+ htmlfilename);
+ g_free (htmlfullname);
+ g_free (htmlfilename);
+ htmlargv[1] = htmluri;
+
+ /* The following **SHOULD** work but it does not on 28.5.2016
+ g_app_info_launch_default_for_uri (htmluri, NULL, &err);
+ osx: wine is started to launch the uri...
+ windows: not so bad, but the first access does not work*/
+
+ if (! (g_spawn_async (NULL, argv,
+ NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, &err) ||
+#ifdef _WIN32
+ open_windows_help (htmluri, &htmlerr))
+#else
+ g_spawn_async (NULL, htmlargv,
+ NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, &htmlerr))
+#endif
+ )
+ {
+ msg (ME, _("Cannot open reference manual via yelp: %s. "
+ "Cannot open via html: %s "
+ "with uri: %s "
+ "The PSSP manual is also available at %s"),