static int rwpipe_read_ppm_header( rwpipe *rw, int *width, int *height )

{

    char line[ 3 ];

    FILE *in = rwpipe_reader( rw );

    int max;



    fgets( line, 3, in );

    if ( !strncmp( line, "P6", 2 ) )

    {

        *width = rwpipe_read_number( rw );

        *height = rwpipe_read_number( rw );

        max = rwpipe_read_number( rw );

        return max != 255 || *width <= 0 || *height <= 0;

    }

    return 1;

}

static int rwpipe_read_ppm_header( rwpipe *rw, int *width, int *height )

{

    char line[ 3 ];

    FILE *in = rwpipe_reader( rw );

    int max;



    fgets( line, 3, in );

    if ( !strncmp( line, "P6", 2 ) )

    {

        *width = rwpipe_read_number( rw );

        *height = rwpipe_read_number( rw );

        max = rwpipe_read_number( rw );

        return max != 255 || *width <= 0 || *height <= 0;

    }

    return 1;

}

static int FUNC_0( rwpipe *VAR_0, int *VAR_1, int *VAR_2 )

{

    char VAR_3[ 3 ];

    FILE *in = rwpipe_reader( VAR_0 );

    int VAR_4;



    fgets( VAR_3, 3, in );

    if ( !strncmp( VAR_3, "P6", 2 ) )

    {

        *VAR_1 = rwpipe_read_number( VAR_0 );

        *VAR_2 = rwpipe_read_number( VAR_0 );

        VAR_4 = rwpipe_read_number( VAR_0 );

        return VAR_4 != 255 || *VAR_1 <= 0 || *VAR_2 <= 0;

    }

    return 1;

}

static int FUNC_0( rwpipe *VAR_0, int *VAR_1, int *VAR_2 )
{ char VAR_3[ 3 ]; FILE *in = rwpipe_reader( VAR_0 ); int VAR_4; fgets( VAR_3, 3, in ); if ( !strncmp( VAR_3, "P6", 2 ) )
{ *VAR_1 = rwpipe_read_number( VAR_0 ); *VAR_2 = rwpipe_read_number( VAR_0 ); VAR_4 = rwpipe_read_number( VAR_0 ); return VAR_4 != 255 || *VAR_1 <= 0 || *VAR_2 <= 0; } return 1; }