Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2551 in orxonox.OLD for orxonox/trunk/src/ini_parser.cc


Ignore:
Timestamp:
Oct 11, 2004, 12:53:43 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: minor changes - enhanced sc controll, fixed uncontrolled rotation effect, added some debug outputs for testing purposes, reformatted some src files from win style but not all

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/ini_parser.cc

    r2190 r2551  
    6363int IniParser::get_section( char* section)
    6464{
    65         bInSection = false;
    66         if( stream == NULL) return -1;
    67        
    68         char linebuffer[PARSELINELENGHT];
    69         char secbuffer[PARSELINELENGHT];
    70         char* ptr;
    71        
    72         rewind (stream);
    73         while( !feof( stream))
     65  bInSection = false;
     66  if( stream == NULL) return -1;
     67 
     68  char linebuffer[PARSELINELENGHT];
     69  char secbuffer[PARSELINELENGHT];
     70  char* ptr;
     71 
     72  rewind (stream);
     73  while( !feof( stream))
     74    {
     75      // get next line
     76      fgets (linebuffer, PARSELINELENGHT, stream);
     77      // remove newline char
     78      if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
     79      // check for section identifyer
     80      if( sscanf (linebuffer, "[%s", secbuffer) == 1)
    7481        {
    75                         // get next line
    76                 fgets (linebuffer, PARSELINELENGHT, stream);
    77                         // remove newline char
    78                 if( (ptr = strchr( linebuffer, '\n')) != NULL) *ptr = 0;
    79                         // check for section identifyer
    80                 if( sscanf (linebuffer, "[%s", secbuffer) == 1)
     82          if( (ptr = strchr( secbuffer, ']')) != NULL)
     83            {
     84              *ptr = 0;
     85              if( !strcmp( secbuffer, section))
    8186                {
    82                         if( (ptr = strchr( secbuffer, ']')) != NULL)
    83                         {
    84                                 *ptr = 0;
    85                                 if( !strcmp( secbuffer, section))
    86                                 {
    87                                         bInSection = true;
    88                                         return 0;
    89                                 }
    90                         }
     87                  bInSection = true;
     88                  return 0;
    9189                }
     90            }
    9291        }
    93         return -1;
     92    }
     93  return -1;
    9494}
    9595
Note: See TracChangeset for help on using the changeset viewer.