ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/logging.C
(Generate patch)

Comparing rxvt-unicode/src/logging.C (file contents):
Revision 1.36 by root, Sun Jan 22 00:48:13 2006 UTC vs.
Revision 1.41 by root, Wed Jan 25 11:16:09 2006 UTC

1// This file is part of libptytty. Do not make local modifications.
2// http://software.schmorp.de/pkg/libptytty
3
1/*--------------------------------*-C-*---------------------------------* 4/*----------------------------------------------------------------------*
2 * File: logging.C 5 * File: logging.C
3 *----------------------------------------------------------------------* 6 *----------------------------------------------------------------------*
4 * 7 *
5 * All portions of code are copyright by their respective author/s. 8 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey <jdb@ukc.ac.uk> 9 * Copyright (c) 1992 John Bovey <jdb@ukc.ac.uk>
13 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 16 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
14 * - extensive modifications 17 * - extensive modifications
15 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> 18 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com>
16 * - lastlog support 19 * - lastlog support
17 * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> 20 * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com>
21 * Copyright (c) 2006 Emanuele Giaquinta <e.giaquinta@glauco.it>
18 * 22 *
19 * This program is free software; you can redistribute it and/or modify 23 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by 24 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or 25 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version. 26 * (at your option) any later version.
35 39
36#include "ptytty.h" 40#include "ptytty.h"
37 41
38#if UTMP_SUPPORT 42#if UTMP_SUPPORT
39 43
44#include <cstdio>
45
46#include <sys/types.h>
47#include <sys/stat.h>
48#include <sys/fcntl.h>
49#include <unistd.h>
50#include <time.h>
51
40#if HAVE_STRUCT_UTMP 52#if HAVE_STRUCT_UTMP
41static int write_bsd_utmp (int utmp_pos, struct utmp *wu); 53static int write_bsd_utmp (int utmp_pos, struct utmp *wu);
42static void update_wtmp (const char *fname, const struct utmp *putmp); 54static void update_wtmp (const char *fname, const struct utmp *putmp);
43#endif 55#endif
44 56
84 strncpy (ut_id, pty + 3, sizeof (ut_id)); 96 strncpy (ut_id, pty + 3, sizeof (ut_id));
85 else if (sscanf (pty, "pts/%d", &i) == 1) 97 else if (sscanf (pty, "pts/%d", &i) == 1)
86 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ 98 sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
87 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3)) 99 else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3))
88 { 100 {
89 warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty); 101 ptytty_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
90 return; 102 return;
91 } 103 }
92#endif 104#endif
93 105
94#ifdef HAVE_STRUCT_UTMP 106#ifdef HAVE_STRUCT_UTMP
414 426
415# ifdef HAVE_STRUCT_LASTLOG 427# ifdef HAVE_STRUCT_LASTLOG
416 pwent = getpwuid (getuid ()); 428 pwent = getpwuid (getuid ());
417 if (!pwent) 429 if (!pwent)
418 { 430 {
419 warn ("no entry in password file, not updating lastlog.\n"); 431 ptytty_warn ("no entry in password file, not updating lastlog.\n", 0);
420 return; 432 return;
421 } 433 }
422 434
423 memset (&ll, 0, sizeof (ll)); 435 memset (&ll, 0, sizeof (ll));
424 ll.ll_time = time (NULL); 436 ll.ll_time = time (NULL);
445 } 457 }
446# endif /* LASTLOG_IS_DIR */ 458# endif /* LASTLOG_IS_DIR */
447# endif /* HAVE_STRUCT_LASTLOG */ 459# endif /* HAVE_STRUCT_LASTLOG */
448} 460}
449#endif /* LASTLOG_SUPPORT */ 461#endif /* LASTLOG_SUPPORT */
450/* ------------------------------------------------------------------------- */
451 462
452#else 463#else
453
454void 464void
455ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname) 465ptytty_unix::login (int cmd_pid, bool login_shell, const char *hostname)
456{ 466{
457} 467}
458
459#endif 468#endif
460 469

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines