1 The getline function used in a couple of places in netpbm-free is also
2 defined by POSIX:2008, and so netpbm-free fails to build with newer
3 versions of (e)glibc. Here's a patch to rename it.
5 * Rename getline functions to get_line to avoid conflict with POSIX:2008.
7 --- netpbm-free-10.0.orig/ppm/xvminitoppm.c
8 +++ netpbm-free-10.0/ppm/xvminitoppm.c
13 -static void getline ARGS((FILE *fp, char *buf));
14 +static void get_line ARGS((FILE *fp, char *buf));
24 if( strncmp(buf, "P7 332", 6) != 0 )
25 pm_error("bad magic number - not a XV thumbnail picture");
30 if( strncmp(buf, "#END_OF_COMMENTS", 16)==0 )
32 if( strncmp(buf, "#BUILTIN", 8)==0 )
33 pm_error("cannot convert builtin XV thumbnail pictures");
37 if( sscanf(buf, "%d %d %d", &cols, &rows, &maxval) != 3 )
38 pm_error("error parsing dimension info");
49 --- netpbm-free-10.0.orig/ppm/xpmtoppm.c
50 +++ netpbm-free-10.0/ppm/xpmtoppm.c
55 -getline(char * const line, int const size, FILE * const stream) {
56 +get_line(char * const line, int const size, FILE * const stream) {
57 /*----------------------------------------------------------------------------
58 Read the next line from the input file 'stream', through the one-line
59 buffer lastInputLine[].
61 Exit program if the line doesn't fit in the buffer.
62 -----------------------------------------------------------------------------*/
63 if (size > MAX_LINE+1)
64 - pm_error("INTERNAL ERROR: getline() received 'size' parameter "
65 + pm_error("INTERNAL ERROR: get_line() received 'size' parameter "
66 "which is out of bounds");
70 int * const transparentP) {
71 /*----------------------------------------------------------------------------
72 Read the header of the XPM file on stream 'stream'. Assume the
73 - getline() stream is presently positioned to the beginning of the
74 + get_line() stream is presently positioned to the beginning of the
75 file and it is a Version 3 XPM file. Leave the stream positioned
79 *widthP = *heightP = *ncolorsP = *chars_per_pixelP = -1;
81 /* Read the XPM signature comment */
82 - getline(line, sizeof(line), stream);
83 + get_line(line, sizeof(line), stream);
84 if (strncmp(line, xpm3_signature, strlen(xpm3_signature)) != 0)
85 pm_error("Apparent XPM 3 file does not start with '/* XPM */'. "
86 "First line is '%s'", xpm3_signature);
88 /* Read the assignment line */
89 - getline(line, sizeof(line), stream);
90 + get_line(line, sizeof(line), stream);
91 if (strncmp(line, "static char", 11) != 0)
92 pm_error("Cannot find data structure declaration. Expected a "
93 "line starting with 'static char', but found the line "
96 /* Read the hints line */
97 - getline(line, sizeof(line), stream);
98 + get_line(line, sizeof(line), stream);
99 /* skip the comment line if any */
100 if (!strncmp(line, "/*", 2)) {
101 while (!strstr(line, "*/"))
102 - getline(line, sizeof(line), stream);
103 - getline(line, sizeof(line), stream);
104 + get_line(line, sizeof(line), stream);
105 + get_line(line, sizeof(line), stream);
107 if (sscanf(line, "\"%d %d %d %d\",", widthP, heightP,
108 ncolorsP, chars_per_pixelP) != 4)
109 @@ -427,10 +427,10 @@
110 *transparentP = -1; /* initial value */
112 for (seqNum = 0; seqNum < *ncolorsP; seqNum++) {
113 - getline(line, sizeof(line), stream);
114 + get_line(line, sizeof(line), stream);
115 /* skip the comment line if any */
116 if (!strncmp(line, "/*", 2))
117 - getline(line, sizeof(line), stream);
118 + get_line(line, sizeof(line), stream);
120 interpretXpm3ColorTableLine(line, seqNum, *chars_per_pixelP,
121 *colorsP, *ptabP, transparentP);
123 pixel ** const colorsP, int ** const ptabP) {
124 /*----------------------------------------------------------------------------
125 Read the header of the XPM file on stream 'stream'. Assume the
126 - getline() stream is presently positioned to the beginning of the
127 + get_line() stream is presently positioned to the beginning of the
128 file and it is a Version 1 XPM file. Leave the stream positioned
132 /* Read the initial defines. */
133 processedStaticChar = FALSE;
134 while (!processedStaticChar) {
135 - getline(line, sizeof(line), stream);
136 + get_line(line, sizeof(line), stream);
138 if (sscanf(line, "#define %s %d", str1, &v) == 2) {
141 /* If there's a monochrome color table, skip it. */
142 if (!strncmp(t1, "mono", 4)) {
144 - getline(line, sizeof(line), stream);
145 + get_line(line, sizeof(line), stream);
146 if (!strncmp(line, "static char", 11))
151 /* Read color table. */
152 for (i = 0; i < *ncolorsP; ++i) {
153 - getline(line, sizeof(line), stream);
154 + get_line(line, sizeof(line), stream);
156 if ((t1 = strchr(line, '"')) == NULL)
157 pm_error("D error scanning color table");
162 - getline(line, sizeof(line), stream);
163 + get_line(line, sizeof(line), stream);
164 if (strncmp(line, "static char", 11) == 0)
170 /* Read the header line */
171 - getline(line, sizeof(line), stream);
172 + get_line(line, sizeof(line), stream);
173 backup = TRUE; /* back up so next read reads this line again */
175 rc = sscanf(line, "/* %s */", str1);
177 pm_error("Could not get %d bytes of memory for image", totalpixels);
179 maxcursor = *dataP + totalpixels - 1;
180 - getline(line, sizeof(line), stream);
181 + get_line(line, sizeof(line), stream);
182 /* read next line (first line may not always start with comment) */
183 while (cursor <= maxcursor) {
184 if (strncmp(line, "/*", 2) == 0) {
186 ncolors, ptab, &cursor, maxcursor);
188 if (cursor <= maxcursor)
189 - getline(line, sizeof(line), stream);
190 + get_line(line, sizeof(line), stream);
192 if (ptab) free(ptab);
198 Colin Watson [cjwatson@ubuntu.com]