replace localtime/printf combinations with calls to ctime
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:25:22 +0000 (23:25 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 25 Jun 1990 07:25:22 +0000 (23:25 -0800)
SCCS-vsn: usr.bin/login/login.c 5.58

usr/src/usr.bin/login/login.c

index 0c02566..f4d6a97 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)login.c    5.57 (Berkeley) %G%";
+static char sccsid[] = "@(#)login.c    5.58 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -65,10 +65,6 @@ struct       ltchars ltc = {
        CSUSP, CDSUSP, CRPRNT, CDISCARD, CWERASE, CLNEXT
 };
 
        CSUSP, CDSUSP, CRPRNT, CDISCARD, CWERASE, CLNEXT
 };
 
-char *months[] =
-       { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
-         "Sep", "Oct", "Nov", "Dec" };
-
 char *months[] =
        { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
          "Sep", "Oct", "Nov", "Dec" };
 char *months[] =
        { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
          "Sep", "Oct", "Nov", "Dec" };
@@ -82,7 +78,6 @@ main(argc, argv)
        struct timeval tp;
        struct tm *ttp;
        struct timeval tp;
        struct timeval tp;
        struct tm *ttp;
        struct timeval tp;
-       struct tm *ttp;
        struct group *gr;
        register int ch;
        register char *p;
        struct group *gr;
        register int ch;
        register char *p;
@@ -361,24 +356,18 @@ main(argc, argv)
                        sleepexit(1);
                }
                else if (pwd->pw_change - tp.tv_sec <
                        sleepexit(1);
                }
                else if (pwd->pw_change - tp.tv_sec <
-                   2 * DAYSPERWEEK * SECSPERDAY && !quietlog) {
-                       ttp = localtime(&pwd->pw_change);
-                       (void)printf("Warning: your password expires on %s %d, %d\n",
-                           months[ttp->tm_mon], ttp->tm_mday,
-                           TM_YEAR_BASE + ttp->tm_year);
-               }
+                   2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
+                       (void)printf("Warning: your password expires on %s",
+                           ctime(&pwd->pw_expire));
        if (pwd->pw_expire)
                if (tp.tv_sec >= pwd->pw_expire) {
                        (void)printf("Sorry -- your account has expired.\n");
                        sleepexit(1);
                }
                else if (pwd->pw_expire - tp.tv_sec <
        if (pwd->pw_expire)
                if (tp.tv_sec >= pwd->pw_expire) {
                        (void)printf("Sorry -- your account has expired.\n");
                        sleepexit(1);
                }
                else if (pwd->pw_expire - tp.tv_sec <
-                   2 * DAYSPERWEEK * SECSPERDAY && !quietlog) {
-                       ttp = localtime(&pwd->pw_expire);
-                       (void)printf("Warning: your account expires on %s %d, %d\n",
-                           months[ttp->tm_mon], ttp->tm_mday,
-                           TM_YEAR_BASE + ttp->tm_year);
-               }
+                   2 * DAYSPERWEEK * SECSPERDAY && !quietlog)
+                       (void)printf("Warning: your account expires on %s",
+                           ctime(&pwd->pw_expire));
 
        /* nothing else left to fail -- really log in */
        {
 
        /* nothing else left to fail -- really log in */
        {