include aculib in cleanup
[unix-history] / usr / src / usr.bin / vacation / vacation.c
index 29386a0..534c11e 100644 (file)
@@ -5,7 +5,7 @@
 # include "useful.h"
 # include "userdbm.h"
 
 # include "useful.h"
 # include "userdbm.h"
 
-SCCSID(@(#)vacation.c  3.7             %G%);
+SCCSID(@(#)vacation.c  3.9             %G%);
 
 /*
 **  VACATION -- return a message to the sender when on vacation.
 
 /*
 **  VACATION -- return a message to the sender when on vacation.
@@ -42,7 +42,7 @@ SCCSID(@(#)vacation.c 3.7             %G%);
 
 # define ONEWEEK       (60L*60L*24L*7L)
 
 
 # define ONEWEEK       (60L*60L*24L*7L)
 
-long   Timeout = ONEWEEK;      /* timeout between notices per user */
+time_t Timeout = ONEWEEK;      /* timeout between notices per user */
 
 struct dbrec
 {
 
 struct dbrec
 {
@@ -62,7 +62,7 @@ main(argc, argv)
        extern char *newstr();
        extern char *getfrom();
        extern bool knows();
        extern char *newstr();
        extern char *getfrom();
        extern bool knows();
-       extern long convtime();
+       extern time_t convtime();
 
        /* process arguments */
        while (--argc > 0 && (p = *++argv) != NULL && *p == '-')
 
        /* process arguments */
        while (--argc > 0 && (p = *++argv) != NULL && *p == '-')
@@ -111,10 +111,11 @@ main(argc, argv)
        if (!knows(from))
        {
                /* mark this person as knowing */
        if (!knows(from))
        {
                /* mark this person as knowing */
-               setknows(from, buf);
+               setknows(from);
 
                /* send the message back */
 
                /* send the message back */
-               (void) strcat(buf, ".msg");
+               (void) strcpy(buf, homedir);
+               (void) strcat(buf, "/.vacation.msg");
                sendmessage(buf, from, myname);
                /* never returns */
        }
                sendmessage(buf, from, myname);
                /* never returns */
        }
@@ -205,7 +206,6 @@ knows(user)
 setknows(user)
        char *user;
 {
 setknows(user)
        char *user;
 {
-       register int i;
        DATUM k, d;
        struct dbrec xrec;
 
        DATUM k, d;
        struct dbrec xrec;
 
@@ -246,7 +246,7 @@ sendmessage(msgf, user, myname)
                        syserr("No message to send");
        }
 
                        syserr("No message to send");
        }
 
-       execl("/usr/lib/sendmail", "sendmail", "-f", myname, "-n", user, NULL);
+       execl("/usr/lib/sendmail", "sendmail", "-f", myname, user, NULL);
        syserr("Cannot exec /usr/lib/sendmail");
 }
 \f/*
        syserr("Cannot exec /usr/lib/sendmail");
 }
 \f/*
@@ -327,3 +327,31 @@ syserr(f, p)
        fprintf(stderr, "\n");
        exit(EX_USAGE);
 }
        fprintf(stderr, "\n");
        exit(EX_USAGE);
 }
+\f/*
+**  NEWSTR -- copy a string
+**
+**     Parameters:
+**             s -- the string to copy.
+**
+**     Returns:
+**             A copy of the string.
+**
+**     Side Effects:
+**             none.
+*/
+
+char *
+newstr(s)
+       char *s;
+{
+       char *p;
+
+       p = malloc(strlen(s) + 1);
+       if (p == NULL)
+       {
+               syserr("newstr: cannot alloc memory");
+               exit(EX_OSERR);
+       }
+       strcpy(p, s);
+       return (p);
+}