incorporate logwtmp in here
authorPaul Mackerras <paulus@samba.org>
Tue, 24 May 1994 11:28:26 +0000 (11:28 +0000)
committerPaul Mackerras <paulus@samba.org>
Tue, 24 May 1994 11:28:26 +0000 (11:28 +0000)
pppd/sys-linux.c

index 42fadaa3dfad99b764295f86f26fbd2b479d2f9b..cbf05589ef37a1a2b2b26b4bbbf32f4851a21e7b 100644 (file)
@@ -25,6 +25,9 @@
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
+#include <time.h>
+#include <memory.h>
+#include <utmp.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -799,3 +802,19 @@ int ppp_available(void)
     
     return ok;
 }
+
+int
+logwtmp(line, name, host)
+       char *line, *name, *host;
+{
+    struct utmp ut;
+
+    memset (&ut, 0, sizeof (ut));
+    (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
+    (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
+    (void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
+    (void)time(&ut.ut_time);
+       
+    pututline (&ut);           /* Write the line to the proper place */
+    endutent();                        /* Indicate operation is complete */
+}