The following knowledge document gives a sample r_admin program for TSS, ACF2 structure would be the same only using ACF2 commands.
https://knowledge.broadcom.com/external/article?articleId=189964
The program is very basic.
Basically, you pass an ACF2 command on the r_admin call, just like you would on a terminal and batch program. The syntax must be correct and the user executing the program must have the proper ACF2 admin privileges, just like if you were entering the ACF2 commands from the terminal or a batch job.
To enter multiple commands through R_admin use the MULT keyword and delimited by a '~' character. This is critical because you frequently need to do a "set" before doing a "list". ex. "MULT SET LID~LIST USER01" or "MULT SET RULE~LIST LIKE(-)". R_admin will pass back the results and messages of the ACF2 commands in a buffer. The R_admin call will return the message block. After the header section of the block, there will be a message entry. There can be one or many message entries. Each message entry will have a length and a variable text.
For calls to list something that was compiled or decompiled (ex. a rule), each rule line will be returned as a message entry. For calls to list anything that is not compiled or decompiled, the R_admin call will store each line of output in a message entry that would make it return the same messages and results that you would get if you entered the ACF2 command from a terminal or batch job.
It is up to you to parse and extract the information that you need from a buffer passed back.