static void read_pnm_header(FILE *reader, struct pnm_header *ph)
{
- char *s;
int format, have_wh, end, ttype;
char idf[256], type[256];
char line[256];
while(fgets(line, 250, reader))
{
+ char *s;
+
if(*line == '#') continue;
s = line;
have_wh = 1;
if(format == 1 || format == 4) break;
-
+
+ if(format == 2 || format == 3 || format == 5 || format == 6)
+ {
+ if (skip_int(s, &ph->maxval) != NULL) {
+ if(ph->maxval > 65535) {
+ return;
+ }
+ else {
+ break;
+ }
+ }
+ }
continue;
}
if(format == 2 || format == 3 || format == 5 || format == 6)