summaryrefslogtreecommitdiffstats
path: root/lib/age.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/age.c (renamed from libmisc/age.c)17
1 files changed, 10 insertions, 7 deletions
diff --git a/libmisc/age.c b/lib/age.c
index d10f71b..72a13ea 100644
--- a/libmisc/age.c
+++ b/lib/age.c
@@ -13,12 +13,15 @@
#include <stdio.h>
#include <time.h>
#include <errno.h>
-#include "prototypes.h"
-#include "defines.h"
-#include "exitcodes.h"
#include <pwd.h>
#include <grp.h>
+#include "adds.h"
+#include "defines.h"
+#include "exitcodes.h"
+#include "prototypes.h"
+
+
#ident "$Id$"
#ifndef PASSWD_PROGRAM
@@ -112,7 +115,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
_exit (126);
}
- (void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) 0);
+ (void) execl (PASSWD_PROGRAM, PASSWD_PROGRAM, pw->pw_name, (char *) NULL);
err = errno;
perror ("Can't execute " PASSWD_PROGRAM);
_exit ((ENOENT == err) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
@@ -139,7 +142,7 @@ int expire (const struct passwd *pw, /*@null@*/const struct spwd *sp)
void agecheck (/*@null@*/const struct spwd *sp)
{
- long now = (long) time ((time_t *) 0) / SCALE;
+ long now = time(NULL) / DAY;
long remain;
if (NULL == sp) {
@@ -162,9 +165,9 @@ void agecheck (/*@null@*/const struct spwd *sp)
return;
}
- remain = sp->sp_lstchg + sp->sp_max - now;
+ remain = addsl(sp->sp_lstchg, sp->sp_max, -now);
+
if (remain <= sp->sp_warn) {
- remain /= DAY / SCALE;
if (remain > 1) {
(void) printf (_("Your password will expire in %ld days.\n"),
remain);