]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pw_log.c
Split some extra long lines
[pw-darwin.git] / pw / pw_log.c
index e11e5ee1cc2bff933e9d2b2203f0b1fc6cf7ce3d..29038d903747803bc4481295f7ecd979bd131692 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id$";
+  "$FreeBSD$";
 #endif /* not lint */
 
 #include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
 
 #include "pw.h"
 
@@ -47,16 +49,15 @@ pw_log(struct userconf * cnf, int mode, int which, char const * fmt,...)
                }
                if (logfile != NULL) {
                        va_list         argp;
-                       int             l;
                        time_t          now = time(NULL);
                        struct tm      *t = localtime(&now);
                        char            nfmt[256];
-                       char           *name;
+                       const char     *name;
 
                        if ((name = getenv("LOGNAME")) == NULL && (name = getenv("USER")) == NULL)
                                name = "unknown";
-                       strftime(nfmt, sizeof nfmt, "%d-%b-%Y %R ", t);
-                       l = strlen(nfmt);
+                       /* ISO 8601 International Standard Date format */
+                       strftime(nfmt, sizeof nfmt, "%Y-%m-%d %T ", t);
                        sprintf(nfmt + strlen(nfmt), "[%s:%s%s] %s\n", name, Which[which], Modes[mode], fmt);
                        va_start(argp, fmt);
                        vfprintf(logfile, nfmt, argp);