3 #endif /* HAVE_CONFIG_H */
8 #include <atalk/compat.h>
10 #if !defined HAVE_DIRFD && defined SOLARIS
19 size_t strnlen(const char *s, size_t max)
23 for (len = 0; len < max; len++) {
32 #ifndef HAVE_VASPRINTF
33 int vasprintf(char **ret, const char *fmt, va_list ap)
38 if ((p = malloc(size)) == NULL)
42 /* Try to print in the allocated space. */
43 n = vsnprintf(p, size, fmt, ap);
44 /* If that worked, return the string. */
45 if (n > -1 && n < size) {
49 /* Else try again with more space. */
50 if (n > -1) /* glibc 2.1 */
51 size = n+1; /* precisely what is needed */
53 size *= 2; /* twice the old size */
54 if ((np = realloc (p, size)) == NULL) {
66 int asprintf(char **strp, const char *fmt, ...)
72 len = vasprintf(strp, fmt, ap);