esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
-AC_REVISION($Revision: 1.71 $)
+AC_REVISION($Revision: 1.72 $)
AC_INIT(resolv/herror.c)
AC_PREREQ(2.13)
PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
PROTO_R_OK="#define PROTO_R_OK pptr"
+PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
]
,
+AC_TRY_COMPILE(
+[
+#include <netdb.h>
+int getprotoent_r (struct protoent *, char *, size_t, struct protoent **);
+
+]
+,
+[return (0);]
+,
+[
+PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, size_t buflen, struct protoent **answerp"
+PROTO_R_BAD="#define PROTO_R_BAD ERANGE"
+PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
+PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS char *buf, size_t buflen"
+PROTO_R_OK="#define PROTO_R_OK 0"
+PROTO_R_SETANSWER="#define PROTO_R_SETANSWER 1"
+PROTO_R_RETURN="#define PROTO_R_RETURN int"
+]
+,
+)
)
,
PROTO_R_ARGS="#define PROTO_R_ARGS char *buf, int buflen"
PROTO_R_COPY="#define PROTO_R_COPY buf, buflen"
PROTO_R_COPY_ARGS="#define PROTO_R_COPY_ARGS PROTO_R_ARGS"
PROTO_R_OK="#define PROTO_R_OK pptr"
+PROTO_R_SETANSWER="#undef PROTO_R_SETANSWER"
PROTO_R_RETURN="#define PROTO_R_RETURN struct protoent *"
)
AC_SUBST(PROTO_R_ARGS)
AC_SUBST(PROTO_R_COPY)
AC_SUBST(PROTO_R_COPY_ARGS)
AC_SUBST(PROTO_R_OK)
+AC_SUBST(PROTO_R_SETANSWER)
AC_SUBST(PROTO_R_RETURN)
AC_CHECK_FUNC(endprotoent_r,
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
- * $Id: netdb.h,v 1.8 2001/07/16 08:05:19 marka Exp $
+ * $Id: netdb.h,v 1.9 2001/07/16 08:37:44 marka Exp $
*/
#ifndef _NETDB_H_
void setnetent_r __P((int));
void endnetent_r __P((void));
+#ifdef __GLIBC__
+int getprotobyname_r __P((const char *, struct protoent *, char *,
+ size_t, struct protoent **));
+int getprotobynumber_r __P((int, struct protoent *, char *, size_t,
+ struct protoent **));
+int getprotoent_r __P((struct protoent *, char *, size_t, struct protoent **));
+#else
struct protoent *getprotobyname_r __P((const char *,
struct protoent *, char *, int));
struct protoent *getprotobynumber_r __P((int,
struct protoent *, char *, int));
struct protoent *getprotoent_r __P((struct protoent *, char *, int));
+#endif
void setprotoent_r __P((int));
void endprotoent_r __P((void));
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: getprotoent_r.c,v 1.2 2001/07/15 23:29:46 marka Exp $";
+static const char rcsid[] = "$Id: getprotoent_r.c,v 1.3 2001/07/16 08:37:45 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include <port_before.h>
PROTO_R_RETURN
getprotobyname_r(const char *name, struct protoent *pptr, PROTO_R_ARGS) {
struct protoent *pe = getprotobyname(name);
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
if (pe == NULL)
return (PROTO_R_BAD);
return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
}
PROTO_R_RETURN
getprotobynumber_r(int proto, struct protoent *pptr, PROTO_R_ARGS) {
struct protoent *pe = getprotobynumber(proto);
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
if (pe == NULL)
return (PROTO_R_BAD);
return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
}
/*
PROTO_R_RETURN
getprotoent_r(struct protoent *pptr, PROTO_R_ARGS) {
struct protoent *pe = getprotoent();
+#ifdef PROTO_R_SETANSWER
+ int n = 0;
+ if (pe == NULL || (n = copy_protoent(pe, pptr, PROTO_R_COPY)) != 0)
+ *answerp = NULL;
+ else
+ *answerp = pptr;
+
+ return (n);
+#else
if (pe == NULL)
return (PROTO_R_BAD);
return (copy_protoent(pe, pptr, PROTO_R_COPY));
+#endif
}
PROTO_R_SET_RETURN
len += strlen(pe->p_name) + 1;
len += numptr * sizeof(char*);
- if (len > buflen) {
+ if (len > (int)buflen) {
errno = ERANGE;
return (PROTO_R_BAD);
}
@PROTO_R_END_RETURN@
@PROTO_R_ENT_ARGS@
@PROTO_R_OK@
+@PROTO_R_SETANSWER@
@PROTO_R_RETURN@
@PROTO_R_SET_RESULT@
@PROTO_R_SET_RETURN@