first commit
This commit is contained in:
commit
9b1fe95a8e
7 changed files with 234 additions and 0 deletions
37
input.c
Normal file
37
input.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
#include "input.h"
|
||||
|
||||
#define OBUFSIZE 4
|
||||
#define SBUFSIZE 5
|
||||
|
||||
#define PADDING '='
|
||||
|
||||
unsigned char o[OBUFSIZE];
|
||||
unsigned char s[SBUFSIZE];
|
||||
|
||||
unsigned char *
|
||||
getocts(FILE *fp, int *np)
|
||||
{
|
||||
int n, c;
|
||||
|
||||
n = 0;
|
||||
while (n < OBUFSIZE-1 && (c = fgetc(fp)) != EOF)
|
||||
o[n++] = c;
|
||||
*np = n;
|
||||
|
||||
return (*np) ? o : NULL;
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
getsxts(FILE *fp, int *np)
|
||||
{
|
||||
int n, p, c;
|
||||
|
||||
n = p = 0;
|
||||
while (n < SBUFSIZE-1 && (c = fgetc(fp)) != EOF && c != PADDING)
|
||||
s[n++] = c;
|
||||
while (n+p < SBUFSIZE-1)
|
||||
s[n+p++] = PADDING;
|
||||
*np = n;
|
||||
|
||||
return (n) ? s : NULL;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue