summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.string/text_str.stp
blob: 05acc4315b40a7dd5c1f77b5975812cbd2396e0c (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
probe begin {
	a = "1234567890"
	b = a.a
	c = a.b
	printf("a=%s\n", a)
	printf("b=%s\n", b)
	printf("c=%s\n", c)

	printf("----- Using text_str -----\n");
	printf("a=%s\n", text_str(a))
	printf("b=%s\n", text_str(b))
	printf("c=%s\n", text_str(c))

	printf("----- Using text_strn -----\n");
	printf("a=%s\n", text_strn(a,0,0))
	printf("b=%s\n", text_strn(b,0,0))
	printf("c=%s\n", text_strn(c,0,0))

	printf("----- Using text_strn len = 10 -----\n");
	printf("a=%s\n", text_strn(a,10,0))
	printf("b=%s\n", text_strn(b,10,0))
	printf("c=%s\n", text_strn(c,10,0))

	printf("----- Using text_strn quoted -----\n");
	printf("a=%s\n", text_strn(a,0,1))
	printf("b=%s\n", text_strn(b,0,1))
	printf("c=%s\n", text_strn(c,0,1))

	printf("----- Using text_strn len=10, quoted -----\n");
	printf("a=%s\n", text_strn(a,10,1))
	printf("b=%s\n", text_strn(b,10,1))
	printf("c=%s\n", text_strn(c,10,1))

	printf("----- Using text_strn len=12, quoted -----\n");
	printf("a=%s\n", text_strn(a,12,1))
	printf("b=%s\n", text_strn(b,12,1))
	printf("c=%s\n", text_strn(c,12,1))

	a = "\n\nXYZZY\031"
	b = "\077\031\a\n\n\r\n"
	c = a.b

	printf("----- Using text_str -----\n");
	printf("a=%s\n", text_str(a))
	printf("b=%s\n", text_str(b))
	printf("c=%s\n", text_str(c))

	printf("----- Using text_strn -----\n");
	printf("a=%s\n", text_strn(a,0,0))
	printf("b=%s\n", text_strn(b,0,0))
	printf("c=%s\n", text_strn(c,0,0))

	printf("----- Using text_strn len = 10 -----\n");
	printf("a=%s\n", text_strn(a,10,0))
	printf("b=%s\n", text_strn(b,10,0))
	printf("c=%s\n", text_strn(c,10,0))

	printf("----- Using text_strn len = 12 -----\n");
	printf("a=%s\n", text_strn(a,12,0))
	printf("b=%s\n", text_strn(b,12,0))
	printf("c=%s\n", text_strn(c,12	,0))

	printf("----- Using text_strn quoted -----\n");
	printf("a=%s\n", text_strn(a,0,1))
	printf("b=%s\n", text_strn(b,0,1))
	printf("c=%s\n", text_strn(c,0,1))

	printf("----- Using text_strn len=10, quoted -----\n");
	printf("a=%s\n", text_strn(a,10,1))
	printf("b=%s\n", text_strn(b,10,1))
	printf("c=%s\n", text_strn(c,10,1))

	printf("----- Using text_strn len=14, quoted -----\n");
	printf("a=%s\n", text_strn(a,14,1))
	printf("b=%s\n", text_strn(b,14,1))
	printf("c=%s\n", text_strn(c,14,1))

	exit()
}