Back to index

glibc  2.9
getutmp.c
Go to the documentation of this file.
00001 /* Copyright (C) 1999 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <string.h>
00020 #include <utmp.h>
00021 #include <utmpx.h>
00022 
00023 /* Copy the information in UTMPX to UTMP. */
00024 void
00025 getutmp (const struct utmpx *utmpx, struct utmp *utmp)
00026 {
00027 #if _HAVE_UT_TYPE - 0
00028   utmp->ut_type = utmpx->ut_type;
00029 #endif
00030 #if _HAVE_UT_PID - 0
00031   utmp->ut_pid = utmpx->ut_pid;
00032 #endif
00033   memcpy (utmp->ut_line, utmpx->ut_line, sizeof (utmp->ut_line));
00034   memcpy (utmp->ut_user, utmpx->ut_user, sizeof (utmp->ut_user));
00035 #if _HAVE_UT_ID - 0
00036   memcpy (utmp->ut_id, utmpx->ut_id, sizeof (utmp->ut_id));
00037 #endif
00038 #if _HAVE_UT_HOST - 0
00039   memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
00040 #endif
00041 #if _HAVE_UT_TV - 0
00042   utmp->ut_tv = utmpx->ut_tv;
00043 #else
00044   utmp->ut_time = utmpx->ut_time;
00045 #endif
00046 }