iOS/buildlibs/armv7/allegro-4.4.2/demos/skater/source/credits.c
/* formats a list of TEXT_LIST structure into a single string */
formats a list of TEXT_LIST structure into a single string
formats a list of TEXT_LIST structure into a single string
char *format_text(TEXT_LIST * head, char *eol, char *gap)
{
   TEXT_LIST *l;
   int size = 0;
   char *s;
   l = head;
   while (l) {
      if (l->text[0])
         size += strlen(l->text) + strlen(eol);
      else
         size += strlen(gap) + strlen(eol);
      l = l->next;
   }
   s = malloc(size + 1);
   s[0] = 0;
   l = head;
   while (l) {
      if (l->text[0])
         strcat(s, l->text);
      else
         strcat(s, gap);
      strcat(s, eol);
      l = l->next;
   }
   return s;
}
char * format_text ( TEXT_LIST * head , char * eol , char * gap ) { TEXT_LIST * l ; int size = 0 ; char * s ; l = head ; while ( l ) { if ( l -> text [ 0 ] ) size += strlen ( l -> text ) + strlen ( eol ) ; else size += strlen ( gap ) + strlen ( eol ) ; l = l -> next ; } s = malloc ( size + 1 ) ; s [ 0 ] = 0 ; l = head ; while ( l ) { if ( l -> text [ 0 ] ) strcat ( s , l -> text ) ; else strcat ( s , gap ) ; strcat ( s , eol ) ; l = l -> next ; } return s ; }
formats a list of TEXT_LIST structure into a single string
formats a list of TEXT_LIST structure into a single string