From 5b328efe93befa4d48774985bd0254560d9c8470 Mon Sep 17 00:00:00 2001 From: kevinrs Date: Wed, 28 Sep 2005 00:29:47 +0000 Subject: tapset/mask_string.stp: wrote a few aux functions that can be used by tapsets to derive a bitmask symbolic string from a given number tapset/string.stp: strlen: Returns the length of the string argument substr: Returns a substring starting at start/ending at stop stapfuncs.5.in: Added a STRING category with aforementioned functions tapset/system_calls.stp Exported more variable for more system calls --- tapset/string.stp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tapset/string.stp (limited to 'tapset/string.stp') diff --git a/tapset/string.stp b/tapset/string.stp new file mode 100644 index 00000000..f6933724 --- /dev/null +++ b/tapset/string.stp @@ -0,0 +1,18 @@ +function strlen:long(s:string) %{ + THIS->__retvalue=strlen(THIS->s); +%} + +function substr:string(str:string,start:long,stop:long) %{ + int len=strlen(THIS->str); + if(THIS->start<0 || THIS->stop<0 || + THIS->start>len || THIS->stop>len || + THIS->start>=THIS->stop) + { + return; + } + else { + char *s=THIS->str; + strncpy(THIS->__retvalue,s+THIS->start,THIS->stop); + THIS->__retvalue[THIS->stop]='\0'; + } +%} -- cgit