Codebase list mtr / da106ae
Import Upstream version 0.41 Samuel Henrique 5 years ago
26 changed file(s) with 1841 addition(s) and 516 deletion(s). Raw diff Collapse all Expand all
99 Thanks to everyone who has provided feedback on mtr.
1010
1111 Thanks especially to those of you who have sent code:
12 (Reverse alphabetical order)
1213
13 Brian Casey, Mircea Damian, Christophe Kalt, Simon Kirby,
14 Anand Kumria, Bertrand Leconte, Charles Levert, Alexander
15 V. Lukyanov, Russell Nelson, Aaron Scarisbrick, Andrew
16 Stesin, Juha Takala.
14 Juha Takala,
15 David Sward (sward@clark.net),
16 Andrew Stesin,
17 Aaron Scarisbrick,
18 Craig Milo Rogers (Rogers@ISI.EDU),
19 Russell Nelson (rn-mtr@crynwr.com),
20 Davin Milun (milun@acm.org),
21 Alexander V. Lukyanov (lav@yars.free.net),
22 Charles Levert (charles@comm.polymtl.ca),
23 Bertrand Leconte (B.Leconte@mail.dotcom.fr),
24 Anand Kumria,
25 Olav Kvittem (Olav.Kvittem@uninett.no),
26 Adam Kramer (l3zqc@qcunix1.acc.qc.edu),
27 Philip Kizer (pckizer@nostrum.com),
28 Simon Kirby,
29 Christophe Kalt,
30 Steve Kann (stevek@spheara.horizonlive.com),
31 Mircea Damian,
32 Brian Casey,
33 Bill Bogstad (bogstad@pobox.com),
34 Moritz Barsnick (barsnick@gmx.net)
35 Robert Sparks (rjsparks@nostrum.com)
36
1737 and anyone who has slipped through the cracks of my mail file.
38
39 Authors: If you want your Email mentioned here, send it to me.
40 If you don't want your Email mentioned here, tell me.
41
42 -- REW
0
1 #
2 # This is an attempt on simplifying the compilation of mtr to a simple "make".
3 #
4
5 firstrule:
6 ./configure
7 $(MAKE)
8
9 clean:
10 rm -f *.o *~ core
11
12 distclean: clean
13 rm -f mtr config.cache config.status config.log \
14 stamp-h stamp-h[0-9]* TAGS ID
15
2020 mtr_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ)
2121 mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ)
2222
23 EXTRA_DIST = SECURITY mtr.8
23 EXTRA_DIST = SECURITY mtr.8 Makefile Makefile.dist
24 distclean-local:
25 cp Makefile.dist Makefile
26 rm -f *.orig
2427
2528 DISTCLEANFILES = *~
2629
0
1 #
2 # This is an attempt on simplifying the compilation of mtr to a simple "make".
3 #
4
5 firstrule:
6 ./configure
7 $(MAKE)
8
9 clean:
10 rm -f *.o *~ core
11
12 distclean: clean
13 rm -f mtr config.cache config.status config.log \
14 stamp-h stamp-h[0-9]* TAGS ID
15
0 # Makefile.in generated automatically by automake 1.2 from Makefile.am
1
2 # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
0 # Makefile.in generated automatically by automake 1.3 from Makefile.am
1
2 # Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
33 # This Makefile.in is free software; the Free Software Foundation
4 # gives unlimited permission to copy, distribute and modify it.
4 # gives unlimited permission to copy and/or distribute it,
5 # with or without modifications, as long as this notice is preserved.
6
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
9 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10 # PARTICULAR PURPOSE.
511
612
713 SHELL = /bin/sh
2531 includedir = @includedir@
2632 oldincludedir = /usr/include
2733
34 DISTDIR =
35
2836 pkgdatadir = $(datadir)/@PACKAGE@
2937 pkglibdir = $(libdir)/@PACKAGE@
3038 pkgincludedir = $(includedir)/@PACKAGE@
4250 INSTALL_SCRIPT = @INSTALL_SCRIPT@
4351 transform = @program_transform_name@
4452
45 NORMAL_INSTALL = true
46 PRE_INSTALL = true
47 POST_INSTALL = true
48 NORMAL_UNINSTALL = true
49 PRE_UNINSTALL = true
50 POST_UNINSTALL = true
53 NORMAL_INSTALL = :
54 PRE_INSTALL = :
55 POST_INSTALL = :
56 NORMAL_UNINSTALL = :
57 PRE_UNINSTALL = :
58 POST_UNINSTALL = :
5159 CC = @CC@
5260 CURSES_OBJ = @CURSES_OBJ@
5361 GTK_CFLAGS = @GTK_CFLAGS@
7987 mtr_DEPENDENCIES = $(GTK_OBJ) $(CURSES_OBJ)
8088 mtr_LDFLAGS = $(GTK_OBJ) $(CURSES_OBJ)
8189
82 EXTRA_DIST = SECURITY mtr.8
90 EXTRA_DIST = SECURITY mtr.8 Makefile Makefile.dist
8391
8492 DISTCLEANFILES = *~
8593 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
99107 CFLAGS = @CFLAGS@
100108 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
101109 LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
102 MANS = mtr.8
110 man8dir = $(mandir)/man8
111 MANS = $(man_MANS)
103112
104113 NROFF = nroff
105114 DIST_COMMON = README AUTHORS COPYING INSTALL Makefile.am Makefile.in \
114123 SOURCES = $(mtr_SOURCES) $(EXTRA_mtr_SOURCES)
115124 OBJECTS = $(mtr_OBJECTS)
116125
117 default: all
126 all: all-recursive-am all-am
118127
119128 .SUFFIXES:
120 .SUFFIXES: .c .o
121 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
129 .SUFFIXES: .S .c .o .s
130 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
122131 cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile
123132
124 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
133 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
125134 cd $(top_builddir) \
126135 && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
127136
134143 cd $(srcdir) && $(AUTOCONF)
135144
136145 config.h: stamp-h
146 @:
137147 stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
138148 cd $(top_builddir) \
139149 && CONFIG_FILES= CONFIG_HEADERS=config.h \
149159 clean-hdr:
150160
151161 distclean-hdr:
152 rm -f config.h
162 -rm -f config.h
153163
154164 maintainer-clean-hdr:
155165
156166 mostlyclean-sbinPROGRAMS:
157167
158168 clean-sbinPROGRAMS:
159 test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
169 -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
160170
161171 distclean-sbinPROGRAMS:
162172
164174
165175 install-sbinPROGRAMS: $(sbin_PROGRAMS)
166176 @$(NORMAL_INSTALL)
167 $(mkinstalldirs) $(sbindir)
177 $(mkinstalldirs) $(DESTDIR)$(sbindir)
168178 @list='$(sbin_PROGRAMS)'; for p in $$list; do \
169179 if test -f $$p; then \
170 echo " $(INSTALL_PROGRAM) $$p $(sbindir)/`echo $$p|sed '$(transform)'`"; \
171 $(INSTALL_PROGRAM) $$p $(sbindir)/`echo $$p|sed '$(transform)'`; \
180 echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`"; \
181 $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
172182 else :; fi; \
173183 done
174184
175185 uninstall-sbinPROGRAMS:
176 $(NORMAL_UNINSTALL)
186 @$(NORMAL_UNINSTALL)
177187 list='$(sbin_PROGRAMS)'; for p in $$list; do \
178 rm -f $(sbindir)/`echo $$p|sed '$(transform)'`; \
188 rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed '$(transform)'`; \
179189 done
180190
181191 .c.o:
182192 $(COMPILE) -c $<
183193
194 .s.o:
195 $(COMPILE) -c $<
196
197 .S.o:
198 $(COMPILE) -c $<
199
184200 mostlyclean-compile:
185 rm -f *.o core
201 -rm -f *.o core *.core
186202
187203 clean-compile:
188204
189205 distclean-compile:
190 rm -f *.tab.c
206 -rm -f *.tab.c
191207
192208 maintainer-clean-compile:
193209
194210 mtr: $(mtr_OBJECTS) $(mtr_DEPENDENCIES)
195211 @rm -f mtr
196212 $(LINK) $(mtr_LDFLAGS) $(mtr_OBJECTS) $(mtr_LDADD) $(LIBS)
213
214 install-man8:
215 $(mkinstalldirs) $(DESTDIR)$(man8dir)
216 @list='$(man8_MANS)'; \
217 l2='$(man_MANS)'; for i in $$l2; do \
218 case "$$i" in \
219 *.8*) list="$$list $$i" ;; \
220 esac; \
221 done; \
222 for i in $$list; do \
223 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
224 else file=$$i; fi; \
225 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
226 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
227 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
228 echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \
229 $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \
230 done
231
232 uninstall-man8:
233 @list='$(man8_MANS)'; \
234 l2='$(man_MANS)'; for i in $$l2; do \
235 case "$$i" in \
236 *.8*) list="$$list $$i" ;; \
237 esac; \
238 done; \
239 for i in $$list; do \
240 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
241 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
242 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
243 echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \
244 rm -f $(DESTDIR)$(man8dir)/$$inst; \
245 done
197246 install-man: $(MANS)
198 $(NORMAL_INSTALL)
199 $(mkinstalldirs) $(mandir)/man8
200 @sect=8; \
201 inst=`echo "mtr" | sed '$(transform)'`.8; \
202 if test -f $(srcdir)/mtr.8; then file=$(srcdir)/mtr.8; \
203 else file=mtr.8; fi; \
204 echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \
205 $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst
206
247 @$(NORMAL_INSTALL)
248 $(MAKE) install-man8
207249 uninstall-man:
208 $(NORMAL_UNINSTALL)
209 inst=`echo "mtr" | sed '$(transform)'`.8; \
210 rm -f $(mandir)/man8/$$inst
211
250 @$(NORMAL_UNINSTALL)
251 $(MAKE) uninstall-man8
212252
213253 # This directory's subdirectories are mostly independent; you can cd
214254 # into them and run `make' without going through this Makefile.
223263 installdirs-recursive install-recursive uninstall-recursive \
224264 check-recursive installcheck-recursive info-recursive dvi-recursive:
225265 @set fnord $(MAKEFLAGS); amf=$$2; \
226 for subdir in $(SUBDIRS); do \
266 list='$(SUBDIRS)'; for subdir in $$list; do \
227267 target=`echo $@ | sed s/-recursive//`; \
228268 echo "Making $$target in $$subdir"; \
229269 (cd $$subdir && $(MAKE) $$target) \
233273 mostlyclean-recursive clean-recursive distclean-recursive \
234274 maintainer-clean-recursive:
235275 @set fnord $(MAKEFLAGS); amf=$$2; \
236 rev=''; for subdir in $(SUBDIRS); do rev="$$rev $$subdir"; done; \
276 rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
277 rev="$$subdir $$rev"; \
278 done; \
237279 for subdir in $$rev; do \
238280 target=`echo $@ | sed s/-recursive//`; \
239281 echo "Making $$target in $$subdir"; \
247289
248290 tags: TAGS
249291
250 ID: $(HEADERS) $(SOURCES)
251 here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
252
253 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES)
292 ID: $(HEADERS) $(SOURCES) $(LISP)
293 here=`pwd` && cd $(srcdir) \
294 && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
295
296 TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
254297 tags=; \
255298 here=`pwd`; \
256299 list='$(SUBDIRS)'; for subdir in $$list; do \
257300 test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
258301 done; \
259 test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \
260 || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS)
302 list='$(SOURCES) $(HEADERS)'; \
303 unique=`for i in $$list; do echo $$i; done | \
304 awk ' { files[$$0] = 1; } \
305 END { for (i in files) print i; }'`; \
306 test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
307 || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
261308
262309 mostlyclean-tags:
263310
264311 clean-tags:
265312
266313 distclean-tags:
267 rm -f TAGS ID
314 -rm -f TAGS ID
268315
269316 maintainer-clean-tags:
270317
275322 # it guarantees that the distribution is self-contained by making another
276323 # tarfile.
277324 distcheck: dist
278 rm -rf $(distdir)
325 -rm -rf $(distdir)
279326 GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
280327 mkdir $(distdir)/=build
281328 mkdir $(distdir)/=inst
288335 && $(MAKE) install \
289336 && $(MAKE) installcheck \
290337 && $(MAKE) dist
291 rm -rf $(distdir)
338 -rm -rf $(distdir)
292339 @echo "========================"; \
293340 echo "$(distdir).tar.gz is ready for distribution"; \
294341 echo "========================"
295342 dist: distdir
296343 -chmod -R a+r $(distdir)
297344 GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
298 rm -rf $(distdir)
345 -rm -rf $(distdir)
299346 dist-all: distdir
300347 -chmod -R a+r $(distdir)
301348 GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
302 rm -rf $(distdir)
349 -rm -rf $(distdir)
303350 distdir: $(DISTFILES)
304 rm -rf $(distdir)
351 -rm -rf $(distdir)
305352 mkdir $(distdir)
306353 -chmod 777 $(distdir)
307354 @for file in $(DISTFILES); do \
310357 || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
311358 || cp -p $$d/$$file $(distdir)/$$file; \
312359 done
313 for subdir in $(SUBDIRS); do \
314 test -d $(distdir)/$$subdir \
315 || mkdir $(distdir)/$$subdir \
316 || exit 1; \
317 chmod 777 $(distdir)/$$subdir; \
318 (cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
360 for subdir in $(SUBDIRS); do \
361 test -d $(distdir)/$$subdir \
362 || mkdir $(distdir)/$$subdir \
363 || exit 1; \
364 chmod 777 $(distdir)/$$subdir; \
365 (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
319366 || exit 1; \
320367 done
321368 info: info-recursive
345392
346393 uninstall: uninstall-recursive uninstall-am
347394
348 all: all-recursive-am all-am
349
350395 install-strip:
351396 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
352397 installdirs: installdirs-recursive
353 $(mkinstalldirs) $(sbindir) $(mandir)/man8
398 $(mkinstalldirs) $(DATADIR)$(sbindir) $(DESTDIR)$(mandir)/man8
354399
355400
356401 mostlyclean-generic:
357 test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
402 -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
358403
359404 clean-generic:
360 test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
405 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
361406
362407 distclean-generic:
363 rm -f Makefile $(DISTCLEANFILES)
364 rm -f config.cache config.log stamp-h stamp-h[0-9]*
365 test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
408 -rm -f Makefile $(DISTCLEANFILES)
409 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
410 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
366411
367412 maintainer-clean-generic:
368 test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
369 test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
413 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
414 -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
370415 mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \
371416 mostlyclean-compile mostlyclean-tags \
372417 mostlyclean-generic
385430
386431 clean: clean-recursive clean-am
387432
388 distclean: distclean-recursive distclean-am
389 rm -f config.status
433 distclean: distclean-recursive distclean-am distclean-local
434 -rm -f config.status
390435
391436 maintainer-clean: maintainer-clean-recursive maintainer-clean-am
392437 @echo "This command is intended for maintainers to use;"
393438 @echo "it deletes files that may require special tools to rebuild."
394 rm -f config.status
395
396 .PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \
397 maintainer-clean-hdr mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS \
398 clean-sbinPROGRAMS maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
439 -rm -f config.status
440
441 .PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
442 mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \
443 maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \
399444 install-sbinPROGRAMS mostlyclean-compile distclean-compile \
400 clean-compile maintainer-clean-compile install-man uninstall-man \
401 install-data-recursive uninstall-data-recursive install-exec-recursive \
445 clean-compile maintainer-clean-compile install-man8 uninstall-man8 \
446 install-man uninstall-man install-data-recursive \
447 uninstall-data-recursive install-exec-recursive \
402448 uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
403449 all-recursive check-recursive installcheck-recursive info-recursive \
404450 dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
411457
412458 install-exec-am:
413459 chmod u+s $(sbindir)/mtr
460 distclean-local:
461 cp Makefile.dist Makefile
462 rm -f *.orig
414463
415464 # Tell versions [3.59,3.63) of GNU make to not export all variables.
416465 # Otherwise a system limit (for SysV at least) may be exceeded.
00 WHAT'S NEW?
1
2 v0.41 Added afr's patch to allow disabeling of gtk without Robn's hack.
3 Made report mode report the newly added extra resolution.
4
5 v0.40 Fixed some problems with HPUX and SunOS.
6 Included Olav Kvittem's patch to do packetsize option.
7 Made the timekeeping in micro seconds.
8
9 v0.39 Forgot the parentheses around the previous fix... :-(
10
11 v0.38 fixed some dubious code in dns.c (noted by someone's lint)
12
13 v0.37 Added Bill Bogstad's "show the local host & time" patch.
14 Added R. Sparks' show-last-ping patch, submitted by Philip Kizer.
15
16 v0.36 Added Craigs change-the-interval-on-the-fly patch.
17 Added Moritz Barsnick's "do something sensible if host not found"
18 patch.
19 Some cleanup of both Craigs and Moritz' patches.
20
21 v0.35 Added Craig Milo Rogers pause/resume for GTK patch.
22 Added Craig Milo Rogers cleanup of "reset". (restart at the beginning)
23 Net_open used to send a first packet. After that the display-driver
24 got a chance to distort the timing by taking its time to
25 initialize.
26
27 v0.34 Added Matt's nifty "use the icmp unreachables to do the timing" patch.
28 Added Steve Kann's pause/resume patch.
29
30 v0.33 Fixed the Linux glibc resolver problems.
31 Fixed the off-by-one problem with -c option.
32
33 v0.32 Fixed the FreeBSD bug detection stuff.
34
35 v0.31 Fixed a few documentation issues. -- Matt
36 Changed the autoconf stuff to find the resolver library on
37 Solaris. -- REW
38 Cleaned up the autoconf.in file a bit. -- Matt.
39
40 v0.30 Fixed a typo in the changelog (NEWS) entry for 0.27. :-)
41 added use of "MTR_OPTIONS" environment variable for defaults.
42
43 v0.29 Lots of stuff.
44 Neato overview display by David Sward.
45 FreeBSD does wrong in the kernel the same that Solaris/x86 (see
46 note for 0.27 does right. It forces mtr to send bad packets....
47 Adjusted "not too much at once" algorithm. Now probing
48 continues as long as not more than 5 hosts are unknown.
49 Returning packets usually allow us to do the first sweep
50 in one go.
51
52
53 v0.28 DNS lookups are now suppressed if you don't want them.
154
255 v0.27
356 Fixed bug that showed up on Solaris/x86.
4 Gimp mainloop now runs as it's supposed to.
57 GTK mainloop now runs as it's supposed to.
558
659 v0.26
760 Added "-n" flag for numeric output.
00 WHAT IS MTR?
11
2 mtr combines the functionaly of the 'traceroute' and 'ping' programs
2 mtr combines the functionality of the 'traceroute' and 'ping' programs
33 in a single network diagnostic tool.
44
55 As mtr starts, it investigates the network connection between the host
1414
1515 INSTALLING
1616
17 To begin mtr, first use the included configure script:
17 Slightly more hints are in the file INSTALL. If this doesn't work
18 you could try reading that too....
19
20 To begin compiling mtr, first use the included configure script:
1821
1922 ./configure
2023
2932 Note that mtr must be suid-root because it requires access to raw IP
3033 sockets. See SECURITY for security information.
3134
35 If you want to build a version that doesn't use GTK, but if you
36 DO have GTK installed, you can use
37
38 ./configure --with-gtk-prefix=/we_dont_want_gtk_so_we_use_a_name_that_certainly_doesnt_exist
39
40 It seems the --no_gtk (whatever) doesn't work. Feel free to submit
41 a patch for this, I'm not that familiar with autoconf (it works for
42 me :-).
43
44
45
46
3247 WHERE CAN I GET THE LATEST VERSION OR MORE INFORMATION?
3348
3449 See the mtr web page at
4257
4358 Bug reports and feature requests should be sent to the mtr
4459 mailing list.
45
+78
-12
TODO less more
0
1 Hi everyone,
2
3 This is the "todo" file for mtr. I just realized that some people
4 might think that this is all in MY queue to implement. That is not
5 true: This is the "for everybody" todo list. Feel free to pick a
6 "project" and implement something off this list.
7
8 Students: Feel free to take up one of these as a programming exercise
9 for one of your courses.
10
11 Everybody: If you want to start on something, contact me first, so
12 that the effort isn't wasted by someone who finishes just a tad
13 earlier. I'll happily provide "coaching" to anyone who wants to
14 implement something on this list. That way we get the design of
15 these things the way I like them. This should result in a better
16 maintainable mtr.
17
18 Oh, Feel free to provide suggestions for this list.
19
20
21 -- REW
22
23 ----------------------------------------------------------------------
24
025
126 - Stuff to implement:
227
328 - Allow mtr to log the return packets, for later analysis.
4 Done: 0.25 . Todo: allow the userinterface(s) to work while
5 still logging to a file.
29 Done: 0.25 . Todo: allow the user interface(s) to work while
30 still logging to a file. Write a "logfile displaying" mode to
31 mtr.
632
733 - Request timestamping at the remote site.
834 Andreas Fasbender has an algorithm that will allow us to
935 convert these measurements into one-way measurements, not just
1036 round-trip.
37
38 - allow "keyboard navigation" in the GTK version.
39
40
41
42 - Bugs to fix?
43
44 - Do something useful if host couldn't be resolved.
45 -- Done.
46
47 - Revert to curses mode even if DISPLAY is set, but a problem
48 prevents us from running in X11 mode.
49 --> The problem is that gtk_init simply calls exit for us if
50 it finds a problem. Tricky! Suggestions welcome.
51 --> Call "gtk_check_init" when available. (i.e. new enough
52 (1.2?) GTK version).
53
54 - Nice to have:
55
56 - stop sending packets when a new host is getting entered.
57
58 - Show state ("looking up host") while doing the DNS lookup for a new
59 host.
60
61 - Read environment variable "MTR_DEFAULTS" as a commandline before
62 parsing the commandline. -- DONE. (ok it's MTR_OPTIONS.)
63
64 - Autoconf 2.13 has a neat function that can be used to find the
65 res_init function:
66
67 AC_SEARCH_LIBS(res_init, bind resolv, ,
68 AC_MSG_ERROR(No resolver library found))
69
70 At the moment (march 1999) autoconf 2.13 is still too new to require
71 everyone to upgrade. About a year from now we can put this in....
72
73 - Allow a toggle between hostname/IP number display. (for example a
74 click on the hostname could revert to ip number display in gtk version.
75 curses: "n" key toggles hostnames/ipnumbers?)
76
77 - Implement rfc2317 mechanism to do reverse lookups for networks that
78 have DNS delegations on non-octet boundaries. -- Daniel Bergstrom
79 (noa@melody.se)
80
81
82 ------------------------------------------------------------------------
83
84 Things that shouldn't be on the TODO list because they're done. ;-)
1185
1286 - Allow mtr to also send larger packets.
1387 This will enable us to get a feel for the speed of the links
1589 was slow, mtr will rock with this feature.... :-)
1690 (Anybody have the statistics experience to tell me how
1791 to do the data analysis?)
18
19 - Allow MTR to keep on getting the icmp host unreachables, and
20 work through that. Some hosts don't answer PINGs.
21 - Auto-switch to that strategy if "host is known, but 10/10
22 pings got lost"
92 -- DONE. Thanks to Olav Kvittem ...
2393
2494 - The "don't probe all hosts at once" strategy can be improved a bit.
2595 It should not probe more than 10 unknown hosts, but the counter need
2696 not be reset at the start of the "round". This way if you probe
2797 slowly (relative to the RTT time to the end host), it can probe
2898 all hosts in the first "round".
29
30
31 - Bugs to fix?
32 - ?
33
99 -- DONE.
0 dnl aclocal.m4 generated automatically by aclocal 1.2
0 dnl aclocal.m4 generated automatically by aclocal 1.3
1
2 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
3 dnl This Makefile.in is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl This program is distributed in the hope that it will be useful,
8 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
9 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10 dnl PARTICULAR PURPOSE.
111
212 # Do all the work for Automake. This macro actually does too much --
313 # some checks are only needed if your package does certain things.
2131 ifelse([$3],,
2232 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
2333 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
24 AM_SANITY_CHECK
25 AC_ARG_PROGRAM
34 AC_REQUIRE([AM_SANITY_CHECK])
35 AC_REQUIRE([AC_ARG_PROGRAM])
2636 dnl FIXME This is truly gross.
2737 missing_dir=`cd $ac_aux_dir && pwd`
2838 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
3040 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
3141 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
3242 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
33 AC_PROG_MAKE_SET])
43 AC_REQUIRE([AC_PROG_MAKE_SET])])
3444
3545
3646 # serial 1
5767 # directory).
5868 if (
5969 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
60 if test "$@" = "X"; then
70 if test "[$]*" = "X"; then
6171 # -L didn't work.
6272 set X `ls -t $srcdir/configure conftestfile`
6373 fi
74 if test "[$]*" != "X $srcdir/configure conftestfile" \
75 && test "[$]*" != "X conftestfile $srcdir/configure"; then
76
77 # If neither matched, then we have a broken ls. This can happen
78 # if, for instance, CONFIG_SHELL is bash and it inherits a
79 # broken ls alias from the environment. This has actually
80 # happened. Such a system could not be considered "sane".
81 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
82 alias in your environment])
83 fi
84
6485 test "[$]2" = conftestfile
6586 )
6687 then
105126 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
106127 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program],
107128 , enable_gtktest=yes)
108
129 AC_ARG_ENABLE(gtk, [ --disable-gtk Do not use GTK],
130 , enable_gtk=yes)
131
132 if test x$enable_gtk != xyes ; then
133 GTK_CFLAGS=""
134 GTK_LIBS=""
135 ifelse([$3], , :, [$3])
136 else # Begin wrap around GTK stuff
109137 if test x$gtk_config_exec_prefix != x ; then
110138 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
111139 if test x${GTK_CONFIG+set} != xset ; then
261289 AC_SUBST(GTK_CFLAGS)
262290 AC_SUBST(GTK_LIBS)
263291 rm -f conf.gtktest
292 # End wrap around GTK stuff
293 fi
264294 ])
265295
266296 # Like AC_CONFIG_HEADER, but automatically create stamp file.
3030 /* The number of bytes in a unsigned short. */
3131 #undef SIZEOF_UNSIGNED_SHORT
3232
33 /* Define if you have the attron function. */
34 #undef HAVE_ATTRON
35
36 /* Define if you have the seteuid function. */
37 #undef HAVE_SETEUID
38
3339 /* Define if you have the <curses.h> header file. */
3440 #undef HAVE_CURSES_H
41
42 /* Define if you have the <cursesX.h> header file. */
43 #undef HAVE_CURSESX_H
3544
3645 /* Define if you have the <ncurses.h> header file. */
3746 #undef HAVE_NCURSES_H
3948 /* Define if you have the <ncurses/curses.h> header file. */
4049 #undef HAVE_NCURSES_CURSES_H
4150
51 /* Define if you have the <sys/types.h> header file. */
52 #undef HAVE_SYS_TYPES_H
53
4254 /* Define if you have the <sys/xti.h> header file. */
4355 #undef HAVE_SYS_XTI_H
56
57 /* Define if you have the bind library (-lbind). */
58 #undef HAVE_LIBBIND
4459
4560 /* Define if you have the m library (-lm). */
4661 #undef HAVE_LIBM
5166 /* Define if you have the nsl library (-lnsl). */
5267 #undef HAVE_LIBNSL
5368
54 /* Define if you have the resolv library (-lresolv). */
55 #undef HAVE_LIBRESOLV
56
5769 /* Define if you have the socket library (-lsocket). */
5870 #undef HAVE_LIBSOCKET
71
72 /* Define if you have the termcap library (-ltermcap). */
73 #undef HAVE_LIBTERMCAP
5974
6075 /* Find the proper type for 8 bits */
6176 #if SIZEOF_UNSIGNED_CHAR == 1
00 #! /bin/sh
11
22 # Guess values for system-dependent variables and create Makefiles.
3 # Generated automatically using autoconf version 2.12
3 # Generated automatically using autoconf version 2.13
44 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
55 #
66 # This configure script is free software; the Free Software Foundation
1616 --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
1717 ac_help="$ac_help
1818 --disable-gtktest Do not try to compile and run a test GTK program"
19 ac_help="$ac_help
20 --disable-gtk Do not use GTK"
1921
2022 # Initialize some variables set by options.
2123 # The variables have the same names as the options, with
5456 # Initialize some other variables.
5557 subdirs=
5658 MFLAGS= MAKEFLAGS=
59 SHELL=${CONFIG_SHELL-/bin/sh}
5760 # Maximum number of lines to put in a shell here document.
5861 ac_max_here_lines=12
5962
337340 verbose=yes ;;
338341
339342 -version | --version | --versio | --versi | --vers)
340 echo "configure generated by autoconf version 2.12"
343 echo "configure generated by autoconf version 2.13"
341344 exit 0 ;;
342345
343346 -with-* | --with-*)
507510 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
508511 ac_cpp='$CPP $CPPFLAGS'
509512 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
510 ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
513 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
511514 cross_compiling=$ac_cv_prog_cc_cross
512515
516 ac_exeext=
517 ac_objext=o
513518 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
514519 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
515520 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
549554 # SunOS /usr/etc/install
550555 # IRIX /sbin/install
551556 # AIX /bin/install
557 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
552558 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
553559 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
554560 # ./install, which can be erroneously created by make from ./install.sh.
555561 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
556 echo "configure:558: checking for a BSD compatible install" >&5
562 echo "configure:564: checking for a BSD compatible install" >&5
557563 if test -z "$INSTALL"; then
558564 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
559565 echo $ac_n "(cached) $ac_c" 1>&6
560566 else
561 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
567 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
562568 for ac_dir in $PATH; do
563569 # Account for people who put trailing slashes in PATH elements.
564570 case "$ac_dir/" in
565571 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
566572 *)
567573 # OSF1 and SCO ODT 3.0 have their own names for install.
568 for ac_prog in ginstall installbsd scoinst install; do
574 # Don't use installbsd from OSF since it installs stuff as root
575 # by default.
576 for ac_prog in ginstall scoinst install; do
569577 if test -f $ac_dir/$ac_prog; then
570578 if test $ac_prog = install &&
571579 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
572580 # AIX install. It has an incompatible calling convention.
573 # OSF/1 installbsd also uses dspmsg, but is usable.
574581 :
575582 else
576583 ac_cv_path_install="$ac_dir/$ac_prog -c"
600607 # It thinks the first close brace ends the variable substitution.
601608 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
602609
610 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
611
603612 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
604613
605614
606615 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
607616
608
609 PACKAGE=mtr
610
611 VERSION=0.28
612
613 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
614 { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
615 fi
616 cat >> confdefs.h <<EOF
617 #define PACKAGE "$PACKAGE"
618 EOF
619
620 cat >> confdefs.h <<EOF
621 #define VERSION "$VERSION"
622 EOF
623
624617 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
625 echo "configure:627: checking whether build environment is sane" >&5
618 echo "configure:620: checking whether build environment is sane" >&5
626619 # Just in case
627620 sleep 1
628621 echo timestamp > conftestfile
633626 # directory).
634627 if (
635628 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
636 if test "" = "X"; then
629 if test "$*" = "X"; then
637630 # -L didn't work.
638631 set X `ls -t $srcdir/configure conftestfile`
639632 fi
633 if test "$*" != "X $srcdir/configure conftestfile" \
634 && test "$*" != "X conftestfile $srcdir/configure"; then
635
636 # If neither matched, then we have a broken ls. This can happen
637 # if, for instance, CONFIG_SHELL is bash and it inherits a
638 # broken ls alias from the environment. This has actually
639 # happened. Such a system could not be considered "sane".
640 { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
641 alias in your environment" 1>&2; exit 1; }
642 fi
643
640644 test "$2" = conftestfile
641645 )
642646 then
667671 # sed with no file args requires a program.
668672 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
669673
674 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
675 echo "configure:677: checking whether ${MAKE-make} sets \${MAKE}" >&5
676 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
677 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
678 echo $ac_n "(cached) $ac_c" 1>&6
679 else
680 cat > conftestmake <<\EOF
681 all:
682 @echo 'ac_maketemp="${MAKE}"'
683 EOF
684 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
685 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
686 if test -n "$ac_maketemp"; then
687 eval ac_cv_prog_make_${ac_make}_set=yes
688 else
689 eval ac_cv_prog_make_${ac_make}_set=no
690 fi
691 rm -f conftestmake
692 fi
693 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
694 echo "$ac_t""yes" 1>&6
695 SET_MAKE=
696 else
697 echo "$ac_t""no" 1>&6
698 SET_MAKE="MAKE=${MAKE-make}"
699 fi
700
701
702 PACKAGE=mtr
703
704 VERSION=0.41
705
706 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
707 { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
708 fi
709 cat >> confdefs.h <<EOF
710 #define PACKAGE "$PACKAGE"
711 EOF
712
713 cat >> confdefs.h <<EOF
714 #define VERSION "$VERSION"
715 EOF
716
717
718
670719 missing_dir=`cd $ac_aux_dir && pwd`
671720 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
672 echo "configure:674: checking for working aclocal" >&5
721 echo "configure:723: checking for working aclocal" >&5
673722 # Run test in a subshell; some versions of sh will print an error if
674723 # an executable is not found, even if stderr is redirected.
675724 # Redirect stdin to placate older versions of autoconf. Sigh.
682731 fi
683732
684733 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
685 echo "configure:687: checking for working autoconf" >&5
734 echo "configure:736: checking for working autoconf" >&5
686735 # Run test in a subshell; some versions of sh will print an error if
687736 # an executable is not found, even if stderr is redirected.
688737 # Redirect stdin to placate older versions of autoconf. Sigh.
695744 fi
696745
697746 echo $ac_n "checking for working automake""... $ac_c" 1>&6
698 echo "configure:700: checking for working automake" >&5
747 echo "configure:749: checking for working automake" >&5
699748 # Run test in a subshell; some versions of sh will print an error if
700749 # an executable is not found, even if stderr is redirected.
701750 # Redirect stdin to placate older versions of autoconf. Sigh.
708757 fi
709758
710759 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
711 echo "configure:713: checking for working autoheader" >&5
760 echo "configure:762: checking for working autoheader" >&5
712761 # Run test in a subshell; some versions of sh will print an error if
713762 # an executable is not found, even if stderr is redirected.
714763 # Redirect stdin to placate older versions of autoconf. Sigh.
721770 fi
722771
723772 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
724 echo "configure:726: checking for working makeinfo" >&5
773 echo "configure:775: checking for working makeinfo" >&5
725774 # Run test in a subshell; some versions of sh will print an error if
726775 # an executable is not found, even if stderr is redirected.
727776 # Redirect stdin to placate older versions of autoconf. Sigh.
733782 echo "$ac_t""missing" 1>&6
734783 fi
735784
736 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
737 echo "configure:739: checking whether ${MAKE-make} sets \${MAKE}" >&5
738 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
739 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
740 echo $ac_n "(cached) $ac_c" 1>&6
741 else
742 cat > conftestmake <<\EOF
743 all:
744 @echo 'ac_maketemp="${MAKE}"'
745 EOF
746 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
747 eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
748 if test -n "$ac_maketemp"; then
749 eval ac_cv_prog_make_${ac_make}_set=yes
750 else
751 eval ac_cv_prog_make_${ac_make}_set=no
752 fi
753 rm -f conftestmake
754 fi
755 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
756 echo "$ac_t""yes" 1>&6
757 SET_MAKE=
758 else
759 echo "$ac_t""no" 1>&6
760 SET_MAKE="MAKE=${MAKE-make}"
761 fi
762785
763786
764787
770793 # Extract the first word of "gcc", so it can be a program name with args.
771794 set dummy gcc; ac_word=$2
772795 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
773 echo "configure:775: checking for $ac_word" >&5
796 echo "configure:798: checking for $ac_word" >&5
774797 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
775798 echo $ac_n "(cached) $ac_c" 1>&6
776799 else
777800 if test -n "$CC"; then
778801 ac_cv_prog_CC="$CC" # Let the user override the test.
779802 else
780 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
781 for ac_dir in $PATH; do
803 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
804 ac_dummy="$PATH"
805 for ac_dir in $ac_dummy; do
782806 test -z "$ac_dir" && ac_dir=.
783807 if test -f $ac_dir/$ac_word; then
784808 ac_cv_prog_CC="gcc"
799823 # Extract the first word of "cc", so it can be a program name with args.
800824 set dummy cc; ac_word=$2
801825 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
802 echo "configure:804: checking for $ac_word" >&5
826 echo "configure:828: checking for $ac_word" >&5
803827 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
804828 echo $ac_n "(cached) $ac_c" 1>&6
805829 else
806830 if test -n "$CC"; then
807831 ac_cv_prog_CC="$CC" # Let the user override the test.
808832 else
809 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
833 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
810834 ac_prog_rejected=no
811 for ac_dir in $PATH; do
835 ac_dummy="$PATH"
836 for ac_dir in $ac_dummy; do
812837 test -z "$ac_dir" && ac_dir=.
813838 if test -f $ac_dir/$ac_word; then
814839 if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
843868 echo "$ac_t""no" 1>&6
844869 fi
845870
871 if test -z "$CC"; then
872 case "`uname -s`" in
873 *win32* | *WIN32*)
874 # Extract the first word of "cl", so it can be a program name with args.
875 set dummy cl; ac_word=$2
876 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
877 echo "configure:879: checking for $ac_word" >&5
878 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
879 echo $ac_n "(cached) $ac_c" 1>&6
880 else
881 if test -n "$CC"; then
882 ac_cv_prog_CC="$CC" # Let the user override the test.
883 else
884 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
885 ac_dummy="$PATH"
886 for ac_dir in $ac_dummy; do
887 test -z "$ac_dir" && ac_dir=.
888 if test -f $ac_dir/$ac_word; then
889 ac_cv_prog_CC="cl"
890 break
891 fi
892 done
893 IFS="$ac_save_ifs"
894 fi
895 fi
896 CC="$ac_cv_prog_CC"
897 if test -n "$CC"; then
898 echo "$ac_t""$CC" 1>&6
899 else
900 echo "$ac_t""no" 1>&6
901 fi
902 ;;
903 esac
904 fi
846905 test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
847906 fi
848907
849908 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
850 echo "configure:852: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
909 echo "configure:911: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
851910
852911 ac_ext=c
853912 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
854913 ac_cpp='$CPP $CPPFLAGS'
855914 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
856 ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
915 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
857916 cross_compiling=$ac_cv_prog_cc_cross
858917
859 cat > conftest.$ac_ext <<EOF
860 #line 862 "configure"
861 #include "confdefs.h"
918 cat > conftest.$ac_ext << EOF
919
920 #line 922 "configure"
921 #include "confdefs.h"
922
862923 main(){return(0);}
863924 EOF
864 if { (eval echo configure:866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
925 if { (eval echo configure:927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
865926 ac_cv_prog_cc_works=yes
866927 # If we can't run a trivial program, we are probably using a cross compiler.
867928 if (./conftest; exit) 2>/dev/null; then
875936 ac_cv_prog_cc_works=no
876937 fi
877938 rm -fr conftest*
939 ac_ext=c
940 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
941 ac_cpp='$CPP $CPPFLAGS'
942 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
943 ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
944 cross_compiling=$ac_cv_prog_cc_cross
878945
879946 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
880947 if test $ac_cv_prog_cc_works = no; then
881948 { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
882949 fi
883950 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
884 echo "configure:886: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
951 echo "configure:953: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
885952 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
886953 cross_compiling=$ac_cv_prog_cc_cross
887954
888955 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
889 echo "configure:891: checking whether we are using GNU C" >&5
956 echo "configure:958: checking whether we are using GNU C" >&5
890957 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
891958 echo $ac_n "(cached) $ac_c" 1>&6
892959 else
895962 yes;
896963 #endif
897964 EOF
898 if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
965 if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
899966 ac_cv_prog_gcc=yes
900967 else
901968 ac_cv_prog_gcc=no
906973
907974 if test $ac_cv_prog_gcc = yes; then
908975 GCC=yes
909 ac_test_CFLAGS="${CFLAGS+set}"
910 ac_save_CFLAGS="$CFLAGS"
911 CFLAGS=
912 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
913 echo "configure:915: checking whether ${CC-cc} accepts -g" >&5
976 else
977 GCC=
978 fi
979
980 ac_test_CFLAGS="${CFLAGS+set}"
981 ac_save_CFLAGS="$CFLAGS"
982 CFLAGS=
983 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
984 echo "configure:986: checking whether ${CC-cc} accepts -g" >&5
914985 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
915986 echo $ac_n "(cached) $ac_c" 1>&6
916987 else
925996 fi
926997
927998 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
928 if test "$ac_test_CFLAGS" = set; then
929 CFLAGS="$ac_save_CFLAGS"
930 elif test $ac_cv_prog_cc_g = yes; then
999 if test "$ac_test_CFLAGS" = set; then
1000 CFLAGS="$ac_save_CFLAGS"
1001 elif test $ac_cv_prog_cc_g = yes; then
1002 if test "$GCC" = yes; then
9311003 CFLAGS="-g -O2"
9321004 else
1005 CFLAGS="-g"
1006 fi
1007 else
1008 if test "$GCC" = yes; then
9331009 CFLAGS="-O2"
1010 else
1011 CFLAGS=
9341012 fi
935 else
936 GCC=
937 test "${CFLAGS+set}" = set || CFLAGS="-g"
9381013 fi
9391014
9401015
9411016 echo $ac_n "checking size of unsigned char""... $ac_c" 1>&6
942 echo "configure:944: checking size of unsigned char" >&5
1017 echo "configure:1019: checking size of unsigned char" >&5
9431018 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then
9441019 echo $ac_n "(cached) $ac_c" 1>&6
9451020 else
9471022 ac_cv_sizeof_unsigned_char=1
9481023 else
9491024 cat > conftest.$ac_ext <<EOF
950 #line 952 "configure"
1025 #line 1027 "configure"
9511026 #include "confdefs.h"
9521027 #include <stdio.h>
9531028 main()
9581033 exit(0);
9591034 }
9601035 EOF
961 if { (eval echo configure:963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
1036 if { (eval echo configure:1038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
9621037 then
9631038 ac_cv_sizeof_unsigned_char=`cat conftestval`
9641039 else
9781053
9791054
9801055 echo $ac_n "checking size of unsigned short""... $ac_c" 1>&6
981 echo "configure:983: checking size of unsigned short" >&5
1056 echo "configure:1058: checking size of unsigned short" >&5
9821057 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short'+set}'`\" = set"; then
9831058 echo $ac_n "(cached) $ac_c" 1>&6
9841059 else
9861061 ac_cv_sizeof_unsigned_short=2
9871062 else
9881063 cat > conftest.$ac_ext <<EOF
989 #line 991 "configure"
1064 #line 1066 "configure"
9901065 #include "confdefs.h"
9911066 #include <stdio.h>
9921067 main()
9971072 exit(0);
9981073 }
9991074 EOF
1000 if { (eval echo configure:1002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
1075 if { (eval echo configure:1077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
10011076 then
10021077 ac_cv_sizeof_unsigned_short=`cat conftestval`
10031078 else
10171092
10181093
10191094 echo $ac_n "checking size of unsigned int""... $ac_c" 1>&6
1020 echo "configure:1022: checking size of unsigned int" >&5
1095 echo "configure:1097: checking size of unsigned int" >&5
10211096 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then
10221097 echo $ac_n "(cached) $ac_c" 1>&6
10231098 else
10251100 ac_cv_sizeof_unsigned_int=4
10261101 else
10271102 cat > conftest.$ac_ext <<EOF
1028 #line 1030 "configure"
1103 #line 1105 "configure"
10291104 #include "confdefs.h"
10301105 #include <stdio.h>
10311106 main()
10361111 exit(0);
10371112 }
10381113 EOF
1039 if { (eval echo configure:1041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
1114 if { (eval echo configure:1116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
10401115 then
10411116 ac_cv_sizeof_unsigned_int=`cat conftestval`
10421117 else
10561131
10571132
10581133 echo $ac_n "checking size of unsigned long""... $ac_c" 1>&6
1059 echo "configure:1061: checking size of unsigned long" >&5
1134 echo "configure:1136: checking size of unsigned long" >&5
10601135 if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then
10611136 echo $ac_n "(cached) $ac_c" 1>&6
10621137 else
10641139 ac_cv_sizeof_unsigned_long=4
10651140 else
10661141 cat > conftest.$ac_ext <<EOF
1067 #line 1069 "configure"
1142 #line 1144 "configure"
10681143 #include "confdefs.h"
10691144 #include <stdio.h>
10701145 main()
10751150 exit(0);
10761151 }
10771152 EOF
1078 if { (eval echo configure:1080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
1153 if { (eval echo configure:1155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
10791154 then
10801155 ac_cv_sizeof_unsigned_long=`cat conftestval`
10811156 else
10951170
10961171
10971172
1173 # Some doc I found somewhere. :-) -- REW
1174 # - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1175 # - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
1176
1177 # We don't refer to any symbols in termcap, but -lcurses on SunOS does.
1178 # We have to trust the linker not to mess things up... (It should not
1179 # pull in anything if we don't refer to anything in the lib).
1180 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
1181 echo "configure:1183: checking for tgetent in -ltermcap" >&5
1182 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
1183 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1184 echo $ac_n "(cached) $ac_c" 1>&6
1185 else
1186 ac_save_LIBS="$LIBS"
1187 LIBS="-ltermcap $LIBS"
1188 cat > conftest.$ac_ext <<EOF
1189 #line 1191 "configure"
1190 #include "confdefs.h"
1191 /* Override any gcc2 internal prototype to avoid an error. */
1192 /* We use char because int might match the return type of a gcc2
1193 builtin and then its argument prototype would still apply. */
1194 char tgetent();
1195
1196 int main() {
1197 tgetent()
1198 ; return 0; }
1199 EOF
1200 if { (eval echo configure:1202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1201 rm -rf conftest*
1202 eval "ac_cv_lib_$ac_lib_var=yes"
1203 else
1204 echo "configure: failed program was:" >&5
1205 cat conftest.$ac_ext >&5
1206 rm -rf conftest*
1207 eval "ac_cv_lib_$ac_lib_var=no"
1208 fi
1209 rm -f conftest*
1210 LIBS="$ac_save_LIBS"
1211
1212 fi
1213 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1214 echo "$ac_t""yes" 1>&6
1215 ac_tr_lib=HAVE_LIB`echo termcap | sed -e 's/[^a-zA-Z0-9_]/_/g' \
1216 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1217 cat >> confdefs.h <<EOF
1218 #define $ac_tr_lib 1
1219 EOF
1220
1221 LIBS="-ltermcap $LIBS"
1222
1223 else
1224 echo "$ac_t""no" 1>&6
1225 fi
1226
1227
10981228 echo $ac_n "checking for initscr""... $ac_c" 1>&6
1099 echo "configure:1101: checking for initscr" >&5
1229 echo "configure:1231: checking for initscr" >&5
11001230 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then
11011231 echo $ac_n "(cached) $ac_c" 1>&6
11021232 else
11031233 cat > conftest.$ac_ext <<EOF
1104 #line 1106 "configure"
1234 #line 1236 "configure"
11051235 #include "confdefs.h"
11061236 /* System header to define __stub macros and hopefully few prototypes,
11071237 which can conflict with char initscr(); below. */
11241254
11251255 ; return 0; }
11261256 EOF
1127 if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1257 if { (eval echo configure:1259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
11281258 rm -rf conftest*
11291259 eval "ac_cv_func_initscr=yes"
11301260 else
11421272 else
11431273 echo "$ac_t""no" 1>&6
11441274 echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
1145 echo "configure:1147: checking for initscr in -lncurses" >&5
1275 echo "configure:1277: checking for initscr in -lncurses" >&5
11461276 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
11471277 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
11481278 echo $ac_n "(cached) $ac_c" 1>&6
11501280 ac_save_LIBS="$LIBS"
11511281 LIBS="-lncurses $LIBS"
11521282 cat > conftest.$ac_ext <<EOF
1153 #line 1155 "configure"
1283 #line 1285 "configure"
11541284 #include "confdefs.h"
11551285 /* Override any gcc2 internal prototype to avoid an error. */
11561286 /* We use char because int might match the return type of a gcc2
11611291 initscr()
11621292 ; return 0; }
11631293 EOF
1164 if { (eval echo configure:1166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1294 if { (eval echo configure:1296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
11651295 rm -rf conftest*
11661296 eval "ac_cv_lib_$ac_lib_var=yes"
11671297 else
11871317 else
11881318 echo "$ac_t""no" 1>&6
11891319 echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
1190 echo "configure:1192: checking for initscr in -lcurses" >&5
1320 echo "configure:1322: checking for initscr in -lcurses" >&5
11911321 ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
11921322 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
11931323 echo $ac_n "(cached) $ac_c" 1>&6
11951325 ac_save_LIBS="$LIBS"
11961326 LIBS="-lcurses $LIBS"
11971327 cat > conftest.$ac_ext <<EOF
1198 #line 1200 "configure"
1328 #line 1330 "configure"
11991329 #include "confdefs.h"
12001330 /* Override any gcc2 internal prototype to avoid an error. */
12011331 /* We use char because int might match the return type of a gcc2
12061336 initscr()
12071337 ; return 0; }
12081338 EOF
1209 if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1339 if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
12101340 rm -rf conftest*
12111341 eval "ac_cv_lib_$ac_lib_var=yes"
12121342 else
12311361
12321362 else
12331363 echo "$ac_t""no" 1>&6
1364 echo $ac_n "checking for initscr in -lcursesX""... $ac_c" 1>&6
1365 echo "configure:1367: checking for initscr in -lcursesX" >&5
1366 ac_lib_var=`echo cursesX'_'initscr | sed 'y%./+-%__p_%'`
1367 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
1368 echo $ac_n "(cached) $ac_c" 1>&6
1369 else
1370 ac_save_LIBS="$LIBS"
1371 LIBS="-lcursesX $LIBS"
1372 cat > conftest.$ac_ext <<EOF
1373 #line 1375 "configure"
1374 #include "confdefs.h"
1375 /* Override any gcc2 internal prototype to avoid an error. */
1376 /* We use char because int might match the return type of a gcc2
1377 builtin and then its argument prototype would still apply. */
1378 char initscr();
1379
1380 int main() {
1381 initscr()
1382 ; return 0; }
1383 EOF
1384 if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1385 rm -rf conftest*
1386 eval "ac_cv_lib_$ac_lib_var=yes"
1387 else
1388 echo "configure: failed program was:" >&5
1389 cat conftest.$ac_ext >&5
1390 rm -rf conftest*
1391 eval "ac_cv_lib_$ac_lib_var=no"
1392 fi
1393 rm -f conftest*
1394 LIBS="$ac_save_LIBS"
1395
1396 fi
1397 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
1398 echo "$ac_t""yes" 1>&6
1399 ac_tr_lib=HAVE_LIB`echo cursesX | sed -e 's/^a-zA-Z0-9_/_/g' \
1400 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1401 cat >> confdefs.h <<EOF
1402 #define $ac_tr_lib 1
1403 EOF
1404
1405 LIBS="-lcursesX $LIBS"
1406
1407 else
1408 echo "$ac_t""no" 1>&6
12341409 echo "configure: warning: Building without curses display support" 1>&2
12351410 cat >> confdefs.h <<\EOF
12361411 #define NO_CURSES 1
12431418
12441419 fi
12451420
1421 fi
1422
1423
1424 for ac_func in attron
1425 do
1426 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
1427 echo "configure:1429: checking for $ac_func" >&5
1428 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
1429 echo $ac_n "(cached) $ac_c" 1>&6
1430 else
1431 cat > conftest.$ac_ext <<EOF
1432 #line 1434 "configure"
1433 #include "confdefs.h"
1434 /* System header to define __stub macros and hopefully few prototypes,
1435 which can conflict with char $ac_func(); below. */
1436 #include <assert.h>
1437 /* Override any gcc2 internal prototype to avoid an error. */
1438 /* We use char because int might match the return type of a gcc2
1439 builtin and then its argument prototype would still apply. */
1440 char $ac_func();
1441
1442 int main() {
1443
1444 /* The GNU C library defines this for functions which it implements
1445 to always fail with ENOSYS. Some functions are actually named
1446 something starting with __ and the normal name is an alias. */
1447 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
1448 choke me
1449 #else
1450 $ac_func();
1451 #endif
1452
1453 ; return 0; }
1454 EOF
1455 if { (eval echo configure:1457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
1456 rm -rf conftest*
1457 eval "ac_cv_func_$ac_func=yes"
1458 else
1459 echo "configure: failed program was:" >&5
1460 cat conftest.$ac_ext >&5
1461 rm -rf conftest*
1462 eval "ac_cv_func_$ac_func=no"
1463 fi
1464 rm -f conftest*
1465 fi
1466
1467 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
1468 echo "$ac_t""yes" 1>&6
1469 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
1470 cat >> confdefs.h <<EOF
1471 #define $ac_tr_func 1
1472 EOF
1473
1474 else
1475 echo "$ac_t""no" 1>&6
1476 fi
1477 done
1478
1479
1480
12461481 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
1247 echo "configure:1249: checking how to run the C preprocessor" >&5
1482 echo "configure:1484: checking how to run the C preprocessor" >&5
12481483 # On Suns, sometimes $CPP names a directory.
12491484 if test -n "$CPP" && test -d "$CPP"; then
12501485 CPP=
12591494 # On the NeXT, cc -E runs the code through the compiler's parser,
12601495 # not just through cpp.
12611496 cat > conftest.$ac_ext <<EOF
1262 #line 1264 "configure"
1497 #line 1499 "configure"
12631498 #include "confdefs.h"
12641499 #include <assert.h>
12651500 Syntax Error
12661501 EOF
12671502 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1268 { (eval echo configure:1270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1269 ac_err=`grep -v '^ *+' conftest.out`
1503 { (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1504 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
12701505 if test -z "$ac_err"; then
12711506 :
12721507 else
12761511 rm -rf conftest*
12771512 CPP="${CC-cc} -E -traditional-cpp"
12781513 cat > conftest.$ac_ext <<EOF
1279 #line 1281 "configure"
1514 #line 1516 "configure"
12801515 #include "confdefs.h"
12811516 #include <assert.h>
12821517 Syntax Error
12831518 EOF
12841519 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1285 { (eval echo configure:1287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1286 ac_err=`grep -v '^ *+' conftest.out`
1520 { (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1521 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
12871522 if test -z "$ac_err"; then
12881523 :
12891524 else
12911526 echo "configure: failed program was:" >&5
12921527 cat conftest.$ac_ext >&5
12931528 rm -rf conftest*
1529 CPP="${CC-cc} -nologo -E"
1530 cat > conftest.$ac_ext <<EOF
1531 #line 1533 "configure"
1532 #include "confdefs.h"
1533 #include <assert.h>
1534 Syntax Error
1535 EOF
1536 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1537 { (eval echo configure:1539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1538 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
1539 if test -z "$ac_err"; then
1540 :
1541 else
1542 echo "$ac_err" >&5
1543 echo "configure: failed program was:" >&5
1544 cat conftest.$ac_ext >&5
1545 rm -rf conftest*
12941546 CPP=/lib/cpp
1547 fi
1548 rm -f conftest*
12951549 fi
12961550 rm -f conftest*
12971551 fi
13041558 fi
13051559 echo "$ac_t""$CPP" 1>&6
13061560
1307 for ac_hdr in ncurses.h ncurses/curses.h curses.h
1561 for ac_hdr in ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h
13081562 do
13091563 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
13101564 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1311 echo "configure:1313: checking for $ac_hdr" >&5
1565 echo "configure:1567: checking for $ac_hdr" >&5
13121566 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
13131567 echo $ac_n "(cached) $ac_c" 1>&6
13141568 else
13151569 cat > conftest.$ac_ext <<EOF
1316 #line 1318 "configure"
1570 #line 1572 "configure"
13171571 #include "confdefs.h"
13181572 #include <$ac_hdr>
13191573 EOF
13201574 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1321 { (eval echo configure:1323: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1322 ac_err=`grep -v '^ *+' conftest.out`
1575 { (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1576 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
13231577 if test -z "$ac_err"; then
13241578 rm -rf conftest*
13251579 eval "ac_cv_header_$ac_safe=yes"
13481602 do
13491603 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
13501604 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
1351 echo "configure:1353: checking for $ac_hdr" >&5
1605 echo "configure:1607: checking for $ac_hdr" >&5
13521606 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
13531607 echo $ac_n "(cached) $ac_c" 1>&6
13541608 else
13551609 cat > conftest.$ac_ext <<EOF
1356 #line 1358 "configure"
1610 #line 1612 "configure"
13571611 #include "confdefs.h"
13581612 #include <$ac_hdr>
13591613 EOF
13601614 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
1361 { (eval echo configure:1363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1362 ac_err=`grep -v '^ *+' conftest.out`
1615 { (eval echo configure:1617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
1616 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
13631617 if test -z "$ac_err"; then
13641618 rm -rf conftest*
13651619 eval "ac_cv_header_$ac_safe=yes"
13861640
13871641
13881642 echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
1389 echo "configure:1391: checking for floor in -lm" >&5
1643 echo "configure:1645: checking for floor in -lm" >&5
13901644 ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
13911645 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
13921646 echo $ac_n "(cached) $ac_c" 1>&6
13941648 ac_save_LIBS="$LIBS"
13951649 LIBS="-lm $LIBS"
13961650 cat > conftest.$ac_ext <<EOF
1397 #line 1399 "configure"
1651 #line 1653 "configure"
13981652 #include "confdefs.h"
13991653 /* Override any gcc2 internal prototype to avoid an error. */
14001654 /* We use char because int might match the return type of a gcc2
14051659 floor()
14061660 ; return 0; }
14071661 EOF
1408 if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1662 if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
14091663 rm -rf conftest*
14101664 eval "ac_cv_lib_$ac_lib_var=yes"
14111665 else
14581712 enable_gtktest=yes
14591713 fi
14601714
1461
1715 # Check whether --enable-gtk or --disable-gtk was given.
1716 if test "${enable_gtk+set}" = set; then
1717 enableval="$enable_gtk"
1718 :
1719 else
1720 enable_gtk=yes
1721 fi
1722
1723
1724 if test x$enable_gtk != xyes ; then
1725 GTK_CFLAGS=""
1726 GTK_LIBS=""
1727 echo "configure: warning: Building without GTK+ display support" 1>&2
1728 cat >> confdefs.h <<\EOF
1729 #define NO_GTK 1
1730 EOF
1731
1732 GTK_OBJ=
1733 else # Begin wrap around GTK stuff
14621734 if test x$gtk_config_exec_prefix != x ; then
14631735 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
14641736 if test x${GTK_CONFIG+set} != xset ; then
14751747 # Extract the first word of "gtk-config", so it can be a program name with args.
14761748 set dummy gtk-config; ac_word=$2
14771749 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
1478 echo "configure:1480: checking for $ac_word" >&5
1750 echo "configure:1752: checking for $ac_word" >&5
14791751 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
14801752 echo $ac_n "(cached) $ac_c" 1>&6
14811753 else
14831755 /*)
14841756 ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path.
14851757 ;;
1758 ?:/*)
1759 ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path.
1760 ;;
14861761 *)
1487 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1488 for ac_dir in $PATH; do
1762 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
1763 ac_dummy="$PATH"
1764 for ac_dir in $ac_dummy; do
14891765 test -z "$ac_dir" && ac_dir=.
14901766 if test -f $ac_dir/$ac_word; then
14911767 ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word"
15061782
15071783 min_gtk_version=1.0.0
15081784 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
1509 echo "configure:1511: checking for GTK - version >= $min_gtk_version" >&5
1785 echo "configure:1787: checking for GTK - version >= $min_gtk_version" >&5
15101786 no_gtk=""
15111787 if test "$GTK_CONFIG" = "no" ; then
15121788 no_gtk=yes
15291805 echo $ac_n "cross compiling; assumed OK... $ac_c"
15301806 else
15311807 cat > conftest.$ac_ext <<EOF
1532 #line 1534 "configure"
1808 #line 1810 "configure"
15331809 #include "confdefs.h"
15341810
15351811 #include <gtk/gtk.h>
15951871 }
15961872
15971873 EOF
1598 if { (eval echo configure:1600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
1874 if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
15991875 then
16001876 :
16011877 else
16301906 CFLAGS="$CFLAGS $GTK_CFLAGS"
16311907 LIBS="$LIBS $GTK_LIBS"
16321908 cat > conftest.$ac_ext <<EOF
1633 #line 1635 "configure"
1909 #line 1911 "configure"
16341910 #include "confdefs.h"
16351911
16361912 #include <gtk/gtk.h>
16401916 return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version));
16411917 ; return 0; }
16421918 EOF
1643 if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1919 if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
16441920 rm -rf conftest*
16451921 echo "*** The test program compiled, but did not run. This usually means"
16461922 echo "*** that the run-time linker is not finding GTK or finding the wrong"
16821958
16831959
16841960 rm -f conf.gtktest
1961 # End wrap around GTK stuff
1962 fi
16851963
16861964
16871965 echo $ac_n "checking for socket""... $ac_c" 1>&6
1688 echo "configure:1690: checking for socket" >&5
1966 echo "configure:1968: checking for socket" >&5
16891967 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
16901968 echo $ac_n "(cached) $ac_c" 1>&6
16911969 else
16921970 cat > conftest.$ac_ext <<EOF
1693 #line 1695 "configure"
1971 #line 1973 "configure"
16941972 #include "confdefs.h"
16951973 /* System header to define __stub macros and hopefully few prototypes,
16961974 which can conflict with char socket(); below. */
17131991
17141992 ; return 0; }
17151993 EOF
1716 if { (eval echo configure:1718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
1994 if { (eval echo configure:1996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
17171995 rm -rf conftest*
17181996 eval "ac_cv_func_socket=yes"
17191997 else
17312009 else
17322010 echo "$ac_t""no" 1>&6
17332011 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
1734 echo "configure:1736: checking for socket in -lsocket" >&5
2012 echo "configure:2014: checking for socket in -lsocket" >&5
17352013 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
17362014 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
17372015 echo $ac_n "(cached) $ac_c" 1>&6
17392017 ac_save_LIBS="$LIBS"
17402018 LIBS="-lsocket $LIBS"
17412019 cat > conftest.$ac_ext <<EOF
1742 #line 1744 "configure"
2020 #line 2022 "configure"
17432021 #include "confdefs.h"
17442022 /* Override any gcc2 internal prototype to avoid an error. */
17452023 /* We use char because int might match the return type of a gcc2
17502028 socket()
17512029 ; return 0; }
17522030 EOF
1753 if { (eval echo configure:1755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2031 if { (eval echo configure:2033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
17542032 rm -rf conftest*
17552033 eval "ac_cv_lib_$ac_lib_var=yes"
17562034 else
17822060
17832061
17842062 echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
1785 echo "configure:1787: checking for gethostbyname" >&5
2063 echo "configure:2065: checking for gethostbyname" >&5
17862064 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
17872065 echo $ac_n "(cached) $ac_c" 1>&6
17882066 else
17892067 cat > conftest.$ac_ext <<EOF
1790 #line 1792 "configure"
2068 #line 2070 "configure"
17912069 #include "confdefs.h"
17922070 /* System header to define __stub macros and hopefully few prototypes,
17932071 which can conflict with char gethostbyname(); below. */
18102088
18112089 ; return 0; }
18122090 EOF
1813 if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2091 if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
18142092 rm -rf conftest*
18152093 eval "ac_cv_func_gethostbyname=yes"
18162094 else
18282106 else
18292107 echo "$ac_t""no" 1>&6
18302108 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
1831 echo "configure:1833: checking for gethostbyname in -lnsl" >&5
2109 echo "configure:2111: checking for gethostbyname in -lnsl" >&5
18322110 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
18332111 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
18342112 echo $ac_n "(cached) $ac_c" 1>&6
18362114 ac_save_LIBS="$LIBS"
18372115 LIBS="-lnsl $LIBS"
18382116 cat > conftest.$ac_ext <<EOF
1839 #line 1841 "configure"
2117 #line 2119 "configure"
18402118 #include "confdefs.h"
18412119 /* Override any gcc2 internal prototype to avoid an error. */
18422120 /* We use char because int might match the return type of a gcc2
18472125 gethostbyname()
18482126 ; return 0; }
18492127 EOF
1850 if { (eval echo configure:1852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2128 if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
18512129 rm -rf conftest*
18522130 eval "ac_cv_lib_$ac_lib_var=yes"
18532131 else
18782156 fi
18792157
18802158
2159 echo $ac_n "checking for res_init""... $ac_c" 1>&6
2160 echo "configure:2162: checking for res_init" >&5
2161 if eval "test \"`echo '$''{'ac_cv_func_res_init'+set}'`\" = set"; then
2162 echo $ac_n "(cached) $ac_c" 1>&6
2163 else
2164 cat > conftest.$ac_ext <<EOF
2165 #line 2167 "configure"
2166 #include "confdefs.h"
2167 /* System header to define __stub macros and hopefully few prototypes,
2168 which can conflict with char res_init(); below. */
2169 #include <assert.h>
2170 /* Override any gcc2 internal prototype to avoid an error. */
2171 /* We use char because int might match the return type of a gcc2
2172 builtin and then its argument prototype would still apply. */
2173 char res_init();
2174
2175 int main() {
2176
2177 /* The GNU C library defines this for functions which it implements
2178 to always fail with ENOSYS. Some functions are actually named
2179 something starting with __ and the normal name is an alias. */
2180 #if defined (__stub_res_init) || defined (__stub___res_init)
2181 choke me
2182 #else
2183 res_init();
2184 #endif
2185
2186 ; return 0; }
2187 EOF
2188 if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2189 rm -rf conftest*
2190 eval "ac_cv_func_res_init=yes"
2191 else
2192 echo "configure: failed program was:" >&5
2193 cat conftest.$ac_ext >&5
2194 rm -rf conftest*
2195 eval "ac_cv_func_res_init=no"
2196 fi
2197 rm -f conftest*
2198 fi
2199
2200 if eval "test \"`echo '$ac_cv_func_'res_init`\" = yes"; then
2201 echo "$ac_t""yes" 1>&6
2202 :
2203 else
2204 echo "$ac_t""no" 1>&6
2205 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6
2206 echo "configure:2208: checking for res_init in -lbind" >&5
2207 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'`
2208 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2209 echo $ac_n "(cached) $ac_c" 1>&6
2210 else
2211 ac_save_LIBS="$LIBS"
2212 LIBS="-lbind $LIBS"
2213 cat > conftest.$ac_ext <<EOF
2214 #line 2216 "configure"
2215 #include "confdefs.h"
2216 /* Override any gcc2 internal prototype to avoid an error. */
2217 /* We use char because int might match the return type of a gcc2
2218 builtin and then its argument prototype would still apply. */
2219 char res_init();
2220
2221 int main() {
2222 res_init()
2223 ; return 0; }
2224 EOF
2225 if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2226 rm -rf conftest*
2227 eval "ac_cv_lib_$ac_lib_var=yes"
2228 else
2229 echo "configure: failed program was:" >&5
2230 cat conftest.$ac_ext >&5
2231 rm -rf conftest*
2232 eval "ac_cv_lib_$ac_lib_var=no"
2233 fi
2234 rm -f conftest*
2235 LIBS="$ac_save_LIBS"
2236
2237 fi
2238 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2239 echo "$ac_t""yes" 1>&6
2240 ac_tr_lib=HAVE_LIB`echo bind | sed -e 's/^a-zA-Z0-9_/_/g' \
2241 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2242 cat >> confdefs.h <<EOF
2243 #define $ac_tr_lib 1
2244 EOF
2245
2246 LIBS="-lbind $LIBS"
2247
2248 else
2249 echo "$ac_t""no" 1>&6
2250 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6
2251 echo "configure:2253: checking for res_init in -lresolv" >&5
2252 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'`
2253 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2254 echo $ac_n "(cached) $ac_c" 1>&6
2255 else
2256 ac_save_LIBS="$LIBS"
2257 LIBS="-lresolv $LIBS"
2258 cat > conftest.$ac_ext <<EOF
2259 #line 2261 "configure"
2260 #include "confdefs.h"
2261 /* Override any gcc2 internal prototype to avoid an error. */
2262 /* We use char because int might match the return type of a gcc2
2263 builtin and then its argument prototype would still apply. */
2264 char res_init();
2265
2266 int main() {
2267 res_init()
2268 ; return 0; }
2269 EOF
2270 if { (eval echo configure:2272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2271 rm -rf conftest*
2272 eval "ac_cv_lib_$ac_lib_var=yes"
2273 else
2274 echo "configure: failed program was:" >&5
2275 cat conftest.$ac_ext >&5
2276 rm -rf conftest*
2277 eval "ac_cv_lib_$ac_lib_var=no"
2278 fi
2279 rm -f conftest*
2280 LIBS="$ac_save_LIBS"
2281
2282 fi
2283 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2284 echo "$ac_t""yes" 1>&6
2285 ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/^a-zA-Z0-9_/_/g' \
2286 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2287 cat >> confdefs.h <<EOF
2288 #define $ac_tr_lib 1
2289 EOF
2290
2291 LIBS="-lresolv $LIBS"
2292
2293 else
2294 echo "$ac_t""no" 1>&6
2295 { echo "configure: error: No resolver library found" 1>&2; exit 1; }
2296 fi
2297
2298 fi
2299
2300 fi
2301
2302
2303 for ac_func in seteuid
2304 do
2305 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
2306 echo "configure:2308: checking for $ac_func" >&5
2307 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
2308 echo $ac_n "(cached) $ac_c" 1>&6
2309 else
2310 cat > conftest.$ac_ext <<EOF
2311 #line 2313 "configure"
2312 #include "confdefs.h"
2313 /* System header to define __stub macros and hopefully few prototypes,
2314 which can conflict with char $ac_func(); below. */
2315 #include <assert.h>
2316 /* Override any gcc2 internal prototype to avoid an error. */
2317 /* We use char because int might match the return type of a gcc2
2318 builtin and then its argument prototype would still apply. */
2319 char $ac_func();
2320
2321 int main() {
2322
2323 /* The GNU C library defines this for functions which it implements
2324 to always fail with ENOSYS. Some functions are actually named
2325 something starting with __ and the normal name is an alias. */
2326 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
2327 choke me
2328 #else
2329 $ac_func();
2330 #endif
2331
2332 ; return 0; }
2333 EOF
2334 if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2335 rm -rf conftest*
2336 eval "ac_cv_func_$ac_func=yes"
2337 else
2338 echo "configure: failed program was:" >&5
2339 cat conftest.$ac_ext >&5
2340 rm -rf conftest*
2341 eval "ac_cv_func_$ac_func=no"
2342 fi
2343 rm -f conftest*
2344 fi
2345
2346 if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
2347 echo "$ac_t""yes" 1>&6
2348 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2349 cat >> confdefs.h <<EOF
2350 #define $ac_tr_func 1
2351 EOF
2352
2353 else
2354 echo "$ac_t""no" 1>&6
2355 fi
2356 done
2357
2358 # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
2359
18812360 echo $ac_n "checking for res_mkquery""... $ac_c" 1>&6
1882 echo "configure:1884: checking for res_mkquery" >&5
2361 echo "configure:2363: checking for res_mkquery" >&5
18832362 if eval "test \"`echo '$''{'ac_cv_func_res_mkquery'+set}'`\" = set"; then
18842363 echo $ac_n "(cached) $ac_c" 1>&6
18852364 else
18862365 cat > conftest.$ac_ext <<EOF
1887 #line 1889 "configure"
2366 #line 2368 "configure"
18882367 #include "confdefs.h"
18892368 /* System header to define __stub macros and hopefully few prototypes,
18902369 which can conflict with char res_mkquery(); below. */
19072386
19082387 ; return 0; }
19092388 EOF
1910 if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2389 if { (eval echo configure:2391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
19112390 rm -rf conftest*
19122391 eval "ac_cv_func_res_mkquery=yes"
19132392 else
19242403 :
19252404 else
19262405 echo "$ac_t""no" 1>&6
1927 echo $ac_n "checking for res_mkquery in -lresolv""... $ac_c" 1>&6
1928 echo "configure:1930: checking for res_mkquery in -lresolv" >&5
1929 ac_lib_var=`echo resolv'_'res_mkquery | sed 'y%./+-%__p_%'`
2406 echo $ac_n "checking for res_init in -lbind""... $ac_c" 1>&6
2407 echo "configure:2409: checking for res_init in -lbind" >&5
2408 ac_lib_var=`echo bind'_'res_init | sed 'y%./+-%__p_%'`
2409 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2410 echo $ac_n "(cached) $ac_c" 1>&6
2411 else
2412 ac_save_LIBS="$LIBS"
2413 LIBS="-lbind $LIBS"
2414 cat > conftest.$ac_ext <<EOF
2415 #line 2417 "configure"
2416 #include "confdefs.h"
2417 /* Override any gcc2 internal prototype to avoid an error. */
2418 /* We use char because int might match the return type of a gcc2
2419 builtin and then its argument prototype would still apply. */
2420 char res_init();
2421
2422 int main() {
2423 res_init()
2424 ; return 0; }
2425 EOF
2426 if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2427 rm -rf conftest*
2428 eval "ac_cv_lib_$ac_lib_var=yes"
2429 else
2430 echo "configure: failed program was:" >&5
2431 cat conftest.$ac_ext >&5
2432 rm -rf conftest*
2433 eval "ac_cv_lib_$ac_lib_var=no"
2434 fi
2435 rm -f conftest*
2436 LIBS="$ac_save_LIBS"
2437
2438 fi
2439 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2440 echo "$ac_t""yes" 1>&6
2441 ac_tr_lib=HAVE_LIB`echo bind | sed -e 's/^a-zA-Z0-9_/_/g' \
2442 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2443 cat >> confdefs.h <<EOF
2444 #define $ac_tr_lib 1
2445 EOF
2446
2447 LIBS="-lbind $LIBS"
2448
2449 else
2450 echo "$ac_t""no" 1>&6
2451 echo $ac_n "checking for res_init in -lresolv""... $ac_c" 1>&6
2452 echo "configure:2454: checking for res_init in -lresolv" >&5
2453 ac_lib_var=`echo resolv'_'res_init | sed 'y%./+-%__p_%'`
19302454 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
19312455 echo $ac_n "(cached) $ac_c" 1>&6
19322456 else
19332457 ac_save_LIBS="$LIBS"
19342458 LIBS="-lresolv $LIBS"
19352459 cat > conftest.$ac_ext <<EOF
1936 #line 1938 "configure"
2460 #line 2462 "configure"
19372461 #include "confdefs.h"
19382462 /* Override any gcc2 internal prototype to avoid an error. */
19392463 /* We use char because int might match the return type of a gcc2
19402464 builtin and then its argument prototype would still apply. */
1941 char res_mkquery();
2465 char res_init();
19422466
19432467 int main() {
1944 res_mkquery()
2468 res_init()
19452469 ; return 0; }
19462470 EOF
1947 if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2471 if { (eval echo configure:2473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
19482472 rm -rf conftest*
19492473 eval "ac_cv_lib_$ac_lib_var=yes"
19502474 else
19742498
19752499 fi
19762500
2501 fi
2502
19772503
19782504 echo $ac_n "checking for herror""... $ac_c" 1>&6
1979 echo "configure:1981: checking for herror" >&5
2505 echo "configure:2507: checking for herror" >&5
19802506 if eval "test \"`echo '$''{'ac_cv_func_herror'+set}'`\" = set"; then
19812507 echo $ac_n "(cached) $ac_c" 1>&6
19822508 else
19832509 cat > conftest.$ac_ext <<EOF
1984 #line 1986 "configure"
2510 #line 2512 "configure"
19852511 #include "confdefs.h"
19862512 /* System header to define __stub macros and hopefully few prototypes,
19872513 which can conflict with char herror(); below. */
20042530
20052531 ; return 0; }
20062532 EOF
2007 if { (eval echo configure:2009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2533 if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
20082534 rm -rf conftest*
20092535 eval "ac_cv_func_herror=yes"
20102536 else
20282554 fi
20292555
20302556 echo $ac_n "checking for strerror""... $ac_c" 1>&6
2031 echo "configure:2033: checking for strerror" >&5
2557 echo "configure:2559: checking for strerror" >&5
20322558 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then
20332559 echo $ac_n "(cached) $ac_c" 1>&6
20342560 else
20352561 cat > conftest.$ac_ext <<EOF
2036 #line 2038 "configure"
2562 #line 2564 "configure"
20372563 #include "confdefs.h"
20382564 /* System header to define __stub macros and hopefully few prototypes,
20392565 which can conflict with char strerror(); below. */
20562582
20572583 ; return 0; }
20582584 EOF
2059 if { (eval echo configure:2061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
2585 if { (eval echo configure:2587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
20602586 rm -rf conftest*
20612587 eval "ac_cv_func_strerror=yes"
20622588 else
21062632 # Ultrix sh set writes to stderr and can't be redirected directly,
21072633 # and sets the high bit in the cache file unless we assign to the vars.
21082634 (set) 2>&1 |
2109 case `(ac_space=' '; set) 2>&1` in
2635 case `(ac_space=' '; set | grep ac_space) 2>&1` in
21102636 *ac_space=\ *)
21112637 # `set' does not quote correctly, so add quotes (double-quote substitution
21122638 # turns \\\\ into \\, and sed turns \\ into \).
21732699 echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
21742700 exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
21752701 -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
2176 echo "$CONFIG_STATUS generated by autoconf version 2.12"
2702 echo "$CONFIG_STATUS generated by autoconf version 2.13"
21772703 exit 0 ;;
21782704 -help | --help | --hel | --he | --h)
21792705 echo "\$ac_cs_usage"; exit 0 ;;
21932719 s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
21942720 $ac_vpsub
21952721 $extrasub
2722 s%@SHELL@%$SHELL%g
21962723 s%@CFLAGS@%$CFLAGS%g
21972724 s%@CPPFLAGS@%$CPPFLAGS%g
21982725 s%@CXXFLAGS@%$CXXFLAGS%g
2726 s%@FFLAGS@%$FFLAGS%g
21992727 s%@DEFS@%$DEFS%g
22002728 s%@LDFLAGS@%$LDFLAGS%g
22012729 s%@LIBS@%$LIBS%g
22152743 s%@infodir@%$infodir%g
22162744 s%@mandir@%$mandir%g
22172745 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
2746 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
22182747 s%@INSTALL_DATA@%$INSTALL_DATA%g
2219 s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
22202748 s%@PACKAGE@%$PACKAGE%g
22212749 s%@VERSION@%$VERSION%g
22222750 s%@ACLOCAL@%$ACLOCAL%g
00 AC_INIT(mtr.c)
1 AM_INIT_AUTOMAKE(mtr, 0.28)
1 AM_INIT_AUTOMAKE(mtr, 0.41)
22
33 AC_SUBST(GTK_OBJ)
44 AC_SUBST(CURSES_OBJ)
1313 AC_CHECK_SIZEOF(unsigned int, 4)
1414 AC_CHECK_SIZEOF(unsigned long, 4)
1515
16 # Some doc I found somewhere. :-) -- REW
17 # - Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
18 # - Macro: AC_CHECK_LIB (LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
19
20 # We don't refer to any symbols in termcap, but -lcurses on SunOS does.
21 # We have to trust the linker not to mess things up... (It should not
22 # pull in anything if we don't refer to anything in the lib).
23 AC_CHECK_LIB(termcap, tgetent)
24
1625 AC_CHECK_FUNC(initscr, ,
1726 AC_CHECK_LIB(ncurses, initscr, ,
1827 AC_CHECK_LIB(curses, initscr, ,
28 AC_CHECK_LIB(cursesX, initscr, ,
1929 AC_MSG_WARN(Building without curses display support)
2030 AC_DEFINE(NO_CURSES)
21 CURSES_OBJ=)))
22 AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h)
31 CURSES_OBJ=))))
32
33 AC_CHECK_FUNCS(attron)
34
35
36 AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h)
2337 AC_CHECK_HEADERS(sys/xti.h)
2438
2539 AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found))
3650 AC_CHECK_FUNC(gethostbyname, ,
3751 AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found)))
3852
53 AC_CHECK_FUNC(res_init, ,
54 AC_CHECK_LIB(bind, res_init, ,
55 AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found))))
56
57 AC_CHECK_FUNCS(seteuid)
58 # AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid))
59
3960 AC_CHECK_FUNC(res_mkquery, ,
40 AC_CHECK_LIB(resolv, res_mkquery, , AC_MSG_ERROR(No resolver library found)))
61 AC_CHECK_LIB(bind, res_init, ,
62 AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found))))
4163
4264 AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR))
4365 AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR))
2828 # include <ncurses/curses.h>
2929 #elif defined(HAVE_CURSES_H)
3030 # include <curses.h>
31 #elif defined(HAVE_CURSESX_H)
32 # include <cursesX.h>
3133 #else
3234 # error No curses header file available
35 #endif
36
37 #if defined(HAVE_SYS_TYPES_H)
38 #include <sys/types.h>
39 #else
40 /* If a system doesn't have sys/types.h, lets hope that time_t is an int */
41 #define time_t int
42 #endif
43
44 #ifndef HAVE_ATTRON
45 #define attron(x)
46 #define attroff(x)
3347 #endif
3448
3549 #ifndef getmaxyx
4155 #include "net.h"
4256 #include "dns.h"
4357 #endif
58
59 #include <time.h>
60 extern char LocalHostname[];
4461
4562 void pwcenter(char *str) {
4663 int maxx, maxy;
6077 return ActionQuit;
6178 if(c==3)
6279 return ActionQuit;
80 if (c==12)
81 return ActionClear;
82 if ((c==19) || (tolower (c) == 'p'))
83 return ActionPause;
84 if ((c==17) || (c == ' '))
85 return ActionResume;
6386 if(tolower(c) == 'r')
6487 return ActionReset;
88 if (tolower(c) == 'd')
89 return ActionDisplay;
6590
6691 return 0;
6792 }
91116 getyx(stdscr, y, x);
92117 move(y, startstat);
93118
94 printw(" %3d%% %3d %3d %4d %4d %6d",
119 /* net_xxx returns times in usecs. Just display millisecs */
120 printw(" %3d%% %4d %4d %4d %4d %4d %6d",
95121 net_percent(at),
96 net_returned(at), net_xmit(at),
97 net_best(at), net_avg(at), net_worst(at));
122 net_returned(at), net_xmit(at),
123 net_last(at)/1000, net_best(at)/1000,
124 net_avg(at)/1000, net_worst(at)/1000);
98125
99126
100127 } else {
103130
104131 printw("\n");
105132 }
133 }
134
135 static double factors[] = { 0.02, 0.05, 0.08, 0.15, 0.33, 0.50, 0.80, 1.00 };
136 static int scale[8];
137 static int low_ms, high_ms;
138
139 void mtr_gen_scale(void) {
140 int *saved, i, max, at;
141 int range;
142
143 low_ms = 1000000;
144 high_ms = -1;
145
146 for (i = 0; i < 8; i++) {
147 scale[i] = 0;
148 }
149 max = net_max();
150 for (at = 0; at < max; at++) {
151 saved = net_saved_pings(at);
152 for (i = 0; i < SAVED_PINGS; i++) {
153 if (saved[i] < 0) continue;
154 if (saved[i] < low_ms) {
155 low_ms = saved[i];
156 }
157 if (saved[i] > high_ms) {
158 high_ms = saved[i];
159 }
160 }
161 }
162 range = high_ms - low_ms;
163 for (i = 0; i < 8; i++) {
164 scale[i] = low_ms + ((double)range * factors[i]);
165 }
166 }
167
168 static const char* block_map = ".123abc>";
169
170 void mtr_print_scaled(int ms) {
171 int i;
172
173 for (i = 0; i < 8; i++) {
174 if (ms <= scale[i]) {
175 printw("%c", block_map[i]);
176 return;
177 }
178 }
179 printw(">");
180 }
181
182 void mtr_fill_graph(int at) {
183 int* saved;
184 int i;
185 int val;
186
187 saved = net_saved_pings(at);
188 for (i = 0; i < SAVED_PINGS; i++) {
189 if (saved[i] == -2) {
190 printw(" ");
191 } else if (saved[i] == -1) {
192 attron(A_BOLD);
193 printw("?");
194 attroff(A_BOLD);
195 } else {
196 if (display_mode == 1) {
197 if (saved[i] > scale[6]) {
198 printw("%c", block_map[7]);
199 } else {
200 printw(".");
201 }
202 } else {
203 mtr_print_scaled(saved[i]);
204 }
205 }
206 }
207 }
208
209 void mtr_curses_graph(int startstat) {
210 int max, at, addr, y, x;
211 char* name;
212 char blocks[50];
213
214 max = net_max();
215 for (at = 0; at < max; at++) {
216 printw("%2d. ", at+1);
217
218 addr = net_addr(at);
219 if (!addr) {
220 printw("???\n");
221 continue;
222 }
223
224 name = dns_lookup(addr);
225 if (name) {
226 printw("%s", name);
227 } else {
228 printw("%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) && 0xff, (addr >> 8) & 0xff, addr & 0xff);
229 }
230
231 getyx(stdscr, y, x);
232 move(y, startstat);
233
234 printw(" ");
235 mtr_fill_graph(at);
236 printw("\n");
237 }
106238 }
107239
108240 void mtr_curses_redraw() {
109241 int maxx, maxy;
110242 int startstat;
111243 int rowstat;
244 int i;
245 time_t t;
112246
113247 erase();
114248 getmaxyx(stdscr, maxy, maxx);
115249
116 /* Modified by Brian Casey December 1997 bcasey@imagiware.com */
117 startstat = maxx - 40;
118
119250 rowstat = 5;
120251
252 move(0, 0);
121253 attron(A_BOLD);
122 move(0, 0);
123254 pwcenter("Matt's traceroute [v" VERSION "]");
124 printw("\n\n");
125255 attroff(A_BOLD);
126256
257 mvprintw(1,0, LocalHostname);
258 time(&t);
259 mvprintw(1, maxx-25, ctime(&t));
260
127261 printw("Keys: ");
262 attron(A_BOLD); printw("D"); attroff(A_BOLD);
263 printw(" - Display mode ");
128264 attron(A_BOLD); printw("R"); attroff(A_BOLD);
129265 printw(" - Restart statistics ");
130266 attron(A_BOLD); printw("Q"); attroff(A_BOLD);
133269 attron(A_BOLD);
134270 mvprintw(rowstat - 1, 0, "Hostname");
135271
136 /* Modified by Brian Casey December 1997 bcasey@imagiware.com */
137 mvprintw(rowstat - 2, startstat, " Packets Pings");
138 mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Best Avg Worst");
139
140 attroff(A_BOLD);
141 move(rowstat, 0);
142
143 mtr_curses_hosts(startstat);
272 if (display_mode == 0) {
273 startstat = maxx - 41;
274
275 /* Modified by Brian Casey December 1997 bcasey@imagiware.com */
276 mvprintw(rowstat - 2, startstat, " Packets Pings");
277 mvprintw(rowstat - 1, startstat, " %%Loss Rcv Snt Last Best Avg Worst");
278
279 attroff(A_BOLD);
280 move(rowstat, 0);
281
282 mtr_curses_hosts(startstat);
283 } else {
284 /* David Sward, Jan 1999 */
285 startstat = maxx - 52;
286
287 mvprintw(rowstat - 1, startstat, " Last 50 pings");
288
289 attroff(A_BOLD);
290 move(rowstat, 0);
291
292 mtr_gen_scale();
293 mtr_curses_graph(startstat);
294
295 printw("\n");
296 attron(A_BOLD);
297 printw("Scale:");
298 attroff(A_BOLD);
299
300 for (i = 0; i < 7; i++) {
301 printw(" %c:%d ms", block_map[i], scale[i]/1000);
302 }
303 }
144304
145305 refresh();
146306 }
157317 printw("\n");
158318 endwin();
159319 }
320
321 void mtr_curses_clear() {
322 mtr_curses_close();
323 mtr_curses_open();
324 }
3030 #define mtr_curses_close()
3131 #define mtr_curses_redraw()
3232 #define mtr_curses_keyaction()
33 #define mtr_curses_clear()
3334 #endif
3435
3536 #ifdef NO_GTK
3839 #define gtk_redraw()
3940 #define gtk_keyaction()
4041 #define gtk_loop()
42 #endif
43
44 #ifdef NO_SPLIT
45 #define split_open()
46 #define split_close()
47 #define split_redraw()
48 #define split_keyaction() 0
4149 #endif
4250
4351 void display_detect(int *argc, char ***argv) {
169177 }
170178 }
171179
180
181 void display_clear() {
182 switch(DisplayMode) {
183 case DisplayCurses:
184 mtr_curses_clear();
185 break;
186 case DisplayReport:
187 case DisplaySplit: /* BL */
188 case DisplayRaw:
189 break;
190
191 case DisplayGTK:
192 break;
193 }
194 }
1616 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1717 */
1818
19 enum { ActionNone, ActionQuit, ActionReset };
19 enum { ActionNone, ActionQuit, ActionReset, ActionDisplay, ActionClear,
20 ActionPause, ActionResume };
2021 enum { DisplayReport, DisplayCurses, DisplayGTK, DisplaySplit, DisplayRaw };
2122
2223 /* Prototypes for display.c */
2829 void display_rawhost(int hostnum, int ip_addr);
2930 int display_keyaction();
3031 void display_loop();
32 void display_clear();
33
34 int display_mode;
9191 struct resolve *previousip;
9292 struct resolve *nexthost;
9393 struct resolve *previoushost;
94 float expiretime; /* Fucking HPUX has a problem with "double" here. */
9495 char *hostname;
95 double expiretime;
9696 ip_t ip;
9797 word id;
9898 byte state;
207207 #define getheader_pr(x) ((x->databyte_b >> 6) & 1)
208208 #define getheader_ra(x) (x->databyte_b >> 7)
209209
210 #if 0
211
212 /* The execution order inside an expression is undefined! That means that
213 this might work, but then again, it might not... Sun Lint pointed this
214 one out...*/
215
210216 #define sucknetword(x) (((word)*(x) << 8) | (((x)+= 2)[-1]))
211217 #define sucknetshort(x) (((short)*(x) << 8) | (((x)+= 2)[-1]))
212218 #define sucknetdword(x) (((dword)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1]))
213219 #define sucknetlong(x) (((long)*(x) << 24) | ((x)[1] << 16) | ((x)[2] << 8) | (((x)+= 4)[-1]))
220 #else
221
222 #define sucknetword(x) ((x)+=2,((word) (((x)[-2] << 8) | ((x)[-1] << 0))))
223 #define sucknetshort(x) ((x)+=2,((short) (((x)[-2] << 8) | ((x)[-1] << 0))))
224 #define sucknetdword(x) ((x)+=4,((dword) (((x)[-4] << 24) | ((x)[-3] << 16) | \
225 ((x)[-2] << 8) | ((x)[-1] << 0))))
226 #define sucknetlong(x) ((x)+=4,((long) (((x)[-4] << 24) | ((x)[-3] << 16) | \
227 ((x)[-2] << 8) | ((x)[-1] << 0))))
228 #endif
214229
215230 enum {
216231 STATE_FINISHED,
735750 void dorequest(char *s,int type,word id){
736751 packetheader *hp;
737752 int r,i;
738 byte buf[MaxPacketsize+1];
753 int buf[(MaxPacketsize/sizeof (int))+1];
739754 r = res_mkquery(QUERY,s,C_IN,type,NULL,0,NULL,buf,MaxPacketsize);
740755 if (r == -1){
741756 restell("Resolver error: Query too large.");
+94
-12
gtk.c less more
3131 #include "img/mtr_icon.xpm"
3232 #endif
3333
34
35 gint gtk_ping(gpointer data);
36
37
3438 extern char *Hostname;
3539 extern float WaitTime;
36 extern float DeltaTime;
37
3840 static int tag;
41 static GtkWidget *Pause_Button;
42
43
44 void gtk_add_ping_timeout (void)
45 {
46 int dt;
47
48 dt = calc_deltatime (WaitTime);
49 tag = gtk_timeout_add(dt / 1000, gtk_ping, NULL);
50 }
51
3952
4053 void gtk_do_init(int *argc, char ***argv) {
4154 static int done = 0;
4962
5063 int gtk_detect(int *argc, char ***argv) {
5164 if(getenv("DISPLAY") != NULL) {
52 gtk_do_init(argc, argv);
65 /* If we do this here, gtk_init exits on an error. This happens
66 BEFORE the user has had a chance to tell us not to use the
67 display... */
5368 return TRUE;
5469 } else {
5570 return FALSE;
6984 return FALSE;
7085 }
7186
87
88 gint Pause_clicked(GtkWidget *Button, gpointer data) {
89 static int paused = 0;
90
91 if (paused) {
92 gtk_add_ping_timeout ();
93 } else {
94 gtk_timeout_remove (tag);
95 }
96 paused = ! paused;
97 gtk_redraw();
98
99 return FALSE;
100 }
101
102 /*
103 * There is a small problem with the following code:
104 * The timeout is canceled and removed in order to ensure that
105 * it takes effect (consider what happens if you set the timeout to 999,
106 * then try to undo the change); is a better approach possible? -- CMR
107 *
108 * What's the problem with this? (-> "I don't think so) -- REW
109 */
110
111 gint WaitTime_changed(GtkAdjustment *Adj, GtkWidget *Button) {
112 WaitTime = gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(Button));
113 gtk_timeout_remove (tag);
114 gtk_add_ping_timeout ();
115 gtk_redraw();
116
117 return FALSE;
118 }
119
72120 gint Host_activate(GtkWidget *Entry, gpointer data) {
73121 int addr;
74122
75123 addr = dns_forward(gtk_entry_get_text(GTK_ENTRY(Entry)));
76 if(addr)
124 if(addr) {
77125 net_reopen(addr);
126 /* If we are "Paused" at this point it is usually because someone
127 entered a non-existing host. Therefore do the go-ahead... --REW */
128 gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 0);
129 } else {
130 gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( Pause_Button ) , 1);
131 gtk_entry_append_text( GTK_ENTRY(Entry), ": not found" );
132 }
78133
79134 return FALSE;
80135 }
89144 GtkWidget *Button;
90145 GtkWidget *Label;
91146 GtkWidget *Entry;
147 GtkAdjustment *Adjustment;
92148
93149 Button = gtk_button_new_with_label("Quit");
94150 gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0);
102158 GTK_SIGNAL_FUNC(Restart_clicked), NULL);
103159 gtk_widget_show(Button);
104160
161 Pause_Button = gtk_toggle_button_new_with_label("Pause");
162 gtk_box_pack_end(GTK_BOX(Toolbar), Pause_Button, FALSE, FALSE, 0);
163 gtk_signal_connect(GTK_OBJECT(Pause_Button), "clicked",
164 GTK_SIGNAL_FUNC(Pause_clicked), NULL);
165 gtk_widget_show(Pause_Button);
166
167 /* allow root only to set zero delay */
168 Adjustment = (GtkAdjustment *)gtk_adjustment_new(WaitTime,
169 getuid()==0 ? 0.00:1.00,
170 999.99,
171 1.0, 10.0,
172 0.0);
173 Button = gtk_spin_button_new(Adjustment, 0.5, 2);
174 gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(Button), TRUE);
175 /* gtk_spin_button_set_snap_to_ticks(GTK_SPIN_BUTTON(Button), FALSE); */
176 /* gtk_spin_button_set_set_update_policy(GTK_SPIN_BUTTON(Button),
177 GTK_UPDATE_IF_VALID); */
178 gtk_box_pack_end(GTK_BOX(Toolbar), Button, FALSE, FALSE, 0);
179 gtk_signal_connect(GTK_OBJECT(Adjustment), "value_changed",
180 GTK_SIGNAL_FUNC(WaitTime_changed), Button);
181 gtk_widget_show(Button);
182
105183 Label = gtk_label_new("Hostname");
106184 gtk_box_pack_start(GTK_BOX(Toolbar), Label, FALSE, FALSE, 0);
107185 gtk_widget_show(Label);
146224
147225 GtkWidget *Scrollarea_create() {
148226 GtkWidget *List;
227 GtkWidget *scroll;
149228 int count;
150229
151230 for(count = 0; Report_Positions[count]; count++);
152231
153232 List = GTK_WIDGET(gtk_clist_new_with_titles(count, Report_Text));
154 gtk_clist_set_policy(GTK_CLIST(List), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
233 scroll = gtk_scrolled_window_new(NULL, NULL);
234 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
155235 for(count = 0; Report_Positions[count + 1]; count++) {
156236 gtk_clist_set_column_width(GTK_CLIST(List), count,
157237 Report_Positions[count + 1] -
161241 for(count = 1; Report_Positions[count]; count++) {
162242 gtk_clist_set_column_justification(GTK_CLIST(List), count, GTK_JUSTIFY_RIGHT);
163243 }
244 gtk_container_add(GTK_CONTAINER(scroll), List);
245 gtk_widget_show(List);
164246
165247 ReportBody = List;
166 return List;
248 return scroll;
167249 }
168250
169251 void gtk_add_row(GtkWidget *List) {
217299 gtk_set_field_num(List, row, 2, "%d", net_returned(row));
218300 gtk_set_field_num(List, row, 3, "%d", net_xmit(row));
219301
220 gtk_set_field_num(List, row, 4, "%d", net_best(row));
221 gtk_set_field_num(List, row, 5, "%d", net_avg(row));
222 gtk_set_field_num(List, row, 6, "%d", net_worst(row));
302 gtk_set_field_num(List, row, 4, "%d", net_best(row)/1000);
303 gtk_set_field_num(List, row, 5, "%d", net_avg(row)/1000);
304 gtk_set_field_num(List, row, 6, "%d", net_worst(row)/1000);
223305
224306 }
225307
250332 GtkWidget *List;
251333
252334 gtk_window_set_title(GTK_WINDOW(Window), "My traceroute [v" VERSION "]");
335 gtk_window_set_wmclass(GTK_WINDOW(Window), "mtr", "Mtr");
253336 gtk_widget_set_usize(Window, 540, 400);
254337 gtk_container_border_width(GTK_CONTAINER(Window), 10);
255338 VBox = gtk_vbox_new(FALSE, 10);
307390 gtk_redraw();
308391 net_send_batch();
309392 gtk_timeout_remove (tag);
310 tag = gtk_timeout_add(DeltaTime*1000, gtk_ping, NULL);
393 gtk_add_ping_timeout ();
311394 return TRUE;
312395 }
313396
323406
324407
325408 void gtk_loop() {
326 DeltaTime = WaitTime/10;
327 tag = gtk_timeout_add(DeltaTime*1000, gtk_ping, NULL);
409 gtk_add_ping_timeout ();
328410 gdk_input_add(net_waitfd(), GDK_INPUT_READ, gtk_net_data, NULL);
329411 gdk_input_add(dns_waitfd(), GDK_INPUT_READ, gtk_dns_data, NULL);
330412
0 # Makefile.in generated automatically by automake 1.2 from Makefile.am
0 # Makefile.in generated automatically by automake 1.3 from Makefile.am
11
2 # Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
2 # Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
33 # This Makefile.in is free software; the Free Software Foundation
4 # gives unlimited permission to copy, distribute and modify it.
4 # gives unlimited permission to copy and/or distribute it,
5 # with or without modifications, as long as this notice is preserved.
6
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
9 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10 # PARTICULAR PURPOSE.
511
612
713 SHELL = /bin/sh
2531 includedir = @includedir@
2632 oldincludedir = /usr/include
2733
34 DISTDIR =
35
2836 pkgdatadir = $(datadir)/@PACKAGE@
2937 pkglibdir = $(libdir)/@PACKAGE@
3038 pkgincludedir = $(includedir)/@PACKAGE@
4250 INSTALL_SCRIPT = @INSTALL_SCRIPT@
4351 transform = @program_transform_name@
4452
45 NORMAL_INSTALL = true
46 PRE_INSTALL = true
47 POST_INSTALL = true
48 NORMAL_UNINSTALL = true
49 PRE_UNINSTALL = true
50 POST_UNINSTALL = true
53 NORMAL_INSTALL = :
54 PRE_INSTALL = :
55 POST_INSTALL = :
56 NORMAL_UNINSTALL = :
57 PRE_UNINSTALL = :
58 POST_UNINSTALL = :
5159 CC = @CC@
5260 CURSES_OBJ = @CURSES_OBJ@
5361 GTK_CFLAGS = @GTK_CFLAGS@
6977
7078 TAR = tar
7179 GZIP = --best
72 default: all
80 all: Makefile
7381
7482 .SUFFIXES:
75 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
83 $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
7684 cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps img/Makefile
7785
78 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
86 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
7987 cd $(top_builddir) \
8088 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
8189
110118
111119 uninstall:
112120
113 all: Makefile
114
115121 install-strip:
116122 $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
117123 installdirs:
118124
119125
120126 mostlyclean-generic:
121 test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
127 -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
122128
123129 clean-generic:
124 test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
130 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
125131
126132 distclean-generic:
127 rm -f Makefile $(DISTCLEANFILES)
128 rm -f config.cache config.log stamp-h stamp-h[0-9]*
129 test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
133 -rm -f Makefile $(DISTCLEANFILES)
134 -rm -f config.cache config.log stamp-h stamp-h[0-9]*
135 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
130136
131137 maintainer-clean-generic:
132 test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
133 test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
138 -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
139 -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
134140 mostlyclean: mostlyclean-generic
135141
136142 clean: clean-generic mostlyclean
137143
138144 distclean: distclean-generic clean
139 rm -f config.status
145 -rm -f config.status
140146
141147 maintainer-clean: maintainer-clean-generic distclean
142148 @echo "This command is intended for maintainers to use;"
143149 @echo "it deletes files that may require special tools to rebuild."
144150
145 .PHONY: default tags distdir info dvi installcheck install-exec \
146 install-data install uninstall all installdirs mostlyclean-generic \
147 distclean-generic clean-generic maintainer-clean-generic clean \
148 mostlyclean distclean maintainer-clean
151 .PHONY: tags distdir info dvi installcheck install-exec install-data \
152 install uninstall all installdirs mostlyclean-generic distclean-generic \
153 clean-generic maintainer-clean-generic clean mostlyclean distclean \
154 maintainer-clean
149155
150156
151157 # Tell versions [3.59,3.63) of GNU make to not export all variables.
2121 void mtr_curses_close();
2222 void mtr_curses_redraw();
2323 int mtr_curses_keyaction();
24 void mtr_curses_clear();
0 .TH MTR 8 "December 28, 1997" "mtr" "mtr"
0 .TH MTR 8 "March 4, 1999" "mtr" "mtr"
11
22
33 .SH NAME
77 .SH SYNOPSIS
88 .B mtr
99 [\c
10 .B \-hvrctgi\c
10 .B \-hvrctglsni\c
1111 ]
1212 [\c
1313 .B \-\-help\c
3939 [\c
4040 .B \-\-interval\ SECONDS\c
4141 ]
42 .B HOSTNAME
42 [\c
43 .B \-\-psize\ BYTES | -p BYTES\c
44 ]
45 .B HOSTNAME [PACKETSIZE]
4346
4447
4548 .SH DESCRIPTION
4649
4750 .B mtr
48 combines the functionaly of the
51 combines the functionality of the
4952 .B traceroute
5053 and
5154 .B ping
116119 option.
117120
118121 .TP
122 .B \-p\ BYTES
123 .TP
124 .B \-\-psize\ BYTES
125 .TP
126 .B PACKETSIZE
127 These options or a trailing PACKETSIZE on the commandline sets
128 the packet size used for probing.
129 It is in bytes inclusive IP and ICMP headers
130 .TP
119131 .B \-t
120132 .TP
121133 .B \-\-curses
2828 #include "dns.h"
2929 #include "report.h"
3030 #include "net.h"
31
32
33 #ifndef HAVE_SETEUID
34 /* HPUX doesn't have seteuid, but setuid works fine in that case for us */
35 #define seteuid setuid
36 #endif
3137
3238 int DisplayMode;
3339 int Interactive = 1;
3642 int MaxPing = 16;
3743 float WaitTime = 1.0;
3844 char *Hostname = NULL;
45 char LocalHostname[128];
3946 int dns = 1;
47 int packetsize = MINPACKET;
4048
4149 void parse_arg(int argc, char **argv) {
4250 int opt;
4856 { "curses", 0, 0, 't' },
4957 { "gtk", 0, 0, 'g' },
5058 { "interval", 1, 0, 'i' },
59 { "psize", 1, 0, 'p' },
5160 { "no-dns", 0, 0, 'n' },
5261 { "split", 0, 0, 's' }, /* BL */
5362 { "raw", 0, 0, 'l' },
5665
5766 opt = 0;
5867 while(1) {
59 opt = getopt_long(argc, argv, "hvrc:tklnsi:", long_options, NULL);
68 opt = getopt_long(argc, argv, "hvrc:tklnsi:p:", long_options, NULL);
6069 if(opt == -1)
6170 break;
6271
7180 DisplayMode = DisplayReport;
7281 break;
7382 case 'c':
74 MaxPing = atoi(optarg);
83 MaxPing = atoi (optarg);
84 break;
85 case 'p':
86 packetsize = atoi (optarg);
7587 break;
7688 case 't':
7789 DisplayMode = DisplayCurses;
89101 dns = 0;
90102 break;
91103 case 'i':
92 WaitTime = atof(optarg);
104 WaitTime = atof (optarg);
93105 if (WaitTime <= 0.0) {
94106 fprintf (stderr, "mtr: wait time must be positive\n");
95107 exit (1);
96108 }
109 if (getuid() != 0 && WaitTime < 1.0)
110 WaitTime = 1.0;
97111 break;
98112 }
99113 }
101115 if(DisplayMode == DisplayReport)
102116 Interactive = 0;
103117
104 if(optind != argc - 1)
118 if(optind > argc - 1)
105119 return;
106120
107 Hostname = argv[optind];
121 Hostname = argv[optind++];
122
123 if (argc > optind)
124 packetsize = atoi(argv[optind]);
108125
109126 }
127
128
129 void parse_mtr_options (char *string)
130 {
131 int argc;
132 char *argv[128], *p;
133 int i;
134
135 if (!string) return;
136
137 argv[0] = "mtr";
138 argc = 1;
139 p = strtok (string, " \t");
140 while (p) {
141 argv[argc++] = p;
142 p = strtok (NULL, " \t");
143 }
144 parse_arg (argc, argv);
145 optind = 0;
146 }
147
148
110149
111150 int main(int argc, char **argv) {
112151 int traddr;
130169 }
131170
132171 display_detect(&argc, &argv);
172
173 parse_mtr_options (getenv ("MTR_OPTIONS"));
174
133175 parse_arg(argc, argv);
134176
135177 if(PrintVersion) {
138180 }
139181
140182 if(PrintHelp) {
141 printf("usage: %s [-hvrctlis] [--help] [--version] [--report]\n"
183 printf("usage: %s [-hvrctglsni] [--help] [--version] [--report]\n"
142184 "\t\t[--report-cycles=COUNT] [--curses] [--gtk]\n"
143 "\t\t[--raw] [--split]\n" /* BL */
144 "\t\t[--interval=SECONDS] HOSTNAME\n", argv[0]);
185 "\t\t[--raw] [--split] [--no-dns]\n" /* BL */
186 "\t\t[--psize=bytes/-p=bytes]\n" /* ok */
187 "\t\t[--interval=SECONDS] HOSTNAME [PACKETSIZE]\n", argv[0]);
145188 exit(0);
146189 }
147190 if (Hostname == NULL) Hostname = "localhost";
191
192 if(gethostname(LocalHostname, sizeof(LocalHostname))) {
193 strcpy(LocalHostname, "UNKNOWNHOST");
194 }
148195
149196 if(net_preopen_result != 0) {
150197 printf("mtr: Unable to get raw socket. (Executable not suid?)\n");
172219 display_open();
173220 dns_open();
174221
222 display_mode = 0;
175223 display_loop();
176224
177225 net_end_transit();
+213
-157
net.c less more
1414 You should have received a copy of the GNU General Public License
1515 along with this program; if not, write to the Free Software
1616 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 1999-08-13 ok Olav@okvittem.priv.no added -psize
19
1720 */
1821
1922 #include <config.h>
3033 #include <unistd.h>
3134 #include <stdio.h>
3235 #include <math.h>
36 #include <errno.h>
3337
3438 #include "net.h"
3539
3640
37 extern float WaitTime, DeltaTime;
3841
3942 #define MaxTransit 4
4043
4245 the fields have different names between, for instance, Linux and
4346 Solaris */
4447 struct ICMPHeader {
45 unsigned char type;
46 unsigned char code;
47 unsigned short checksum;
48 unsigned short id;
49 unsigned short sequence;
48 uint8 type;
49 uint8 code;
50 uint16 checksum;
51 uint16 id;
52 uint16 sequence;
5053 };
5154
5255 /* Structure of an IP header. */
6568
6669 #define ICMP_ECHO 8
6770 #define ICMP_ECHOREPLY 0
71
72 #define ICMP_TSTAMP 13
73 #define ICMP_TSTAMPREPLY 14
74
6875 #define ICMP_TIME_EXCEEDED 11
69
76
7077 #ifndef SOL_IP
7178 #define SOL_IP 0
7279 #endif
73
74 struct packetdata {
75 int index;
76 int ttl;
77 int sec;
78 int msec;
79 };
80
81
8082
8183 struct nethost {
82 int addr;
84 uint32 addr;
8385 int xmit;
8486 int returned;
85 int total;
87 long long total;
88 int last;
8689 int best;
8790 int worst;
8891 int transit;
92 int saved[SAVED_PINGS];
8993 };
9094
95 struct sequence {
96 int index;
97 int transit;
98 int saved_seq;
99 struct timeval time;
100 };
101
102
103 /* Configuration parameter: How many queries to unknown hosts do we
104 send? (This limits the amount of traffic generated if a host is not
105 reachable) */
106 #define MAX_UNKNOWN_HOSTS 5
107
108
91109 static struct nethost host[MaxHost];
110 static struct sequence sequence[MaxSequence];
92111 static struct timeval reset = { 0, 0 };
93112
113 int timestamp;
94114 int sendsock;
95115 int recvsock;
96116 struct sockaddr_in remoteaddress;
97
117 static int batch_at = 0;
118
119
120 extern int packetsize;
121 static int numhosts = 10;
122
123 /* return the number of microseconds to wait before sending the next
124 ping */
125 int calc_deltatime (float waittime)
126 {
127 waittime /= numhosts;
128 return 1000000 * waittime;
129 }
130
131
132 /* This doesn't work for odd sz. I don't know enough about this to say
133 that this is wrong. It doesn't seem to cripple mtr though. -- REW */
98134 int checksum(void *data, int sz) {
99135 unsigned short *ch;
100136 unsigned int sum;
111147 return (~sum & 0xffff);
112148 }
113149
114 void net_send_ping(int index) {
115 char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)
116 + sizeof(struct packetdata)];
150
151 static int BSDfix = 0;
152
153 int new_sequence(int index) {
154 static int next_sequence = 0;
155 int seq;
156
157 seq = next_sequence++;
158 if(next_sequence >= MaxSequence)
159 next_sequence = 0;
160
161 sequence[seq].index = index;
162 sequence[seq].transit = 1;
163 sequence[seq].saved_seq = ++host[index].xmit;
164 memset(&sequence[seq].time, 0, sizeof(sequence[seq].time));
165
166 host[index].transit = 1;
167 net_save_xmit(index);
168
169 return seq;
170 }
171
172 /* Attempt to find the host at a particular number of hops away */
173 void net_send_query(int index) {
174 /*ok char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader)];*/
175 char packet[MAXPACKET];
117176 struct IPHeader *ip;
118177 struct ICMPHeader *icmp;
119 struct packetdata *data;
120 int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata);
121 struct sockaddr_in addr;
122 struct timeval now;
123
124 memset(&addr, 0, sizeof(struct sockaddr_in));
125 addr.sin_family = AF_INET;
126 addr.sin_addr.s_addr = host[index].addr;
127 host[index].xmit++;
128 host[index].transit = 1;
129
178
179 /*ok int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + datasize;*/
180 int rv;
181 static int first=1;
182
183 if ( packetsize < MINPACKET ) packetsize = MINPACKET;
184 if ( packetsize > MAXPACKET ) packetsize = MAXPACKET;
130185 memset(packet, 0, packetsize);
131186
132187 ip = (struct IPHeader *)packet;
133188 icmp = (struct ICMPHeader *)(packet + sizeof(struct IPHeader));
134 data = (struct packetdata *)(packet + sizeof(struct IPHeader) + sizeof(struct ICMPHeader));
135189
136190 ip->version = 0x45;
137191 ip->tos = 0;
138 ip->len = htons (packetsize);
192 ip->len = BSDfix ? packetsize: htons (packetsize);
139193 ip->id = 0;
140194 ip->frag = 0;
141 ip->ttl = 127;
142 ip->protocol = IPPROTO_ICMP;
143 ip->saddr = 0;
144 ip->daddr = host[index].addr;
145
146 icmp->type = ICMP_ECHO;
147 icmp->id = getpid();
148 icmp->sequence = 0;
149
150 data->ttl = 0;
151 data->index = index;
152
153 gettimeofday(&now, NULL);
154 data->sec = now.tv_sec;
155 data->msec = now.tv_usec / 1000;
156
157 icmp->checksum = checksum(icmp, packetsize - sizeof(struct IPHeader));
158 ip->check = checksum(ip, packetsize);
159
160 sendto(sendsock, packet, packetsize, 0,
161 (struct sockaddr *)&addr, sizeof(addr));
162 }
163
164 /* Attempt to find the host at a particular number of hops away */
165 void net_send_query(int hops) {
166 char packet[sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata)];
167 struct IPHeader *ip;
168 struct ICMPHeader *icmp;
169 struct packetdata *data;
170 int packetsize = sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata);
171
172 memset(packet, 0, packetsize);
173
174 ip = (struct IPHeader *)packet;
175 icmp = (struct ICMPHeader *)(packet + sizeof(struct IPHeader));
176 data = (struct packetdata *)(packet + sizeof(struct IPHeader) + sizeof(struct ICMPHeader));
177
178 ip->version = 0x45;
179 ip->tos = 0;
180 ip->len = htons (packetsize);
181 ip->id = 0;
182 ip->frag = 0;
183 ip->ttl = hops;
195 ip->ttl = index + 1;
184196 ip->protocol = IPPROTO_ICMP;
185197 ip->saddr = 0;
186198 ip->daddr = remoteaddress.sin_addr.s_addr;
187199
188200 icmp->type = ICMP_ECHO;
189201 icmp->id = getpid();
190 icmp->sequence = hops;
191
192 data->ttl = hops;
193 data->index = -1;
202 icmp->sequence = new_sequence(index);
194203
195204 icmp->checksum = checksum(icmp, packetsize - sizeof(struct IPHeader));
196205 ip->check = checksum(ip, packetsize);
197206
198 sendto(sendsock, packet, packetsize, 0,
207 gettimeofday(&sequence[icmp->sequence].time, NULL);
208 rv = sendto(sendsock, packet, packetsize, 0,
199209 (struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
200 }
201
202 void net_process_ping(struct packetdata *data, struct sockaddr_in *addr) {
203 int at;
204 struct timeval now;
205 int totmsec;
206
207 if(data->index >= 0) {
208 gettimeofday(&now, NULL);
209
210 if(data->sec < reset.tv_sec
211 || (data->sec == reset.tv_sec && (1000*data->msec) < reset.tv_usec))
212 /* discard this data point, stats were reset after it was generated */
213 return;
214
215 totmsec = (now.tv_sec - data->sec) * 1000 +
216 ((now.tv_usec/1000) - data->msec);
217
218 if(host[data->index].returned <= 0) {
219 host[data->index].best = host[data->index].worst = totmsec;
210 if (first && (rv < 0) && (errno == EINVAL)) {
211 ip->len = packetsize;
212 rv = sendto(sendsock, packet, packetsize, 0,
213 (struct sockaddr *)&remoteaddress, sizeof(remoteaddress));
214 if (rv >= 0) {
215 fprintf (stderr, "You've got a broken (FreeBSD?) system\n");
216 BSDfix = 1;
220217 }
221
222 if(totmsec < host[data->index].best)
223 host[data->index].best = totmsec;
224
225 if(totmsec > host[data->index].worst)
226 host[data->index].worst = totmsec;
227
228 display_rawping (data->index, totmsec);
229
230 host[data->index].total += totmsec;
231 host[data->index].returned++;
232 host[data->index].transit = 0;
233 } else {
234 at = data->ttl - 1;
235 if(at < 0 || at > MaxHost)
236 return;
237
238 host[at].addr = addr->sin_addr.s_addr;
239 display_rawhost (at, host[at].addr);
240 }
241 }
242
218 }
219 first = 0;
220 }
221
222 /* We got a return on something we sent out. Record the address and
223 time. */
224 void net_process_ping(int seq, uint32 addr, struct timeval now) {
225 int index;
226 int totusec;
227
228 if(seq < 0 || seq >= MaxSequence)
229 return;
230
231 if(!sequence[seq].transit)
232 return;
233 sequence[seq].transit = 0;
234
235 index = sequence[seq].index;
236
237 totusec = (now.tv_sec - sequence[seq].time.tv_sec ) * 1000000 +
238 (now.tv_usec - sequence[seq].time.tv_usec);
239
240 if(host[index].addr == 0) {
241 host[index].addr = addr;
242 display_rawhost(index, host[index].addr);
243 }
244 if(host[index].returned <= 0) {
245 host[index].best = host[index].worst = totusec;
246 }
247 host[index].last = totusec;
248 if(totusec < host[index].best)
249 host[index].best = totusec;
250 if(totusec > host[index].worst)
251 host[index].worst = totusec;
252
253 host[index].total += totusec;
254 host[index].returned++;
255 host[index].transit = 0;
256
257 net_save_return(index, sequence[seq].saved_seq, totusec);
258 display_rawping(index, totusec);
259 }
260
261 /* We know a packet has come in, because the main select loop has called us,
262 now we just need to read it, see if it is for us, and if it is a reply
263 to something we sent, then call net_process_ping() */
243264 void net_process_return() {
244265 char packet[2048];
245266 struct sockaddr_in fromaddr;
247268 int num;
248269 int at;
249270 struct ICMPHeader *header;
271 struct timeval now;
272
273 gettimeofday(&now, NULL);
250274
251275 fromaddrsize = sizeof(fromaddr);
252276 num = recvfrom(recvsock, packet, 2048, 0,
253277 (struct sockaddr *)&fromaddr, &fromaddrsize);
254278
255 if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) + sizeof(struct packetdata))
279 if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
256280 return;
257281
258282 header = (struct ICMPHeader *)(packet + sizeof(struct IPHeader));
260284 if(header->id != getpid())
261285 return;
262286
263 net_process_ping((struct packetdata *)(packet + sizeof(struct IPHeader) +
264 sizeof(struct ICMPHeader)),
265 &fromaddr);
287 net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
266288 } else if(header->type == ICMP_TIME_EXCEEDED) {
267289 if(num < sizeof(struct IPHeader) + sizeof(struct ICMPHeader) +
268290 sizeof(struct IPHeader) + sizeof(struct ICMPHeader))
272294 sizeof(struct ICMPHeader) + sizeof(struct IPHeader));
273295 if(header->id != getpid())
274296 return;
275
276 at = header->sequence - 1;
277 if(at < 0 || at > MaxHost)
278 return;
279
280 host[at].addr = fromaddr.sin_addr.s_addr;
281 display_rawhost (at, net_addr(at));
297
298 net_process_ping(header->sequence, fromaddr.sin_addr.s_addr, now);
282299 }
283300 }
284301
287304 }
288305
289306 int net_percent(int at) {
290 if(host[at].xmit == 0)
307 if((host[at].xmit - host[at].transit) == 0)
291308 return 0;
292309
293 return 100 - (100 * (host[at].returned + host[at].transit) / host[at].xmit);
310 return 100 - (100 * host[at].returned / (host[at].xmit - host[at].transit));
311 }
312
313 int net_last(int at) {
314 return host[at].last;
294315 }
295316
296317 int net_best(int at) {
313334 int max;
314335
315336 max = 0;
316 for(at = 0; at < MaxHost; at++) {
337 for(at = 0; at < MaxHost-2; at++) {
317338 if(host[at].addr == remoteaddress.sin_addr.s_addr) {
318339 return at + 1;
319340 } else if(host[at].addr != 0) {
347368
348369
349370 int net_send_batch() {
350 static int n_unknown = 10;
351 static int at;
352
353 if(host[at].addr == 0) {
354 net_send_query(at + 1);
355 n_unknown--;
356 } else {
357 net_send_ping(at);
358 }
359
360 if ((host[at].addr == remoteaddress.sin_addr.s_addr) ||
361 (n_unknown == 0)) {
362 DeltaTime = WaitTime / (float) (at+1);
363 at = 0;
364 n_unknown = 10;
371 int n_unknown, i;
372
373 net_send_query(batch_at);
374
375 n_unknown = 0;
376
377 for (i=0;i<batch_at;i++) {
378 if (host[i].addr == 0)
379 n_unknown++;
380 if (host[i].addr == remoteaddress.sin_addr.s_addr)
381 n_unknown = 100; /* Make sure we drop into "we should restart" */
382 }
383
384 if ((host[batch_at].addr == remoteaddress.sin_addr.s_addr) ||
385 (n_unknown > MAX_UNKNOWN_HOSTS) ||
386 (batch_at >= MaxHost-2)) {
387 numhosts = batch_at+1;
388 batch_at = 0;
365389 return 1;
366390 }
367391
368 at++;
392 batch_at++;
369393 return 0;
370394 }
371395
395419 }
396420
397421 int net_open(int addr) {
422 net_reset();
423
398424 remoteaddress.sin_family = AF_INET;
399425 remoteaddress.sin_addr.s_addr = addr;
400426
401 net_send_batch();
402
403427 return 0;
404428 }
405429
419443
420444 void net_reset() {
421445 int at;
446 int i;
447
448 batch_at = 0;
449 numhosts = 10;
422450
423451 for(at = 0; at < MaxHost; at++) {
424 host[at].xmit = host[at].transit;
452 host[at].xmit = 0;
453 host[at].transit = 0;
425454 host[at].returned = 0;
426455 host[at].total = 0;
427456 host[at].best = 0;
428457 host[at].worst = 0;
429 }
458 for (i=0; i<SAVED_PINGS; i++) {
459 host[at].saved[i] = -2; /* unsent */
460 }
461 }
462
463 for(at = 0; at < MaxSequence; at++) {
464 sequence[at].transit = 0;
465 }
466
430467 gettimeofday(&reset, NULL);
431468 }
432469
440477 }
441478
442479
480 int* net_saved_pings(int at) {
481 return host[at].saved;
482 }
483
484 void net_save_xmit(int at) {
485 int tmp[SAVED_PINGS];
486 memcpy(tmp, &host[at].saved[1], (SAVED_PINGS-1)*sizeof(int));
487 memcpy(host[at].saved, tmp, (SAVED_PINGS-1)*sizeof(int));
488 host[at].saved[SAVED_PINGS-1] = -1;
489 }
490
491 void net_save_return(int at, int seq, int ms) {
492 int idx;
493 idx = SAVED_PINGS - (host[at].xmit - seq) - 1;
494 if (idx < 0) {
495 return;
496 }
497 host[at].saved[idx] = ms;
498 }
3434 int net_send_batch();
3535 void net_end_transit();
3636
37 int calc_deltatime (float WaitTime);
38
39
3740 /* Added by Brian Casey, December 1997 bcasey@imagiware.com*/
3841 int net_returned(int at);
3942 int net_xmit(int at);
4043 int net_transit(int at);
4144
45 #define SAVED_PINGS 50
46 int* net_saved_pings(int at);
47 void net_save_xmit(int at);
48 void net_save_return(int at, int seq, int ms);
49 int net_duplicate(int at, int seq);
4250
4351 #define MaxHost 256
52 #define MaxSequence 65536
53
54 #define MAXPACKET 4096
55 #define MINPACKET 64
3030 extern int dns;
3131
3232 void report_open() {
33 printf("%-40s LOSS RCVD SENT BEST AVG WORST\n", "HOST");
33 printf("%-38s LOSS RCVD SENT BEST AVG WORST\n", "HOST");
3434 fflush(stdout);
3535 }
3636
6161 }
6262 }
6363
64 printf("%-40s%5d%%%6d%5d%6d%6d%6d\n", name,
64 /* Coding tip:
65
66 NEVER EVER use a format like "%6d%6d%6d". This will nicely
67 format your three numbers in 18 spaces just like " %5d %5d %5d"
68 and save you three bytes of static string space. However, when
69 the numbers suddenly become a bit larger than you expected
70 you'll end up with unexpected results: just one huge number
71 instead of three separate numbers. This especially matters if
72 the reader of the info is a program and not human. */
73
74 printf("%-38s %4d%% %5d %4d %7.2f %7.2f %7.2f\n", name,
6575 net_percent(at),
6676 net_returned(at), net_xmit(at),
67 net_best(at), net_avg(at), net_worst(at));
77 net_best(at)/1000.0, net_avg(at)/1000.0, net_worst(at)/1000.0);
6878 }
6979 }
7080
3131 extern int Interactive;
3232 extern int MaxPing;
3333 extern float WaitTime;
34 float DeltaTime;
3534 double dnsinterval;
3635
3736 static struct timeval intervaltime;
37
3838
3939 void select_loop() {
4040 fd_set readfd;
4242 int action, maxfd;
4343 int dnsfd, netfd;
4444 int NumPing;
45 int paused;
4546 struct timeval lasttime, thistime, selecttime;
4647 float wt;
48 int dt;
4749
48 NumPing = 0;
50 NumPing = 0;
4951 anyset = 0;
5052 gettimeofday(&lasttime, NULL);
51 DeltaTime = WaitTime/10;
53 paused=0;
5254
5355 while(1) {
54 intervaltime.tv_sec = DeltaTime;
55 intervaltime.tv_usec = 1000000 *( DeltaTime - floor (DeltaTime));
56 dt = calc_deltatime (WaitTime);
57 intervaltime.tv_sec = dt / 1000000;
58 intervaltime.tv_usec = dt % 1000000;
5659
5760 FD_ZERO(&readfd);
5861
7376 if(netfd >= maxfd)
7477 maxfd = netfd + 1;
7578
76 if(anyset) {
79 if(anyset || paused) {
7780 selecttime.tv_sec = 0;
7881 selecttime.tv_usec = 0;
7982
133136 if(action == ActionReset)
134137 net_reset();
135138
139 if (action == ActionDisplay)
140 display_mode = (display_mode+1) % 3;
141
142 if (action == ActionClear)
143 display_clear();
144
145 if (action == ActionPause)
146 paused=1;
147
148 if (action == ActionResume)
149 paused=0;
150
136151 anyset = 1;
137152 }
138153
3030 #include "net.h"
3131 #include "split.h"
3232 */
33
34 #include <config.h>
35
36 #ifdef NO_CURSES
37 #include <sys/time.h>
38 #include <sys/types.h>
39 #include <unistd.h>
40 #else
41 /* Use the curses variant */
42
43 #if defined(HAVE_NCURSES_H)
44 # include <ncurses.h>
45 #elif defined(HAVE_NCURSES_CURSES_H)
46 # include <ncurses/curses.h>
47 #elif defined(HAVE_CURSES_H)
48 # include <curses.h>
49 #else
50 # error No curses header file available
51 #endif
52
53 #endif
3354
3455
3556 extern char *Hostname;
79100 if(name != NULL) {
80101 /* May be we should test name's length */
81102 sprintf(newLine, "%s %d %d %d %d %d %d", name,
82 net_percent(at),
83 net_returned(at), net_xmit(at),
84 net_best(at), net_avg(at), net_worst(at));
103 net_percent(at),
104 net_returned(at), net_xmit(at),
105 net_best(at) /1000, net_avg(at)/1000,
106 net_worst(at)/1000);
85107 } else {
86108 sprintf(newLine, "%d.%d.%d.%d %d %d %d %d %d %d",
87 (addr >> 24) & 0xff, (addr >> 16) & 0xff,
88 (addr >> 8) & 0xff, addr & 0xff,
89 net_percent(at),
90 net_returned(at), net_xmit(at),
91 net_best(at), net_avg(at), net_worst(at));
109 (addr >> 24) & 0xff, (addr >> 16) & 0xff,
110 (addr >> 8) & 0xff, addr & 0xff,
111 net_percent(at),
112 net_returned(at), net_xmit(at),
113 net_best(at) /1000, net_avg(at)/1000,
114 net_worst(at)/1000);
92115 }
93116 } else {
94117 sprintf(newLine, "???");
131154
132155 int
133156 split_keyaction() {
157 #ifdef NO_CURSES
158 fd_set readfds;
159 struct timeval tv;
160 char c;
161
162 FD_ZERO (&readfds);
163 FD_SET (0, &readfds);
164 tv.tv_sec = 0;
165 tv.tv_usec = 0;
166
167 if (select (1, &readfds, NULL, NULL, &tv) > 0) {
168 read (0, &c, 1);
169 } else
170 return 0;
171 #else
134172 char c = getch();
173 #endif
135174
136175 #if DEBUG
137176 printf("split_keyaction()\n");