/*
- * Copyright (c) 1996 by Internet Software Consortium.
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
+
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <ctype.h>
#include <resolv.h>
#include <stdio.h>
-
-#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
-# include <stdlib.h>
-# include <string.h>
-#else
-# include "../conf/portability.h"
-#endif
+#include <stdlib.h>
+#include <string.h>
#define Assert(Cond) if (!(Cond)) abort()
*/
int
-b64_ntop(src, srclength, target, targsize)
- u_char const *src;
- size_t srclength;
- char *target;
- size_t targsize;
-{
+b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
size_t datalength = 0;
u_char input[3];
u_char output[4];
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
}
+libresolv_hidden_def (b64_ntop)
/* skips all whitespace anywhere.
converts characters, four at a time, starting at (or after)
*/
int
-b64_pton(src, target, targsize)
- char const *src;
- u_char *target;
- size_t targsize;
+b64_pton (char const *src, u_char *target, size_t targsize)
{
- size_t tarindex;
- int state, ch;
+ int tarindex, state, ch;
char *pos;
state = 0;
switch (state) {
case 0:
if (target) {
- if (tarindex >= targsize)
+ if ((size_t)tarindex >= targsize)
return (-1);
target[tarindex] = (pos - Base64) << 2;
}
break;
case 1:
if (target) {
- if (tarindex + 1 >= targsize)
+ if ((size_t)tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 4;
target[tarindex+1] = ((pos - Base64) & 0x0f)
break;
case 2:
if (target) {
- if (tarindex + 1 >= targsize)
+ if ((size_t)tarindex + 1 >= targsize)
return (-1);
target[tarindex] |= (pos - Base64) >> 2;
target[tarindex+1] = ((pos - Base64) & 0x03)
break;
case 3:
if (target) {
- if (tarindex >= targsize)
+ if ((size_t)tarindex >= targsize)
return (-1);
target[tarindex] |= (pos - Base64);
}
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
- for ( ; ch != '\0'; ch = *src++)
+ for ((void)NULL; ch != '\0'; ch = *src++)
if (!isspace(ch))
break;
/* Make sure there is another trailing = sign. */
* We know this char is an =. Is there anything but
* whitespace after it?
*/
- for ( ; ch != '\0'; ch = *src++)
+ for ((void)NULL; ch != '\0'; ch = *src++)
if (!isspace(ch))
return (-1);