SCCS-vsn: usr.sbin/sendmail/src/util.c 3.23
SCCS-vsn: usr.sbin/sendmail/src/queue.c 3.30
# include <errno.h>
# ifndef QUEUE
# include <errno.h>
# ifndef QUEUE
-SCCSID(@(#)queue.c 3.29 %G% (no queueing));
+SCCSID(@(#)queue.c 3.30 %G% (no queueing));
-SCCSID(@(#)queue.c 3.29 %G%);
+SCCSID(@(#)queue.c 3.30 %G%);
/*
** QUEUEUP -- queue a message up for future transmission.
/*
** QUEUEUP -- queue a message up for future transmission.
{
register FILE *f;
char buf[MAXLINE];
{
register FILE *f;
char buf[MAXLINE];
+ register char *p;
+ register int i;
extern ADDRESS *sendto();
/*
extern ADDRESS *sendto();
/*
if (Verbose)
printf("\nRunning %s\n", cf);
if (Verbose)
printf("\nRunning %s\n", cf);
- while (fgets(buf, sizeof buf, f) != NULL)
+ p = buf;
+ while (fgets(p, sizeof buf - (p - buf), f) != NULL)
+ /*
+ ** Collect any continuation lines...
+ */
+
+ i = fgetc(f);
+ if (i != EOF)
+ ungetc(i, f);
+ if (i == ' ' || i == '\t')
+ {
+ p += strlen(p);
+ continue;
+ }
+ fixcrlf(p, TRUE);
# include "sendmail.h"
# include "conf.h"
# include "sendmail.h"
# include "conf.h"
-SCCSID(@(#)util.c 3.22 %G%);
+SCCSID(@(#)util.c 3.23 %G%);
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
\f/*
** PUTLINE -- put a line like fputs obeying SMTP conventions
**
\f/*
** PUTLINE -- put a line like fputs obeying SMTP conventions
**
+** This routine always guarantees outputing a newline (or CRLF,
+** as appropriate) at the end of the string.
+**
** Parameters:
** l -- line to put.
** fp -- file to put it onto.
** Parameters:
** l -- line to put.
** fp -- file to put it onto.
-# define SMTPLINELIM 120 /* maximum line length */
+# define SMTPLINELIM 990 /* maximum line length */
FILE *fp;
bool fullsmtp;
{
register char *p;
FILE *fp;
bool fullsmtp;
{
register char *p;
- fputs(l, fp);
- return;
- }
-
- /* find the end of the line */
- p = index(l, '\n');
- if (p == NULL)
- p = &l[strlen(l)];
+ /* find the end of the line */
+ p = index(l, '\n');
+ if (p == NULL)
+ p = &l[strlen(l)];
- /* check for line overflow */
- while (p - l > SMTPLINELIM)
- {
- register char *q = &l[SMTPLINELIM - 1];
- char svchar = *q;
+ /* check for line overflow */
+ while (fullsmtp && (p - l) > SMTPLINELIM)
+ {
+ register char *q = &l[SMTPLINELIM - 1];
+
+ svchar = *q;
+ *q = '\0';
+ fputs(l, fp);
+ fputs("!\r\n", fp);
+ *q = svchar;
+ l = q;
+ }
+ /* output last part */
+ svchar = *p;
+ *p = '\0';
- fputs("!\r\n", fp);
- *q = svchar;
- l = q;
- }
-
- /* output last part */
- *p = '\0';
- fputs(l, fp);
- fputs("\r\n", fp);
- *p = '\n';
+ if (fullsmtp)
+ fputc('\r', fp);
+ fputc('\n', fp);
+ *p = svchar;
+ l = p;
+ if (*l == '\n')
+ l++;
+ } while (l[0] != '\0');
}
\f/*
** XUNLINK -- unlink a file, doing logging as appropriate.
}
\f/*
** XUNLINK -- unlink a file, doing logging as appropriate.