title: implementing a string translation table in c
body: <p>I want to implement a basic search/replace translation table in C; that is, it will read in a list of pairs of words from a config file, and go through a text received at runtime, replacing each source word it finds with the corresponding target word. For example, if my user-input text was</p>
  
  <pre><code>"Hello world, how are you today?"
  </code></pre>
  
  <p>and my config file was</p>
  
  <pre><code>world user
  how why
  </code></pre>
  
  <p>running the function would return</p>
  
  <pre><code>"Hello user, why are you today?"
  </code></pre>
  
  <p>I could do this with a modest amount of tedium (currently looking at the <a href="http://library.gnome.org/devel/glib/unstable/glib-String-Utility-Functions.html" rel="nofollow noreferrer">glib string utility functions</a>, because they're there), but I'm thinking this has got to be a fully solved problem in some library or another. Any pointers?</p>
  
  <p>(No, this is not homework, although I'll admit the problem sounds reasonably homeworky :) I'm writing a libpurple plugin, hence the pure C requirement.)</p>