/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
  int i,state,ix;
  char buffer[]="aaa<->bbb<->ccc<->";
  char result[10];
  state=1;
  ix=0;
  for(i=0;i<strlen(buffer);i++) {
     switch(buffer[i]) {
        case '<':
           result[ix]='\0';
           if(strlen(result)>0) printf("%s\n",result);
           state=0;
           break;
        case '>':
           state=1;
           ix=0;
           break;
        default:
           if(state) {
               result[ix]=buffer[i];
               ix++;
           }
           break;
      }
  }
  return 0;
}
