This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: String parsing in stap script
- From: Jim Keniston <jkenisto at us dot ibm dot com>
- To: Mike Mason <mmlnx at us dot ibm dot com>
- Cc: SystemTAP <systemtap at sources dot redhat dot com>
- Date: 09 Nov 2006 11:41:54 -0800
- Subject: Re: String parsing in stap script
- Organization:
- References: <455380BE.4070008@us.ibm.com>
On Thu, 2006-11-09 at 11:25, Mike Mason wrote:
> I'm trying to figure out how to parse a string in a stap script. Ideally,
> I'd like a function like strsep() where I pass in a string and delimiter
> and get back a token and a pointer to the string past the token. Given
> that a stap function can only pass back one value, I don't see how to
> accomplish this. Any suggestions or is this just not possible?
Have you considered storing the parsing context in a struct (created via
embedded C) and passing around a pointer to that?
Jim
>
> BTW, my initial reason for wanting this is to pass an array from a shell
> script to a stap script. I figure I can just pass it as one long
> delimited string, then parse it on the stap side to get it back in array
> form.
>
> - Mike
>