- if ( ( n = getline( &buf, &buf_sz, color_file ) ) < 0 ) {
- die( "%s: Can't count colors: %d", argv[0], errno );
- }
- string colors = string( buf, n );
- pclose( color_file );
-
- if ( !colors.size() ||
- colors.find_first_not_of( "0123456789" ) != string::npos ||
- atoi( colors.c_str() ) < 0 ) {
- colors = "0";
- }