[go: up one dir, main page]

File: utmp_rd.h

package info (click to toggle)
acct 6.3.5-17
  • links: PTS
  • area: main
  • in suites: potato
  • size: 812 kB
  • ctags: 563
  • sloc: ansic: 5,690; sh: 556; cpp: 287; makefile: 175; perl: 18
file content (73 lines) | stat: -rw-r--r-- 1,616 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* utmp_rd.h
 *
 * protos & etc. for routines that read from utmp files */

#include "config.h"		/* for HAVE_UT_HOST */

#include "files.h"

#ifdef HAVE_UT_ADDR
# include <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>		/* for INET_NTOA */
#endif

/* This looks strange, but it's real ANSI C. */

extern struct utmp utmp_rd_never_used;

#define NAME_LEN ((int) sizeof (utmp_rd_never_used.ut_name))
#define TTY_LEN ((int) sizeof (utmp_rd_never_used.ut_line))

#ifdef HAVE_UT_HOST
#define HOST_LEN ((int) sizeof (utmp_rd_never_used.ut_host))
#endif

#ifdef HAVE_UT_ID
#define ID_LEN ((int) sizeof (utmp_rd_never_used.ut_id))
#endif

#if 0
#ifdef __linux__		/* Debian bug#1651 reported by */
#define NAME_LEN 9		/* Austin Donnelly <and1000@cam.ac.uk> */
#else
#define NAME_LEN 8		/* length for usernames */
#endif

#define TTY_LEN 8		/* length for ttys */
#endif

#define OLD_TIME_CHAR '|'
#define NEW_TIME_CHAR '{'
#define BOOT_TIME_CHAR '~'

#ifdef HAVE_UT_TYPE

#define RECORD_TYPE ut_type

#ifndef UTMAXTYPE
#define UTMAXTYPE 8		/* FIXME: is there a better way to do
				   this? */
#endif

#else

#define RECORD_TYPE ut_line[0]

#define NEW_TIME NEW_TIME_CHAR
#define OLD_TIME OLD_TIME_CHAR
#define BOOT_TIME BOOT_TIME_CHAR

#endif

void utmp_init PARAMS((int backwards));
void add_utmp_file PARAMS((char *name));
struct utmp *utmp_get_entry PARAMS((void));
void print_utmp_record PARAMS((struct utmp *rec, FILE *out));
void utmp_print_file_and_line PARAMS((FILE *out));

#ifdef HAVE_UT_TYPE
int fix_ut_type_field PARAMS((struct utmp *rec));
#endif

int bad_utmp_record PARAMS((struct utmp *rec));