dynamically allocate (instead of static) several macros
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 29 Oct 1993 11:39:04 +0000 (03:39 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 29 Oct 1993 11:39:04 +0000 (03:39 -0800)
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 8.15

usr/src/usr.sbin/sendmail/src/envelope.c

index 608e7a9..b404f2e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 8.15 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -324,8 +324,8 @@ void
 initsys(e)
        register ENVELOPE *e;
 {
 initsys(e)
        register ENVELOPE *e;
 {
-       static char cbuf[5];                    /* holds hop count */
-       static char pbuf[10];                   /* holds pid */
+       char cbuf[5];                           /* holds hop count */
+       char pbuf[10];                          /* holds pid */
 #ifdef TTYNAME
        static char ybuf[60];                   /* holds tty id */
        register char *p;
 #ifdef TTYNAME
        static char ybuf[60];                   /* holds tty id */
        register char *p;
@@ -359,11 +359,11 @@ initsys(e)
 
        /* process id */
        (void) sprintf(pbuf, "%d", getpid());
 
        /* process id */
        (void) sprintf(pbuf, "%d", getpid());
-       define('p', pbuf, e);
+       define('p', newstr(pbuf), e);
 
        /* hop count */
        (void) sprintf(cbuf, "%d", e->e_hopcount);
 
        /* hop count */
        (void) sprintf(cbuf, "%d", e->e_hopcount);
-       define('c', cbuf, e);
+       define('c', newstr(cbuf), e);
 
        /* time as integer, unix time, arpa time */
        settime(e);
 
        /* time as integer, unix time, arpa time */
        settime(e);
@@ -402,8 +402,8 @@ settime(e)
 {
        register char *p;
        auto time_t now;
 {
        register char *p;
        auto time_t now;
-       static char tbuf[20];                   /* holds "current" time */
-       static char dbuf[30];                   /* holds ctime(tbuf) */
+       char tbuf[20];                          /* holds "current" time */
+       char dbuf[30];                          /* holds ctime(tbuf) */
        register struct tm *tm;
        extern char *arpadate();
        extern struct tm *gmtime();
        register struct tm *tm;
        extern char *arpadate();
        extern struct tm *gmtime();
@@ -412,12 +412,12 @@ settime(e)
        tm = gmtime(&now);
        (void) sprintf(tbuf, "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
                        tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
        tm = gmtime(&now);
        (void) sprintf(tbuf, "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
                        tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
-       define('t', tbuf, e);
+       define('t', newstr(tbuf), e);
        (void) strcpy(dbuf, ctime(&now));
        p = strchr(dbuf, '\n');
        if (p != NULL)
                *p = '\0';
        (void) strcpy(dbuf, ctime(&now));
        p = strchr(dbuf, '\n');
        if (p != NULL)
                *p = '\0';
-       define('d', dbuf, e);
+       define('d', newstr(dbuf), e);
        p = arpadate(dbuf);
        p = newstr(p);
        if (macvalue('a', e) == NULL)
        p = arpadate(dbuf);
        p = newstr(p);
        if (macvalue('a', e) == NULL)