SCCS-vsn: usr.bin/vacation/vacation.c 3.8
# include "useful.h"
# include "userdbm.h"
# include "useful.h"
# include "userdbm.h"
-SCCSID(@(#)vacation.c 3.7 %G%);
+SCCSID(@(#)vacation.c 3.8 %G%);
/*
** VACATION -- return a message to the sender when on vacation.
/*
** VACATION -- return a message to the sender when on vacation.
# 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 */
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 == '-')
if (!knows(from))
{
/* mark this person as knowing */
if (!knows(from))
{
/* mark this person as knowing */
/* 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 */
}
setknows(user)
char *user;
{
setknows(user)
char *user;
{
DATUM k, d;
struct dbrec xrec;
DATUM k, d;
struct dbrec xrec;
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);
+}