LibreSSL portable uses base64.c. Not everyone has u_char, so this is a
mild portability annoyance. This means that we can get rid of
sys/types.h. I also removed stdio.h since that seems unused.

As far as I can see, base64.c directly needs

ctype.h for isspace()
resolv.h for the function prototypes
stdlib.h for size_t
string.h for strchr()

The remaining includes seem to be needed for resolv.h, although
sys/socket.h probably isn't needed either.

Index: net/base64.c
===================================================================
RCS file: /cvs/src/lib/libc/net/base64.c,v
retrieving revision 1.9
diff -u -p -r1.9 base64.c
--- net/base64.c        11 Oct 2021 14:32:26 -0000      1.9
+++ net/base64.c        21 Oct 2021 17:18:29 -0000
@@ -42,14 +42,12 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 
-#include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
 #include <ctype.h>
 #include <resolv.h>
-#include <stdio.h>
 
 #include <stdlib.h>
 #include <string.h>
@@ -123,14 +121,14 @@ static const char Pad64 = '=';
 
 int
 b64_ntop(src, srclength, target, targsize)
-       u_char const *src;
+       unsigned char const *src;
        size_t srclength;
        char *target;
        size_t targsize;
 {
        size_t datalength = 0;
-       u_char input[3];
-       u_char output[4];
+       unsigned char input[3];
+       unsigned char output[4];
        int i;
 
        while (2 < srclength) {
@@ -188,11 +186,11 @@ b64_ntop(src, srclength, target, targsiz
 int
 b64_pton(src, target, targsize)
        char const *src;
-       u_char *target;
+       unsigned char *target;
        size_t targsize;
 {
        int tarindex, state, ch;
-       u_char nextbyte;
+       unsigned char nextbyte;
        char *pos;
 
        state = 0;

Reply via email to