iOS/buildlibs/armv7/allegro-4.4.2/demos/skater/source/credits.c
/* reads credit info from various places */
reads credit info from various places
reads credit info from various places
void load_credits(void)
{
   char buf[256], *p, *p2;
   CREDIT_NAME *c = NULL;
   PACKFILE *f;
   f = open_relative_file(buf, sizeof(buf), "docs/src/thanks._tx");
   if (!f)
      return;
   while (pack_fgets(buf, sizeof(buf) - 1, f) != 0) {
      if (stricmp(buf, "Thanks!") == 0)
         break;
      while ((p = strstr(buf, "&lt")) != NULL) {
         *p = '<';
         memmove(p + 1, p + 3, strlen(p + 2));
      }
      while ((p = strstr(buf, "&gt")) != NULL) {
         *p = '>';
         memmove(p + 1, p + 3, strlen(p + 2));
      }
      p = buf;
      while ((*p) && (uisspace(*p)))
         p++;
      p2 = p;
      while ((*p2) && ((!uisspace(*p2)) || (*(p2 + 1) != '(')))
         p2++;
      if ((strncmp(p2, " (<email>", 9) == 0) ||
          (strncmp(p2, " (email", 7) == 0)) {
         *p2 = 0;
         c = malloc(sizeof(CREDIT_NAME));
         c->name = malloc(strlen(p) + 1);
         strcpy(c->name, p);
         c->text = NULL;
         c->next = credits;
         credits = c;
      } else if (*p) {
         if (c) {
            p2 = p + strlen(p) - 1;
            while ((p2 > p) && (uisspace(*p2)))
               *(p2--) = 0;
            if (c->text) {
               c->text = realloc(c->text, strlen(c->text) + strlen(p) + 2);
               strcat(c->text, " ");
               strcat(c->text, p);
            } else {
               c->text = malloc(strlen(p) + 1);
               strcpy(c->text, p);
            }
         }
      } else
         c = NULL;
   }
   pack_fclose(f);
   sort_credit_list();
}
void load_credits ( void ) { char buf [ 256 ] , * p , * p2 ; CREDIT_NAME * c = NULL ; PACKFILE * f ; f = open_relative_file ( buf , sizeof ( buf ) , " " ) ; if ( ! f ) return ; while ( pack_fgets ( buf , sizeof ( buf ) - 1 , f ) != 0 ) { if ( stricmp ( buf , " " ) == 0 ) break ; while ( ( p = strstr ( buf , " " ) ) != NULL ) { * p = ' ' ; memmove ( p + 1 , p + 3 , strlen ( p + 2 ) ) ; } while ( ( p = strstr ( buf , " " ) ) != NULL ) { * p = ' ' ; memmove ( p + 1 , p + 3 , strlen ( p + 2 ) ) ; } p = buf ; while ( ( * p ) && ( uisspace ( * p ) ) ) p ++ ; p2 = p ; while ( ( * p2 ) && ( ( ! uisspace ( * p2 ) ) || ( * ( p2 + 1 ) != ' ' ) ) ) p2 ++ ; if ( ( strncmp ( p2 , " " , 9 ) == 0 ) || ( strncmp ( p2 , " " , 7 ) == 0 ) ) { * p2 = 0 ; c = malloc ( sizeof ( CREDIT_NAME ) ) ; c -> name = malloc ( strlen ( p ) + 1 ) ; strcpy ( c -> name , p ) ; c -> text = NULL ; c -> next = credits ; credits = c ; } else if ( * p ) { if ( c ) { p2 = p + strlen ( p ) - 1 ; while ( ( p2 > p ) && ( uisspace ( * p2 ) ) ) * ( p2 -- ) = 0 ; if ( c -> text ) { c -> text = realloc ( c -> text , strlen ( c -> text ) + strlen ( p ) + 2 ) ; strcat ( c -> text , " " ) ; strcat ( c -> text , p ) ; } else { c -> text = malloc ( strlen ( p ) + 1 ) ; strcpy ( c -> text , p ) ; } } } else c = NULL ; } pack_fclose ( f ) ; sort_credit_list ( ) ; }
reads credit info from various places
reads credit info from various places
/* parse thanks._tx */ /* sort the lists */