| 247 | } |
| 248 | |
| 249 | const char* feHelpBrowser(char* which, int warn) |
| 250 | { |
| 251 | int i = 0; |
| 252 | |
| 253 | // if no argument, choose first available help browser |
| 254 | if (heHelpBrowsers==NULL) feBrowserFile(); |
| 255 | if (which == NULL || *which == '\0') |
| 256 | { |
| 257 | // return, if already set |
| 258 | if (heCurrentHelpBrowser != NULL) |
| 259 | return heCurrentHelpBrowser->browser; |
| 260 | |
| 261 | // First, try emacs, if emacs-option is set |
| 262 | if (feOptValue(FE_OPT_EMACS) != NULL) |
| 263 | { |
| 264 | while (heHelpBrowsers[i].browser != NULL) |
| 265 | { |
| 266 | if (strcmp(heHelpBrowsers[i].browser, "emacs") == 0 && |
| 267 | (heHelpBrowsers[i].init_proc(0,i))) |
| 268 | { |
| 269 | heCurrentHelpBrowser = &(heHelpBrowsers[i]); |
| 270 | heCurrentHelpBrowserIndex=i; |
| 271 | goto Finish; |
| 272 | } |
| 273 | i++; |
| 274 | } |
| 275 | i=0; |
| 276 | } |
| 277 | while (heHelpBrowsers[i].browser != NULL) |
| 278 | { |
| 279 | if (heHelpBrowsers[i].init_proc(0,i)) |
| 280 | { |
| 281 | heCurrentHelpBrowser = &(heHelpBrowsers[i]); |
| 282 | heCurrentHelpBrowserIndex=i; |
| 283 | goto Finish; |
| 284 | } |
| 285 | i++; |
| 286 | } |
| 287 | // should never get here |
| 288 | dReportBug("should never get here"); |
| 289 | } |
| 290 | |
| 291 | // with argument, find matching help browser |
| 292 | while (heHelpBrowsers[i].browser != NULL && |
| 293 | strcmp(heHelpBrowsers[i].browser, which) != 0) |
| 294 | {i++;} |
| 295 | |
| 296 | if (heHelpBrowsers[i].browser == NULL) |
| 297 | { |
| 298 | if (warn) Warn("No help browser '%s' available.", which); |
| 299 | } |
| 300 | else |
| 301 | { |
| 302 | // see whether we can init it |
| 303 | if (heHelpBrowsers[i].init_proc(warn,i)) |
| 304 | { |
| 305 | heCurrentHelpBrowser = &(heHelpBrowsers[i]); |
| 306 | heCurrentHelpBrowserIndex=i; |
no test coverage detected