src/config/config.cc
/*
 * Fills the buffer with data from the file.
 *
 * Assumes the file is positioned at the beginning of a key.
 *
 * Returns success if a newline or EOF is encountered before the buffer fills.
 * Returns failure if the buffer fills.
 */
Fills the buffer with data from the file.
Assumes the file is positioned at the beginning of a key.

Returns success if a newline or EOF is encountered before the buffer fills.
Returns failure if the buffer fills.
Fills the buffer with data from the file . Assumes the file is positioned at the beginning of a key . Returns success if a newline or EOF is encountered before the buffer fills . Returns failure if the buffer fills .
bool Config::ScanVal(char *buf, size_t buf_size, FILE *config) {
  size_t i = 0;
  int next_byte = fgetc(config);
  while ((next_byte != '\n') && (next_byte != EOF)) {
    buf[i] = next_byte;
    next_byte = fgetc(config);
    if (++i >= buf_size) {
      do {
        next_byte = fgetc(config);
      } while ((next_byte != '\n') && (next_byte != EOF));
      return false;
    }
  }
  buf[i] = '\0';
  return true;
}
bool Config :: ScanVal ( char * buf , size_t buf_size , FILE * config ) { size_t i = 0 ; int next_byte = fgetc ( config ) ; while ( ( next_byte != ' \n ' ) && ( next_byte != EOF ) ) { buf [ i ] = next_byte ; next_byte = fgetc ( config ) ; if ( ++ i >= buf_size ) { do { next_byte = fgetc ( config ) ; } while ( ( next_byte != ' \n ' ) && ( next_byte != EOF ) ) ; return false ; } } buf [ i ] = ' \0 ' ; return true ; }
Fills the buffer with data from the file.
Fills the buffer with data from the file .
// Scan the line until either a stop character is encountered or // the buffer has been filled. // Add the character to the buffer and read the next character. // Check if the buffer has been filled. // Terminate the string and return failure.