2 * Implement some functions which are unknown to Solaris 10.
5 #include "compat_sun.h"
9 vasprintf(char **str, const char *format, va_list ap)
15 if ((result = vsnprintf(dummy, 2, format, ap)) < 0) {
19 if ((*str = malloc(result + 1)) == NULL)
21 if ((result = vsnprintf(*str, result + 1, format, ap)) < 0) {
29 asprintf(char **str, const char *format, ...)
35 result = vasprintf(str, format, ap);
42 #include <sys/types.h>
48 MD5File(const char *filename, char *buf)
50 unsigned char dbuf[8192];
55 if ((fd = open(filename, O_RDONLY)) < 0)
58 while ((count = read(fd, dbuf, sizeof(dbuf))) > 0)
59 MD5Update(&ctx, dbuf, count);
64 if ((buf = malloc(33)) == NULL)
67 for (count = 0; count < 16; count++)
68 sprintf(buf + count * 2, "%02x", dbuf[count]);
72 #endif /* ifndef NOMD5 */