1*35456Sbostic /* 2*35456Sbostic * Copyright (c) 1988 The Regents of the University of California. 3*35456Sbostic * All rights reserved. 4*35456Sbostic * 5*35456Sbostic * Redistribution and use in source and binary forms are permitted 6*35456Sbostic * provided that the above copyright notice and this paragraph are 7*35456Sbostic * duplicated in all such forms and that any documentation, 8*35456Sbostic * advertising materials, and other materials related to such 9*35456Sbostic * distribution and use acknowledge that the software was developed 10*35456Sbostic * by the University of California, Berkeley. The name of the 11*35456Sbostic * University may not be used to endorse or promote products derived 12*35456Sbostic * from this software without specific prior written permission. 13*35456Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*35456Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*35456Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16*35456Sbostic */ 17*35456Sbostic 18*35456Sbostic #if defined(LIBC_SCCS) && !defined(lint) 19*35456Sbostic static char sccsid[] = "@(#)logwtmp.c 5.1 (Berkeley) 08/31/88"; 20*35456Sbostic #endif /* LIBC_SCCS and not lint */ 21*35456Sbostic 22*35456Sbostic #include <sys/types.h> 23*35456Sbostic #include <sys/file.h> 24*35456Sbostic #include <sys/time.h> 25*35456Sbostic #include <utmp.h> 26*35456Sbostic 27*35456Sbostic #define WTMPFILE "/usr/adm/wtmp" 28*35456Sbostic 29*35456Sbostic logwtmp(line) 30*35456Sbostic char *line; 31*35456Sbostic { 32*35456Sbostic struct utmp ut; 33*35456Sbostic int fd; 34*35456Sbostic time_t time(); 35*35456Sbostic char *strncpy(); 36*35456Sbostic 37*35456Sbostic if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0) 38*35456Sbostic return; 39*35456Sbostic bzero(ut.ut_name, sizeof(ut.ut_name)); 40*35456Sbostic bzero(ut.ut_host, sizeof(ut.ut_host)); 41*35456Sbostic (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line)); 42*35456Sbostic (void)time(&ut.ut_time); 43*35456Sbostic (void)write(fd, (char *)&ut, sizeof(struct utmp)); 44*35456Sbostic (void)close(fd); 45*35456Sbostic } 46