The functions encode and decode are now capable of processing larger buffers with less conditional logic. Input and output functions need to follow suit to make better use of this next. Encode without line wrapping already makes use of these improvements, because input and output are now entirely handled by <stdio.h> functions.
19 lines
331 B
C
19 lines
331 B
C
#include "input.h"
|
|
|
|
#define PADDING '='
|
|
#define SXTETBUF 4
|
|
|
|
int
|
|
getsxts(FILE *fp, unsigned char *s)
|
|
{
|
|
int c, n, pad;
|
|
|
|
n = pad = 0;
|
|
while (n < SXTETBUF && (c = fgetc(fp)) != EOF && c != PADDING)
|
|
if (c != '\n')
|
|
s[n++] = c;
|
|
while (n+pad < SXTETBUF)
|
|
s[n+pad++] = PADDING;
|
|
|
|
return n;
|
|
}
|