title: C: Sort a list of structs by a given sorting
body: <p>I have a list of structs:</p>
  
  <pre><code>typedef struct {
      uint8_t mac_addr[6];
      uint32_t signal;
      uint32_t freq;
      ...
  }pseudo_entry;
  </code></pre>
  
  <p>I'm sorting this entrys when inserting something in the list.</p>
  
  <p>Pseudo:</p>
  
  <pre><code>while(next)
    if(curr.mac_addr &lt; next.mac_addr)
        if(curr.signal &lt; next.signal)
        ...
  </code></pre>
  
  <p>That's very inflexible and I want an ordering I can give as startup parameter.
  Any good ideas? </p>
  
  <p>I don't need whole code. Just ideas or maybe libs.</p>
  
  <p>Thanks. :)</p>