1/*
2 * $Id: includes.h,v 1.1.1.1 2008/10/15 03:30:39 james26_jang Exp $
3 *
4 * Copyright (C) 1997 Lars Fenneberg
5 *
6 * Copyright 1992 Livingston Enterprises, Inc.
7 *
8 * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
9 * and Merit Network, Inc. All Rights Reserved
10 *
11 * See the file COPYRIGHT for the respective terms and conditions.
12 * If the file is missing contact me at lf@elemental.net
13 * and I'll send you a copy.
14 *
15 */
16
17#include "config.h"
18
19#include <sys/types.h>
20
21#include <ctype.h>
22#include <stdio.h>
23#include <errno.h>
24#include <netdb.h>
25#include <syslog.h>
26
27#ifdef STDC_HEADERS
28# include <stdlib.h>
29# include <string.h>
30# include <stdarg.h>
31#else
32# include <stdarg.h>
33# ifndef HAVE_STRCHR
34#  define strchr index
35#  define strrchr rindex
36# endif
37#endif
38
39/* I realize that this is ugly and unsafe.. :( */
40#ifndef HAVE_SNPRINTF
41# define snprintf(buf, len, format, args...) sprintf(buf, format, ## args)
42#endif
43#ifndef HAVE_VSNPRINTF
44# define vsnprintf(buf, len, format, ap) vsprintf(buf, format, ap)
45#endif
46
47#ifdef HAVE_UNISTD_H
48# include <unistd.h>
49#endif /* HAVE_UNISTD_H */
50
51#ifdef HAVE_FCNTL_H
52# include <fcntl.h>
53#endif
54
55#ifdef HAVE_SYS_FCNTL_H
56# include <sys/fcntl.h>
57#endif
58
59#ifdef HAVE_SYS_FILE_H
60# include <sys/file.h>
61#endif
62
63#ifdef HAVE_SYS_STAT_H
64# include <sys/stat.h>
65#endif
66
67#ifdef HAVE_SYS_UTSNAME_H
68# include <sys/utsname.h>
69#endif
70
71#ifdef HAVE_SYS_IOCTL_H
72# include <sys/ioctl.h>
73#endif
74
75#ifdef HAVE_CRYPT_H
76# include <crypt.h>
77#endif
78
79#ifdef HAVE_LIMITS_H
80# include <limits.h>
81#endif
82
83#ifdef HAVE_TERMIOS_H
84# include <termios.h>
85#endif
86
87#ifndef PATH_MAX
88#define PATH_MAX        1024
89#endif
90
91#ifndef UCHAR_MAX
92# ifdef  __STDC__
93#  define UCHAR_MAX       255U
94# else
95#  define UCHAR_MAX       255
96# endif
97#endif
98
99#include <pwd.h>
100#include <sys/socket.h>
101#include <netinet/in.h>
102#include <arpa/inet.h>
103
104#if defined(HAVE_SIGNAL_H)
105# include <signal.h>
106#endif
107#if defined(HAVE_SYS_SIGNAL_H)
108# include <sys/signal.h>
109#endif
110
111#ifdef NEED_SIG_PROTOTYPES
112int sigemptyset(sigset_t *);
113int sigaddset(sigset_t *, int);
114int sigprocmask (int, sigset_t *, sigset_t *);
115#endif
116
117#if HAVE_GETOPT_H
118# include <getopt.h>
119#endif
120
121#if defined(HAVE_SHADOW_H) && defined(HAVE_SHADOW_PASSWORDS)
122# include <shadow.h>
123#endif
124
125#if TIME_WITH_SYS_TIME
126# include <sys/time.h>
127# include <time.h>
128#else
129# if HAVE_SYS_TIME_H
130#  include <sys/time.h>
131# else
132#  include <time.h>
133# endif
134#endif
135
136/*
137 * prefer srandom/random over srand/rand as there generator has a
138 * better distribution of the numbers on certain systems.
139 * on Linux both generators are identical.
140 */
141#ifndef HAVE_RANDOM
142# ifdef HAVE_RAND
143# define srandom        srand
144# define random         rand
145# endif
146#endif
147
148/* rlib/lock.c */
149int do_lock_exclusive(int);
150int do_unlock(int);
151