Give me your strings.

Tom Christiansen tchrist at convex.COM
Wed Feb 13 07:10:54 AEST 1991


>From the keyboard of cl at lgc.com (Cameron Laird):
:I want to be able to type
:
:	show_me_source_strings source1.c source2.c
:
:and receive something like
:
:	source1.c:	"This is a string in the C-source source1.c"
:	source1.c:	"I'm a string too, passed to the function %s.\n""
:	source1.c:	"I initialize a char *.";
:	source2.c:	"Me too; I'm in the string-space of this program."
:	source2.c:	"There's another string in this file, but it's in comments."
:
:Is the point clear?  I'm looking for an executable that knows enough C
:(or Pascal, ...) syntax to isolate string constants, and echo them out
:to a file (possibly stdout).

The cxref program will do this for you.  You could also use xstr.  You'll
have to postprocess each of these to get precisely the output you
specified.  xstr is available on uunet:bsd-sources/pgrm/xstr/* via anon
ftp.  I would use xstr myself.

Perl solutions available upon demand. :-)

--tom
-- 
Send compilers articles to compilers at iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.



More information about the Comp.unix.programmer mailing list