1 Index: arpwatch/Makefile.in
2 diff -u arpwatch/Makefile.in:1.1.1.1 arpwatch/Makefile.in:1.1.1.1.30.1
3 --- arpwatch/Makefile.in:1.1.1.1 Tue Apr 17 13:31:36 2001
4 +++ arpwatch/Makefile.in Thu Aug 12 15:10:44 2004
7 $(CC) $(CFLAGS) -c $(srcdir)/$*.c
9 -CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c
10 +CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c localhost.c setsignal.c
15 OBJ = $(WSRC:.c=.o) $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
16 WOBJ = $(WSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
17 SOBJ = $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
18 -HDR = arpwatch.h db.h dns.h ec.h file.h machdep.h report.h setsignal.h
19 +HDR = arpwatch.h db.h dns.h ec.h file.h machdep.h report.h localhost.h setsignal.h
22 /usr/include/net/if.h \
23 Index: arpwatch/localhost.c
24 diff -u /dev/null arpwatch/localhost.c:1.1.2.1
25 --- /dev/null Sat Aug 14 03:19:35 2004
26 +++ arpwatch/localhost.c Fri Aug 13 01:51:30 2004
28 +/* A slightly more convenient wrapper for gethostname
30 + Copyright (C) 1996 Free Software Foundation, Inc.
32 + Written by Miles Bader <miles@gnu.ai.mit.edu>
34 + This program is free software; you can redistribute it and/or
35 + modify it under the terms of the GNU General Public License as
36 + published by the Free Software Foundation; either version 2, or (at
37 + your option) any later version.
39 + This program is distributed in the hope that it will be useful, but
40 + WITHOUT ANY WARRANTY; without even the implied warranty of
41 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 + General Public License for more details.
44 + You should have received a copy of the GNU General Public License
45 + along with this program; if not, write to the Free Software
46 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
58 +#include "localhost.h"
59 +/* Return the name of the localhost. This is just a wrapper for gethostname,
60 + which takes care of allocating a big enough buffer, and caches the result
61 + after the first call (so the result should be copied before modification).
62 + If something goes wrong, 0 is returned, and errno set. */
66 + static char *buf = 0;
67 + static size_t buf_len = 0;
75 + buf = realloc (buf, buf_len);
77 + buf_len = 128; /* Initial guess */
78 + buf = malloc (buf_len);
85 + (myerror = gethostname(buf, buf_len)) == 0
86 + && !memchr (buf, '\0', buf_len))
87 + || errno == ENAMETOOLONG
91 + /* gethostname failed, abort. */
93 + buf = "(unknown host)";
98 Index: arpwatch/localhost.h
99 diff -u /dev/null arpwatch/localhost.h:1.1.2.1
100 --- /dev/null Sat Aug 14 03:19:35 2004
101 +++ arpwatch/localhost.h Fri Aug 13 01:51:30 2004
103 +char * localhost(void);
104 Index: arpwatch/report.c
105 diff -u arpwatch/report.c:1.1.1.1 arpwatch/report.c:1.1.1.1.30.2
106 --- arpwatch/report.c:1.1.1.1 Tue Apr 17 13:31:37 2001
107 +++ arpwatch/report.c Fri Aug 13 01:49:30 2004
110 #include "setsignal.h"
112 +#include "localhost.h"
114 #define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
117 syslog(LOG_ERR, "unlink(%s): %m", tempfile);
120 - (void)fprintf(f, "From: %s\n", watchee);
121 + (void)fprintf(f, "From: arpwatch (Arpwatch %s)\n", localhost());
122 (void)fprintf(f, "To: %s\n", watcher);