Buffers are no longer wired into any input or translation functions. They are supplied as arguments through main.
29 lines
454 B
C
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;
|
|
}
|