[GRASS5] G_string_replace ()?

Markus Neteler neteler at itc.it
Thu Mar 11 08:52:04 EST 2004

On Thu, Mar 11, 2004 at 12:09:05PM +0100, Thierry Laronde wrote:
> On Thu, Mar 11, 2004 at 08:55:26AM +0100, Markus Neteler wrote:
> > On Wed, Mar 10, 2004 at 05:05:54PM +0100, Thierry Laronde wrote:
> > > FWIW, for string manipulations (and for OSes not supporting awk just
> > > provide an already "digest" version) simply use:
> > > 
> > > cat old_file | awk 'BEGIN { ORS="<br>";} {print;}' > new_file
> > 
> > 
> > Thierry,
> > 
> > thanks for the hint but I need to implement a C solution
> > in lib/gis/parser.c.
> You will have to use the POSIX strstr() function in this case. But may I
> suggest that, if this is "just" to generate the HTML pages, it will be
> more easy to implement this using UNIX powertools (sed | awk), providing
> platforms not having them with a pregenerated tarball?

In GRASS 5.7 the parser is generating the top part of the
HTML documentation automated. That's why a C solution is needed.
It's easy to do in shell, but not applicable here.
I tired a while to implement it, but got lost with
pointers, loops and the str* functions.

Practically I need an extension of 
 char * G_strchg(char* bug, char character, char new) {
 /* replace all occurencies of "character" in string(bug) with
  * "new", returns new string */

written by Bernhard. Instead of accepting a single new character 
insertion of several characters is required.

Look at the HTML page of v.clean, "tool" section and you
understand why it is needed:


Here are > 300 subscribers in the list, hope there is one
person to help me :-)


More information about the grass-dev mailing list