defs.c (5cf4388bdf4c4e693f048a9d8563b298c16e8cb5) defs.c (b6217683dc0269a53b799399522dbdfb5a4919cc)
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: defs.c,v 1.11.4.4 1998/03/24 18:46:49 brian Exp $
26 * $Id: defs.c,v 1.11.4.5 1998/03/25 18:38:44 brian Exp $
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31
32#include <errno.h>
33#include <stdio.h>
34#include <stdlib.h>

--- 35 unchanged lines hidden (view full) ---

70 if (!initdone) {
71 initdone = 1;
72 srandomdev();
73 }
74#else
75 srandom(time(NULL)^getpid());
76#endif
77}
27 */
28
29#include <sys/param.h>
30#include <netinet/in.h>
31
32#include <errno.h>
33#include <stdio.h>
34#include <stdlib.h>

--- 35 unchanged lines hidden (view full) ---

70 if (!initdone) {
71 initdone = 1;
72 srandomdev();
73 }
74#else
75 srandom(time(NULL)^getpid());
76#endif
77}
78
79
80int
81GetShortHost()
82{
83 char *p;
84
85 if (gethostname(VarShortHost, sizeof VarShortHost)) {
86 LogPrintf(LogERROR, "GetShortHost: gethostname: %s\n", strerror(errno));
87 return 0;
88 }
89
90 if ((p = strchr(VarShortHost, '.')))
91 *p = '\0';
92
93 return 1;
94}