Debian Codegraph @

testsuite/systemtap.string/str_replace.stp

raw
1 # Test of str_replace()
2
3 global long_str1 = "hello system tap"
4 global long_str2 = "Here I am, on the road again. there I am, up on the stage, Here I go, playing star again. There I go, turn the page.- Bob Seger"
5 global long_src_str1 = "system"
6 global long_src_str2 = "hello"
7 global long_src_str3 = "tap"
8 global long_rlpc_str = "pointer"
9
10 probe begin {
11 printf("Result = %s\n",str_replace(long_str1, long_src_str1, long_rlpc_str))
12 printf("Result = %s\n",str_replace(long_str1, long_src_str2, long_rlpc_str))
13 printf("Result = %s\n",str_replace(long_str1, long_src_str3, long_rlpc_str))
14
15 printf("Result = %s\n",str_replace(long_str2, "road", "bored"))
16 printf("Result = %s\n",str_replace(long_str2, "Here", "here"))
17 printf("Result = %s\n",str_replace(long_str2, "Bob Seger", "Metallica"))
18 printf("Result = %s\n",str_replace(long_str1, long_src_str1, "\0"))
19 printf("Result = %s\n",str_replace(long_str1, "\0", long_rlpc_str))
20 printf("Result = %s\n",str_replace("\0", "\0", long_rlpc_str))
21 printf("Result = %s\n",str_replace("\0", "\0", "\0"))
22 }
23 probe begin {
24 exit()
25 }