String parsing/stripping code I am mostly interested in how the parse_string function could be improved.  But any comments on my test strategy also welcome.

The input is a string which can be either all digits in which case the result should be the digits string OR there can be string formatting outside angle brackets which must be removed.  the digit string is enclosed within the angle brackets in that case.

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

char* parse_string(const char* s, char* parsed) {
   /* sample string for angle brackets */
   const char* p = s;
   int lbrack = -1, rbrack = -1;
   while(*p) {
      if(*p == '&lt;' &amp;&amp; lbrack == -1)  /* grab first &lt; */
         lbrack = p - s;
      else if(*p == '&gt;') /* and last &gt; char */
         rbrack = p - s;

      ++p;
   }

   /* strip everything BEFORE &lt; and AFTER &gt; if have brackets and in correct order */
   if(lbrack != -1 &amp;&amp; rbrack != -1 &amp;&amp; lbrack &lt; rbrack) {
      memcpy(parsed, s+lbrack+1, rbrack-1-lbrack);
      parsed[rbrack-1-lbrack] = '\0';
   }
   else {
      strcpy(parsed, s ? s : "");
   }

   return parsed;
}

int main() {

   char buf[100];
   /* 4 normal cases, error cases  */
   const char* input[] = { "N&lt;737867&gt;Sales Line 1", "123456", "", "&lt;123&gt;", "&lt;", "&gt;", "", "&lt;&lt;&lt;&lt;123&gt;", "&lt;123&gt;&gt;&gt;&gt;", "&lt;123", "123&gt;" };
   const char* output[] = { "737867", "123456", "", "123", "&lt;", "&gt;", "", "&lt;&lt;&lt;123", "123&gt;&gt;&gt;", "&lt;123", "123&gt;" };
   size_t sz = sizeof(input) / sizeof(input[0]);

   size_t i;
   for(i = 0; i &lt; sz; ++i) {
      printf("Test string \"%s\" =&gt; \"%s\", %s\n", input[i], output[i], strcmp(output[i], parse_string(input[i], buf)) == 0 ? "passed" : "failed");
   }
   return 0;
}
Add a buffer length parameter and then use strncpy to avoid overflow.
Your testing code hides the usage of the function. It's clearer to put it on a separate line:

for(i = 0; i &lt; sz; ++i) {
    parse_string(input[i], buf)
    printf("Test string \"%s\" =&gt; \"%s\", %s\n", 
                 input[i], output[i], strcmp(output[i], buf) == 0 ? "passed" : "failed");
}

You missed the out of order cases like &gt;123&lt;