File: tget_help_text.c

package info (click to toggle)
sollya 8.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,540 kB
  • sloc: ansic: 124,655; yacc: 7,543; lex: 2,440; makefile: 888; cpp: 77
file content (42 lines) | stat: -rw-r--r-- 906 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <sollya.h>
#include <string.h>

int main(void) {
  const char *s;
  char *t;
  sollya_lib_init();

  /* No need to free the returned char * */
  s = sollya_lib_get_help_text("foo");
  if (s) {
    sollya_lib_printf("Help text for 'foo':\n%s", s);
  }
  else {
    sollya_lib_printf("\"foo\" is an identifier.\n");
  }

  s = sollya_lib_get_help_text("remez");
  if (!s) {
      sollya_lib_printf("\"remez\" is an identifier.\n");
  }
  else {
    t = strstr(s, "remez");
    if (t && (t-s <= 10)) {
      sollya_lib_printf("'remez' help text really is about remez.\n");
    }
    else {
      sollya_lib_printf("'remez' help text is the following:\n%s", s);
    }
  }

  s = sollya_lib_get_help_text("for");
  if (!s) {
      sollya_lib_printf("\"for\" is an identifier.\n");
  }
  else {
    sollya_lib_printf("'for' help text is the following:\n%s", s);
  }

  sollya_lib_close();
  return 0;
}