This updated patch adds supports for comments between images as well
as white-space.
Cheers,
Shaun
--- netpbm-free-10.0.orig/pbm/libpm.c
+++ netpbm-free-10.0/pbm/libpm.c
@@ -20,6 +20,7 @@
#include "shhopt.h"
#include "pm.h"
+#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
@@ -829,8 +830,14 @@
pm_nextimage(FILE * const file, int * const eofP) {
int c;
-
- c = getc(file);
+ do {
+ c = getc(file);
+ if (c == '#') {
+ do {
+ c = getc(file);
+ } while (c != '\n' && c != '\r' && c != EOF);
+ }
+ } while (isspace(c));
if (c == EOF) {
if (feof(file))
*eofP = TRUE;