+ return TRUE;
+}
+\f
+/* Read the next character, return EOF if none available.
+ Assume that STREAM is positioned so that the next byte read
+ is at address ADDRESS in the file.
+
+ If STREAM is NULL, do not read from it.
+ The caller can supply a buffer of characters
+ to be processed before the data in STREAM.
+ MAGIC is the address of the buffer and
+ MAGICCOUNT is how many characters are in it. */
+
+static long
+get_char (FILE *stream, file_ptr *address, int *magiccount, char **magic)
+{
+ int c, i;
+ long r = 0;
+
+ for (i = 0; i < encoding_bytes; i++)
+ {
+ if (*magiccount)
+ {
+ (*magiccount)--;
+ c = *(*magic)++;
+ }
+ else
+ {
+ if (stream == NULL)
+ return EOF;
+
+ /* Only use getc_unlocked if we found a declaration for it.
+ Otherwise, libc is not thread safe by default, and we
+ should not use it. */
+
+#if defined(HAVE_GETC_UNLOCKED) && HAVE_DECL_GETC_UNLOCKED
+ c = getc_unlocked (stream);
+#else
+ c = getc (stream);
+#endif
+ if (c == EOF)
+ return EOF;
+ }
+
+ (*address)++;
+ r = (r << 8) | (c & 0xff);
+ }
+
+ switch (encoding)
+ {
+ default:
+ break;
+ case 'l':
+ r = ((r & 0xff) << 8) | ((r & 0xff00) >> 8);
+ break;
+ case 'L':
+ r = (((r & 0xff) << 24) | ((r & 0xff00) << 8)
+ | ((r & 0xff0000) >> 8) | ((r & 0xff000000) >> 24));
+ break;
+ }
+
+ return r;