Make the buffer 45 bytes exactly for uuencode(1)
This commit is contained in:
parent
b60882f206
commit
cb5733ea41
|
@ -44,14 +44,14 @@ static void
|
||||||
uuencode(FILE *fp, const char *name, const char *s)
|
uuencode(FILE *fp, const char *name, const char *s)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
unsigned char buf[80], *p;
|
unsigned char buf[45], *p;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
if (fstat(fileno(fp), &st) < 0)
|
if (fstat(fileno(fp), &st) < 0)
|
||||||
eprintf("fstat %s:", s);
|
eprintf("fstat %s:", s);
|
||||||
fprintf(stdout, "begin %o %s\n", st.st_mode & 0777, name);
|
fprintf(stdout, "begin %o %s\n", st.st_mode & 0777, name);
|
||||||
while ((n = fread(buf, 1, 45, fp))) {
|
while ((n = fread(buf, 1, sizeof(buf), fp))) {
|
||||||
ch = ' ' + (n & 0x3f);
|
ch = ' ' + (n & 0x3f);
|
||||||
putchar(ch == ' ' ? '`' : ch);
|
putchar(ch == ' ' ? '`' : ch);
|
||||||
for (p = buf; n > 0; n -= 3, p += 3) {
|
for (p = buf; n > 0; n -= 3, p += 3) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user