b64/input.c
Eric 848c3749d2 change function definitions
Buffers are no longer wired into any input or translation functions.
They are supplied as arguments through main.
2025-05-26 12:23:54 +02:00

29 lines
454 B
C

#include "input.h"
#define PADDING '='
int
getocts(FILE *fp, unsigned char *o, int olen)
{
int c, n;
n = 0;
while (n < olen-1 && (c = fgetc(fp)) != EOF)
o[n++] = c;
return n;
}
int
getsxts(FILE *fp, unsigned char *s, int slen)
{
int c, n, pad;
n = pad = 0;
while (n < slen-1 && (c = fgetc(fp)) != EOF && c != PADDING)
s[n++] = c;
while (n+pad < slen-1)
s[n+pad++] = PADDING;
return n;
}