projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do chmod last in install
[unix-history]
/
usr
/
src
/
usr.bin
/
vacation
/
vacation.c
diff --git
a/usr/src/usr.bin/vacation/vacation.c
b/usr/src/usr.bin/vacation/vacation.c
index
cc495d6
..
76faa3c
100644
(file)
--- a/
usr/src/usr.bin/vacation/vacation.c
+++ b/
usr/src/usr.bin/vacation/vacation.c
@@
-1,10
+1,11
@@
# include <pwd.h>
# include <stdio.h>
# include <sysexits.h>
# include <pwd.h>
# include <stdio.h>
# include <sysexits.h>
+# include <ctype.h>
# include "useful.h"
# include "userdbm.h"
# include "useful.h"
# include "userdbm.h"
-
static char SccsId[] = "@(#)vacation.c 3.2 %G%"
;
+
SCCSID(@(#)vacation.c 3.5 %G%)
;
/*
** VACATION -- return a message to the sender when on vacation.
/*
** VACATION -- return a message to the sender when on vacation.
@@
-32,6
+33,10
@@
static char SccsId[] = "@(#)vacation.c 3.2 %G%";
# define MAXLINE 256 /* max size of a line */
# define MAXNAME 128 /* max size of one name */
# define MAXLINE 256 /* max size of a line */
# define MAXNAME 128 /* max size of one name */
+# define ONEWEEK (60L*60L*24L*7L)
+
+long Timeout = ONEWEEK; /* timeout between notices per user */
+
struct dbrec
{
long sentdate;
struct dbrec
{
long sentdate;
@@
-49,6
+54,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();
/* process arguments */
while (--argc > 0 && (p = *++argv) != NULL && *p == '-')
/* process arguments */
while (--argc > 0 && (p = *++argv) != NULL && *p == '-')
@@
-69,6
+75,10
@@
main(argc, argv)
syserr("Cannot create %s", buf);
exit(EX_OK);
syserr("Cannot create %s", buf);
exit(EX_OK);
+ case 't': /* set timeout */
+ Timeout = convtime(++p);
+ break;
+
default:
usrerr("Unknown flag -%s", p);
exit(EX_USAGE);
default:
usrerr("Unknown flag -%s", p);
exit(EX_USAGE);
@@
-164,8
+174,6
@@
getfrom()
** none.
*/
** none.
*/
-# define ONEWEEK (60L*60L*24L*7L)
-
bool
knows(user)
char *user;
bool
knows(user)
char *user;
@@
-177,7
+185,7
@@
knows(user)
k.dptr = user;
k.dsize = strlen(user) + 1;
d = fetch(k);
k.dptr = user;
k.dsize = strlen(user) + 1;
d = fetch(k);
- if (d.dptr == NULL || ((struct dbrec *) d.dptr)->sentdate +
ONEWEEK
< now)
+ if (d.dptr == NULL || ((struct dbrec *) d.dptr)->sentdate +
Timeout
< now)
return (FALSE);
return (TRUE);
}
return (FALSE);
return (TRUE);
}