static long mindays;
static long maxdays;
-static long lastday;
+static long lstchgdate;
static long warndays;
static long inactdays;
-static long expdays;
+static long expdate;
#define EPOCH "1969-12-31"
fputs (_("Usage: chage [options] [LOGIN]\n"
"\n"
"Options:\n"
- " -d, --lastday LAST_DAY set last password change to LAST_DAY\n"
+ " -d, --lastday LAST_DAY set date of last password change to LAST_DAY\n"
" -E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"
" -h, --help display this help message and exit\n"
" -I, --inactive INACTIVE set password inactive after expiration\n"
return 0;
}
- date_to_str (buf, sizeof buf, lastday * SCALE);
+ date_to_str (buf, sizeof buf, lstchgdate * SCALE);
change_field (buf, sizeof buf, _("Last Password Change (YYYY-MM-DD)"));
if (strcmp (buf, EPOCH) == 0) {
- lastday = -1;
+ lstchgdate = -1;
} else {
- lastday = strtoday (buf);
- if (lastday == -1) {
+ lstchgdate = strtoday (buf);
+ if (lstchgdate == -1) {
return 0;
}
}
return 0;
}
- date_to_str (buf, sizeof buf, expdays * SCALE);
+ date_to_str (buf, sizeof buf, expdate * SCALE);
change_field (buf, sizeof buf,
_("Account Expiration Date (YYYY-MM-DD)"));
if (strcmp (buf, EPOCH) == 0) {
- expdays = -1;
+ expdate = -1;
} else {
- expdays = strtoday (buf);
- if (expdays == -1) {
+ expdate = strtoday (buf);
+ if (expdate == -1) {
return 0;
}
}
* was last modified. The date is the number of days since 1/1/1970.
*/
(void) fputs (_("Last password change\t\t\t\t\t: "), stdout);
- if (lastday < 0) {
+ if (lstchgdate < 0) {
(void) puts (_("never"));
- } else if (lastday == 0) {
+ } else if (lstchgdate == 0) {
(void) puts (_("password must be changed"));
} else {
- changed = lastday * SCALE;
+ changed = lstchgdate * SCALE;
print_date ((time_t) changed);
}
* date plus the number of days the password is valid for.
*/
(void) fputs (_("Password expires\t\t\t\t\t: "), stdout);
- if (lastday == 0) {
+ if (lstchgdate == 0) {
(void) puts (_("password must be changed"));
- } else if ( (lastday < 0)
+ } else if ( (lstchgdate < 0)
|| (maxdays >= (10000 * (DAY / SCALE)))
|| (maxdays < 0)) {
(void) puts (_("never"));
* active will be disabled.
*/
(void) fputs (_("Password inactive\t\t\t\t\t: "), stdout);
- if (lastday == 0) {
+ if (lstchgdate == 0) {
(void) puts (_("password must be changed"));
- } else if ( (lastday < 0)
+ } else if ( (lstchgdate < 0)
|| (inactdays < 0)
|| (maxdays >= (10000 * (DAY / SCALE)))
|| (maxdays < 0)) {
* password expiring or not.
*/
(void) fputs (_("Account expires\t\t\t\t\t\t: "), stdout);
- if (expdays < 0) {
+ if (expdate < 0) {
(void) puts (_("never"));
} else {
- expires = expdays * SCALE;
+ expires = expdate * SCALE;
print_date ((time_t) expires);
}
case 'd':
dflg = true;
if (!isnum (optarg)) {
- lastday = strtoday (optarg);
- } else if ( (getlong (optarg, &lastday) == 0)
- || (lastday < -1)) {
+ lstchgdate = strtoday (optarg);
+ } else if ( (getlong (optarg, &lstchgdate) == 0)
+ || (lstchgdate < -1)) {
fprintf (stderr,
_("%s: invalid date '%s'\n"),
Prog, optarg);
case 'E':
Eflg = true;
if (!isnum (optarg)) {
- expdays = strtoday (optarg);
- } else if ( (getlong (optarg, &expdays) == 0)
- || (expdays < -1)) {
+ expdate = strtoday (optarg);
+ } else if ( (getlong (optarg, &expdate) == 0)
+ || (expdate < -1)) {
fprintf (stderr,
_("%s: invalid date '%s'\n"),
Prog, optarg);
*/
spwent.sp_max = maxdays;
spwent.sp_min = mindays;
- spwent.sp_lstchg = lastday;
+ spwent.sp_lstchg = lstchgdate;
spwent.sp_warn = warndays;
spwent.sp_inact = inactdays;
- spwent.sp_expire = expdays;
+ spwent.sp_expire = expdate;
if (spw_update (&spwent) == 0) {
fprintf (stderr,
mindays = sp->sp_min;
}
if (!dflg) {
- lastday = sp->sp_lstchg;
+ lstchgdate = sp->sp_lstchg;
}
if (!Wflg) {
warndays = sp->sp_warn;
inactdays = sp->sp_inact;
}
if (!Eflg) {
- expdays = sp->sp_expire;
+ expdate = sp->sp_expire;
}
} else {
/*
mindays = -1;
}
if (!dflg) {
- lastday = -1;
+ lstchgdate = -1;
}
if (!Wflg) {
warndays = -1;
inactdays = -1;
}
if (!Eflg) {
- expdays = -1;
+ expdate = -1;
}
}
}