/* Define to number of the `exec' system call. */
#undef EXEC_SYSCALL
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
+/* Define to 1 if you have the `stpcpy' function. */
+#undef HAVE_STPCPY
+
+/* Define to 1 if you have the `stpncpy' function. */
+#undef HAVE_STPNCPY
+
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
#include <errno.h>
#include <unistd.h>
-#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <string.h>
\f
+
+/* Define replacements for required string functions. */
+
+#ifndef HAVE_STPCPY
+
+/* Copy SRC to DEST, returning the address of the terminating '\0' in
+ DEST. */
+
+static char *
+rpl_stpcpy (char *dest, const char *src)
+{
+ register char *d;
+ register const char *s;
+
+ d = dest;
+ s = src;
+
+ do
+ *d++ = *s;
+ while (*s++ != '\0');
+
+ return d - 1;
+}
+
+#define stpcpy rpl_stpcpy
+#endif /* !HAVE_STPCPY */
+
+#ifndef HAVE_STPNCPY
+
+/* Copy no more than N bytes of SRC to DST, returning a pointer past
+ the last non-NUL byte written into DST. */
+
+char *
+rpl_stpncpy (char *dest, const char *src, size_t n)
+{
+ char c, *s;
+ size_t n4;
+
+ s = dest;
+
+ if (n >= 4)
+ {
+ n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ c = *src++;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n -= dest - s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return dest;
+
+ for (;;)
+ {
+ c = *src++;
+ --n;
+ *dest++ = c;
+ if (c == '\0')
+ break;
+ if (n == 0)
+ return dest;
+ }
+
+ zero_fill:
+ while (n-- > 0)
+ dest[n] = '\0';
+
+ return dest - 1;
+}
+
+#define stpncpy rpl_stpncpy
+#endif /* !HAVE_STPNCPY */
+
+\f
+
/* Executable reading functions.
These functions extract information from an executable that is
about to be loaded.
break;
case 3: /* PT_INTERP */
- /* This describes another executable that must be loaded.
- Open the interpreter and process each of its headers
- as well. */
+ /* This describes another executable that must be loaded. Open
+ the interpreter and process each of its headers as well. */
rc = process_interpreter (fd, header, entry);
break;