From dfd8bb34d4d06033c5062ef19f2e5a2f77d5f6c9 Mon Sep 17 00:00:00 2001 From: mmason Date: Tue, 23 Jan 2007 18:03:50 +0000 Subject: Added new string functions tokenize() and strtol(). --- testsuite/systemtap.string/tokenize.stp | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 testsuite/systemtap.string/tokenize.stp (limited to 'testsuite/systemtap.string/tokenize.stp') diff --git a/testsuite/systemtap.string/tokenize.stp b/testsuite/systemtap.string/tokenize.stp new file mode 100644 index 00000000..10703d90 --- /dev/null +++ b/testsuite/systemtap.string/tokenize.stp @@ -0,0 +1,46 @@ +probe begin +{ + teststr1 = "one|two|three|four|five|six|seven|eight|nine|ten" + teststr2 = "a,b,c,d,e,f,g" + teststr3 = "1,,2,3, ,4" + teststr4 = "" + teststr5 = "this is a string with no delimiters" + + tok = tokenize(teststr1, "|") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", "|") + } + + tok = tokenize(teststr1, ",") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", "|") + } + + tok = tokenize(teststr2, ",") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", ",") + } + + tok = tokenize(teststr3, ",") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", ",") + } + + tok = tokenize(teststr4, ",") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", ",") + } + + tok = tokenize(teststr5, ",") + while (tok != "") { + printf("%s\n", tok) + tok = tokenize("", ",") + } + + exit() +} -- cgit