git-svn: trunk@4846
Török Edvin authored on 2009/02/23 21:35:34... | ... |
@@ -1,3 +1,11 @@ |
1 |
+Sat Feb 21 21:48:43 EET 2009 (edwin) |
|
2 |
+------------------------------------ |
|
3 |
+ * Makefile.in, clamav-config.h.in, clamav-milter/, clamconf/, |
|
4 |
+ clamd/, clamdscan/, clamdtop/, clamscan/, configure, configure.in, |
|
5 |
+ contrib/, database/, docs/, etc/, freshclam/, libclamav/, libltdl/, |
|
6 |
+ m4/, shared/, sigtool/, test/, unit_tests/: clamdtop moved to |
|
7 |
+ toplevel |
|
8 |
+ |
|
1 | 9 |
Sat Feb 21 11:22:15 CET 2009 (acab) |
2 | 10 |
----------------------------------- |
3 | 11 |
* libclamav/nsis: fix race introduced in r4379 |
... | ... |
@@ -18,7 +18,7 @@ |
18 | 18 |
|
19 | 19 |
ACLOCAL_AMFLAGS=-I m4 |
20 | 20 |
|
21 |
-SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test unit_tests |
|
21 |
+SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test unit_tests clamdtop |
|
22 | 22 |
EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.file COPYING.zlib COPYING.BSD COPYING.getopt |
23 | 23 |
|
24 | 24 |
bin_SCRIPTS=clamav-config |
... | ... |
@@ -62,6 +62,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ |
62 | 62 |
$(top_srcdir)/docs/man/clamd.8.in \ |
63 | 63 |
$(top_srcdir)/docs/man/clamd.conf.5.in \ |
64 | 64 |
$(top_srcdir)/docs/man/clamdscan.1.in \ |
65 |
+ $(top_srcdir)/docs/man/clamdtop.1.in \ |
|
65 | 66 |
$(top_srcdir)/docs/man/clamscan.1.in \ |
66 | 67 |
$(top_srcdir)/docs/man/freshclam.1.in \ |
67 | 68 |
$(top_srcdir)/docs/man/freshclam.conf.5.in \ |
... | ... |
@@ -88,7 +89,7 @@ CONFIG_CLEAN_FILES = clamav-config libclamav.pc \ |
88 | 88 |
docs/man/clamav-milter.8 docs/man/clamconf.1 docs/man/clamd.8 \ |
89 | 89 |
docs/man/clamd.conf.5 docs/man/clamdscan.1 docs/man/clamscan.1 \ |
90 | 90 |
docs/man/freshclam.1 docs/man/freshclam.conf.5 \ |
91 |
- docs/man/sigtool.1 |
|
91 |
+ docs/man/sigtool.1 docs/man/clamdtop.1 |
|
92 | 92 |
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" |
93 | 93 |
binSCRIPT_INSTALL = $(INSTALL_SCRIPT) |
94 | 94 |
SCRIPTS = $(bin_SCRIPTS) |
... | ... |
@@ -144,6 +145,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
144 | 144 |
CLAMD_LIBS = @CLAMD_LIBS@ |
145 | 145 |
CPP = @CPP@ |
146 | 146 |
CPPFLAGS = @CPPFLAGS@ |
147 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
148 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
147 | 149 |
CYGPATH_W = @CYGPATH_W@ |
148 | 150 |
DBDIR = @DBDIR@ |
149 | 151 |
DEFS = @DEFS@ |
... | ... |
@@ -277,7 +280,7 @@ target_vendor = @target_vendor@ |
277 | 277 |
top_builddir = @top_builddir@ |
278 | 278 |
top_srcdir = @top_srcdir@ |
279 | 279 |
ACLOCAL_AMFLAGS = -I m4 |
280 |
-SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test unit_tests |
|
280 |
+SUBDIRS = libltdl libclamav clamscan clamd clamdscan freshclam sigtool clamconf database docs etc clamav-milter test unit_tests clamdtop |
|
281 | 281 |
EXTRA_DIST = FAQ examples BUGS shared libclamav.pc.in UPGRADE COPYING.bzip2 COPYING.lzma COPYING.unrar COPYING.LGPL COPYING.file COPYING.zlib COPYING.BSD COPYING.getopt |
282 | 282 |
bin_SCRIPTS = clamav-config |
283 | 283 |
pkgconfigdir = $(libdir)/pkgconfig |
... | ... |
@@ -404,6 +407,8 @@ docs/man/freshclam.conf.5: $(top_builddir)/config.status $(top_srcdir)/docs/man/ |
404 | 404 |
cd $(top_builddir) && $(SHELL) ./config.status $@ |
405 | 405 |
docs/man/sigtool.1: $(top_builddir)/config.status $(top_srcdir)/docs/man/sigtool.1.in |
406 | 406 |
cd $(top_builddir) && $(SHELL) ./config.status $@ |
407 |
+docs/man/clamdtop.1: $(top_builddir)/config.status $(top_srcdir)/docs/man/clamdtop.1.in |
|
408 |
+ cd $(top_builddir) && $(SHELL) ./config.status $@ |
|
407 | 409 |
install-binSCRIPTS: $(bin_SCRIPTS) |
408 | 410 |
@$(NORMAL_INSTALL) |
409 | 411 |
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" |
... | ... |
@@ -30,6 +30,9 @@ |
30 | 30 |
/* where to look for the config file */ |
31 | 31 |
#undef CONFDIR |
32 | 32 |
|
33 |
+/* curses header location */ |
|
34 |
+#undef CURSES_INCLUDE |
|
35 |
+ |
|
33 | 36 |
/* os is aix */ |
34 | 37 |
#undef C_AIX |
35 | 38 |
|
... | ... |
@@ -223,6 +226,12 @@ |
223 | 223 |
/* Define to 1 if you have the <libmilter/mfapi.h> header file. */ |
224 | 224 |
#undef HAVE_LIBMILTER_MFAPI_H |
225 | 225 |
|
226 |
+/* Define to '1' if you have the ncurses.h library */ |
|
227 |
+#undef HAVE_LIBNCURSES |
|
228 |
+ |
|
229 |
+/* Define to '1' if you have the curses.h library */ |
|
230 |
+#undef HAVE_LIBPDCURSES |
|
231 |
+ |
|
226 | 232 |
/* Define to 1 if you have the `z' library (-lz). */ |
227 | 233 |
#undef HAVE_LIBZ |
228 | 234 |
|
... | ... |
@@ -131,6 +131,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
131 | 131 |
CLAMD_LIBS = @CLAMD_LIBS@ |
132 | 132 |
CPP = @CPP@ |
133 | 133 |
CPPFLAGS = @CPPFLAGS@ |
134 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
135 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
134 | 136 |
CYGPATH_W = @CYGPATH_W@ |
135 | 137 |
DBDIR = @DBDIR@ |
136 | 138 |
DEFS = @DEFS@ |
... | ... |
@@ -112,6 +112,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
112 | 112 |
CLAMD_LIBS = @CLAMD_LIBS@ |
113 | 113 |
CPP = @CPP@ |
114 | 114 |
CPPFLAGS = @CPPFLAGS@ |
115 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
116 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
115 | 117 |
CYGPATH_W = @CYGPATH_W@ |
116 | 118 |
DBDIR = @DBDIR@ |
117 | 119 |
DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
... | ... |
@@ -131,6 +131,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
131 | 131 |
CLAMD_LIBS = @CLAMD_LIBS@ |
132 | 132 |
CPP = @CPP@ |
133 | 133 |
CPPFLAGS = @CPPFLAGS@ |
134 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
135 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
134 | 136 |
CYGPATH_W = @CYGPATH_W@ |
135 | 137 |
DBDIR = @DBDIR@ |
136 | 138 |
DEFS = @DEFS@ |
... | ... |
@@ -123,6 +123,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
123 | 123 |
CLAMD_LIBS = @CLAMD_LIBS@ |
124 | 124 |
CPP = @CPP@ |
125 | 125 |
CPPFLAGS = @CPPFLAGS@ |
126 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
127 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
126 | 128 |
CYGPATH_W = @CYGPATH_W@ |
127 | 129 |
DBDIR = @DBDIR@ |
128 | 130 |
DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
129 | 131 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
0 |
+if HAVE_CURSES |
|
1 |
+bin_PROGRAMS = clamdtop |
|
2 |
+man_MANS = $(top_builddir)/docs/man/clamdtop.1 |
|
3 |
+clamdtop_SOURCES = \ |
|
4 |
+ $(top_srcdir)/shared/optparser.c \ |
|
5 |
+ $(top_srcdir)/shared/optparser.h \ |
|
6 |
+ $(top_srcdir)/shared/getopt.c \ |
|
7 |
+ $(top_srcdir)/shared/getopt.h \ |
|
8 |
+ $(top_srcdir)/shared/misc.c \ |
|
9 |
+ $(top_srcdir)/shared/misc.h \ |
|
10 |
+ clamdtop.c |
|
11 |
+ |
|
12 |
+AM_CPPFLAGS = -I$(top_srcdir) @CURSES_CPPFLAGS@ |
|
13 |
+clamdtop_LDADD = @CURSES_LIBS@ $(top_builddir)/libclamav/libclamav_internal_utils.la |
|
14 |
+endif |
|
15 |
+DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
|
16 |
+EXTRA_DIST = clamdtop.c |
0 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,641 @@ |
0 |
+# Makefile.in generated by automake 1.10.1 from Makefile.am. |
|
1 |
+# @configure_input@ |
|
2 |
+ |
|
3 |
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
|
4 |
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
|
5 |
+# This Makefile.in is free software; the Free Software Foundation |
|
6 |
+# gives unlimited permission to copy and/or distribute it, |
|
7 |
+# with or without modifications, as long as this notice is preserved. |
|
8 |
+ |
|
9 |
+# This program is distributed in the hope that it will be useful, |
|
10 |
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
|
11 |
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
12 |
+# PARTICULAR PURPOSE. |
|
13 |
+ |
|
14 |
+@SET_MAKE@ |
|
15 |
+ |
|
16 |
+VPATH = @srcdir@ |
|
17 |
+pkgdatadir = $(datadir)/@PACKAGE@ |
|
18 |
+pkglibdir = $(libdir)/@PACKAGE@ |
|
19 |
+pkgincludedir = $(includedir)/@PACKAGE@ |
|
20 |
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd |
|
21 |
+install_sh_DATA = $(install_sh) -c -m 644 |
|
22 |
+install_sh_PROGRAM = $(install_sh) -c |
|
23 |
+install_sh_SCRIPT = $(install_sh) -c |
|
24 |
+INSTALL_HEADER = $(INSTALL_DATA) |
|
25 |
+transform = $(program_transform_name) |
|
26 |
+NORMAL_INSTALL = : |
|
27 |
+PRE_INSTALL = : |
|
28 |
+POST_INSTALL = : |
|
29 |
+NORMAL_UNINSTALL = : |
|
30 |
+PRE_UNINSTALL = : |
|
31 |
+POST_UNINSTALL = : |
|
32 |
+build_triplet = @build@ |
|
33 |
+host_triplet = @host@ |
|
34 |
+target_triplet = @target@ |
|
35 |
+@HAVE_CURSES_TRUE@bin_PROGRAMS = clamdtop$(EXEEXT) |
|
36 |
+subdir = clamdtop |
|
37 |
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in |
|
38 |
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 |
|
39 |
+am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \ |
|
40 |
+ $(top_srcdir)/m4/argz.m4 $(top_srcdir)/m4/fdpassing.m4 \ |
|
41 |
+ $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ |
|
42 |
+ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \ |
|
43 |
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ |
|
44 |
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ |
|
45 |
+ $(top_srcdir)/m4/mmap_private.m4 $(top_srcdir)/m4/resolv.m4 \ |
|
46 |
+ $(top_srcdir)/configure.in |
|
47 |
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ |
|
48 |
+ $(ACLOCAL_M4) |
|
49 |
+mkinstalldirs = $(install_sh) -d |
|
50 |
+CONFIG_HEADER = $(top_builddir)/clamav-config.h |
|
51 |
+CONFIG_CLEAN_FILES = |
|
52 |
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" |
|
53 |
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) |
|
54 |
+PROGRAMS = $(bin_PROGRAMS) |
|
55 |
+am__clamdtop_SOURCES_DIST = $(top_srcdir)/shared/optparser.c \ |
|
56 |
+ $(top_srcdir)/shared/optparser.h $(top_srcdir)/shared/getopt.c \ |
|
57 |
+ $(top_srcdir)/shared/getopt.h $(top_srcdir)/shared/misc.c \ |
|
58 |
+ $(top_srcdir)/shared/misc.h clamdtop.c |
|
59 |
+@HAVE_CURSES_TRUE@am_clamdtop_OBJECTS = optparser.$(OBJEXT) \ |
|
60 |
+@HAVE_CURSES_TRUE@ getopt.$(OBJEXT) misc.$(OBJEXT) \ |
|
61 |
+@HAVE_CURSES_TRUE@ clamdtop.$(OBJEXT) |
|
62 |
+clamdtop_OBJECTS = $(am_clamdtop_OBJECTS) |
|
63 |
+@HAVE_CURSES_TRUE@clamdtop_DEPENDENCIES = $(top_builddir)/libclamav/libclamav_internal_utils.la |
|
64 |
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) |
|
65 |
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp |
|
66 |
+am__depfiles_maybe = depfiles |
|
67 |
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ |
|
68 |
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
|
69 |
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
|
70 |
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ |
|
71 |
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) |
|
72 |
+CCLD = $(CC) |
|
73 |
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ |
|
74 |
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ |
|
75 |
+ $(LDFLAGS) -o $@ |
|
76 |
+SOURCES = $(clamdtop_SOURCES) |
|
77 |
+DIST_SOURCES = $(am__clamdtop_SOURCES_DIST) |
|
78 |
+man1dir = $(mandir)/man1 |
|
79 |
+NROFF = nroff |
|
80 |
+MANS = $(man_MANS) |
|
81 |
+ETAGS = etags |
|
82 |
+CTAGS = ctags |
|
83 |
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) |
|
84 |
+ACLOCAL = @ACLOCAL@ |
|
85 |
+AMTAR = @AMTAR@ |
|
86 |
+AR = @AR@ |
|
87 |
+ARGZ_H = @ARGZ_H@ |
|
88 |
+AUTOCONF = @AUTOCONF@ |
|
89 |
+AUTOHEADER = @AUTOHEADER@ |
|
90 |
+AUTOMAKE = @AUTOMAKE@ |
|
91 |
+AWK = @AWK@ |
|
92 |
+CC = @CC@ |
|
93 |
+CCDEPMODE = @CCDEPMODE@ |
|
94 |
+CFGDIR = @CFGDIR@ |
|
95 |
+CFLAGS = @CFLAGS@ |
|
96 |
+CHECK_CPPFLAGS = @CHECK_CPPFLAGS@ |
|
97 |
+CHECK_LIBS = @CHECK_LIBS@ |
|
98 |
+CLAMAVGROUP = @CLAMAVGROUP@ |
|
99 |
+CLAMAVUSER = @CLAMAVUSER@ |
|
100 |
+CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
|
101 |
+CLAMD_LIBS = @CLAMD_LIBS@ |
|
102 |
+CPP = @CPP@ |
|
103 |
+CPPFLAGS = @CPPFLAGS@ |
|
104 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
105 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
106 |
+CYGPATH_W = @CYGPATH_W@ |
|
107 |
+DBDIR = @DBDIR@ |
|
108 |
+DEFS = @DEFS@ -DCL_NOTHREADS -DCL_NOLIBCLAMAV |
|
109 |
+DEPDIR = @DEPDIR@ |
|
110 |
+DSYMUTIL = @DSYMUTIL@ |
|
111 |
+DUMPBIN = @DUMPBIN@ |
|
112 |
+ECHO_C = @ECHO_C@ |
|
113 |
+ECHO_N = @ECHO_N@ |
|
114 |
+ECHO_T = @ECHO_T@ |
|
115 |
+EGREP = @EGREP@ |
|
116 |
+EXEEXT = @EXEEXT@ |
|
117 |
+FGREP = @FGREP@ |
|
118 |
+FRESHCLAM_LIBS = @FRESHCLAM_LIBS@ |
|
119 |
+GCOV = @GCOV@ |
|
120 |
+GENHTML = @GENHTML@ |
|
121 |
+GETENT = @GETENT@ |
|
122 |
+GPERF = @GPERF@ |
|
123 |
+GREP = @GREP@ |
|
124 |
+INCLTDL = @INCLTDL@ |
|
125 |
+INSTALL = @INSTALL@ |
|
126 |
+INSTALL_DATA = @INSTALL_DATA@ |
|
127 |
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
|
128 |
+INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
|
129 |
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ |
|
130 |
+LCOV = @LCOV@ |
|
131 |
+LD = @LD@ |
|
132 |
+LDFLAGS = @LDFLAGS@ |
|
133 |
+LIBADD_DL = @LIBADD_DL@ |
|
134 |
+LIBADD_DLD_LINK = @LIBADD_DLD_LINK@ |
|
135 |
+LIBADD_DLOPEN = @LIBADD_DLOPEN@ |
|
136 |
+LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@ |
|
137 |
+LIBBZ2 = @LIBBZ2@ |
|
138 |
+LIBBZ2_PREFIX = @LIBBZ2_PREFIX@ |
|
139 |
+LIBCLAMAV_LIBS = @LIBCLAMAV_LIBS@ |
|
140 |
+LIBCLAMAV_VERSION = @LIBCLAMAV_VERSION@ |
|
141 |
+LIBLTDL = @LIBLTDL@ |
|
142 |
+LIBOBJS = @LIBOBJS@ |
|
143 |
+LIBS = @LIBS@ |
|
144 |
+LIBTOOL = @LIBTOOL@ |
|
145 |
+LIPO = @LIPO@ |
|
146 |
+LN_S = @LN_S@ |
|
147 |
+LTDLDEPS = @LTDLDEPS@ |
|
148 |
+LTDLINCL = @LTDLINCL@ |
|
149 |
+LTDLOPEN = @LTDLOPEN@ |
|
150 |
+LTLIBBZ2 = @LTLIBBZ2@ |
|
151 |
+LTLIBOBJS = @LTLIBOBJS@ |
|
152 |
+LT_CONFIG_H = @LT_CONFIG_H@ |
|
153 |
+LT_DLLOADERS = @LT_DLLOADERS@ |
|
154 |
+LT_DLPREOPEN = @LT_DLPREOPEN@ |
|
155 |
+MAINT = @MAINT@ |
|
156 |
+MAKEINFO = @MAKEINFO@ |
|
157 |
+MKDIR_P = @MKDIR_P@ |
|
158 |
+NM = @NM@ |
|
159 |
+NMEDIT = @NMEDIT@ |
|
160 |
+OBJDUMP = @OBJDUMP@ |
|
161 |
+OBJEXT = @OBJEXT@ |
|
162 |
+OTOOL = @OTOOL@ |
|
163 |
+OTOOL64 = @OTOOL64@ |
|
164 |
+PACKAGE = @PACKAGE@ |
|
165 |
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ |
|
166 |
+PACKAGE_NAME = @PACKAGE_NAME@ |
|
167 |
+PACKAGE_STRING = @PACKAGE_STRING@ |
|
168 |
+PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
|
169 |
+PACKAGE_VERSION = @PACKAGE_VERSION@ |
|
170 |
+PATH_SEPARATOR = @PATH_SEPARATOR@ |
|
171 |
+RANLIB = @RANLIB@ |
|
172 |
+SED = @SED@ |
|
173 |
+SET_MAKE = @SET_MAKE@ |
|
174 |
+SHELL = @SHELL@ |
|
175 |
+STRIP = @STRIP@ |
|
176 |
+THREAD_LIBS = @THREAD_LIBS@ |
|
177 |
+TH_SAFE = @TH_SAFE@ |
|
178 |
+VERSION = @VERSION@ |
|
179 |
+VERSIONSCRIPTFLAG = @VERSIONSCRIPTFLAG@ |
|
180 |
+abs_builddir = @abs_builddir@ |
|
181 |
+abs_srcdir = @abs_srcdir@ |
|
182 |
+abs_top_builddir = @abs_top_builddir@ |
|
183 |
+abs_top_srcdir = @abs_top_srcdir@ |
|
184 |
+ac_ct_CC = @ac_ct_CC@ |
|
185 |
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ |
|
186 |
+am__include = @am__include@ |
|
187 |
+am__leading_dot = @am__leading_dot@ |
|
188 |
+am__quote = @am__quote@ |
|
189 |
+am__tar = @am__tar@ |
|
190 |
+am__untar = @am__untar@ |
|
191 |
+bindir = @bindir@ |
|
192 |
+build = @build@ |
|
193 |
+build_alias = @build_alias@ |
|
194 |
+build_cpu = @build_cpu@ |
|
195 |
+build_os = @build_os@ |
|
196 |
+build_vendor = @build_vendor@ |
|
197 |
+builddir = @builddir@ |
|
198 |
+datadir = @datadir@ |
|
199 |
+datarootdir = @datarootdir@ |
|
200 |
+docdir = @docdir@ |
|
201 |
+dvidir = @dvidir@ |
|
202 |
+exec_prefix = @exec_prefix@ |
|
203 |
+host = @host@ |
|
204 |
+host_alias = @host_alias@ |
|
205 |
+host_cpu = @host_cpu@ |
|
206 |
+host_os = @host_os@ |
|
207 |
+host_vendor = @host_vendor@ |
|
208 |
+htmldir = @htmldir@ |
|
209 |
+includedir = @includedir@ |
|
210 |
+infodir = @infodir@ |
|
211 |
+install_sh = @install_sh@ |
|
212 |
+libdir = @libdir@ |
|
213 |
+libexecdir = @libexecdir@ |
|
214 |
+localedir = @localedir@ |
|
215 |
+localstatedir = @localstatedir@ |
|
216 |
+lt_ECHO = @lt_ECHO@ |
|
217 |
+ltdl_LIBOBJS = @ltdl_LIBOBJS@ |
|
218 |
+ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ |
|
219 |
+mandir = @mandir@ |
|
220 |
+mkdir_p = @mkdir_p@ |
|
221 |
+oldincludedir = @oldincludedir@ |
|
222 |
+pdfdir = @pdfdir@ |
|
223 |
+prefix = @prefix@ |
|
224 |
+program_transform_name = @program_transform_name@ |
|
225 |
+psdir = @psdir@ |
|
226 |
+sbindir = @sbindir@ |
|
227 |
+sharedstatedir = @sharedstatedir@ |
|
228 |
+srcdir = @srcdir@ |
|
229 |
+sys_symbol_underscore = @sys_symbol_underscore@ |
|
230 |
+sysconfdir = @sysconfdir@ |
|
231 |
+target = @target@ |
|
232 |
+target_alias = @target_alias@ |
|
233 |
+target_cpu = @target_cpu@ |
|
234 |
+target_os = @target_os@ |
|
235 |
+target_vendor = @target_vendor@ |
|
236 |
+top_builddir = @top_builddir@ |
|
237 |
+top_srcdir = @top_srcdir@ |
|
238 |
+@HAVE_CURSES_TRUE@man_MANS = $(top_builddir)/docs/man/clamdtop.1 |
|
239 |
+@HAVE_CURSES_TRUE@clamdtop_SOURCES = \ |
|
240 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/optparser.c \ |
|
241 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/optparser.h \ |
|
242 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/getopt.c \ |
|
243 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/getopt.h \ |
|
244 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/misc.c \ |
|
245 |
+@HAVE_CURSES_TRUE@ $(top_srcdir)/shared/misc.h \ |
|
246 |
+@HAVE_CURSES_TRUE@ clamdtop.c |
|
247 |
+ |
|
248 |
+@HAVE_CURSES_TRUE@AM_CPPFLAGS = -I$(top_srcdir) @CURSES_CPPFLAGS@ |
|
249 |
+@HAVE_CURSES_TRUE@clamdtop_LDADD = @CURSES_LIBS@ $(top_builddir)/libclamav/libclamav_internal_utils.la |
|
250 |
+EXTRA_DIST = clamdtop.c |
|
251 |
+all: all-am |
|
252 |
+ |
|
253 |
+.SUFFIXES: |
|
254 |
+.SUFFIXES: .c .lo .o .obj |
|
255 |
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) |
|
256 |
+ @for dep in $?; do \ |
|
257 |
+ case '$(am__configure_deps)' in \ |
|
258 |
+ *$$dep*) \ |
|
259 |
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ |
|
260 |
+ && exit 0; \ |
|
261 |
+ exit 1;; \ |
|
262 |
+ esac; \ |
|
263 |
+ done; \ |
|
264 |
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign clamdtop/Makefile'; \ |
|
265 |
+ cd $(top_srcdir) && \ |
|
266 |
+ $(AUTOMAKE) --foreign clamdtop/Makefile |
|
267 |
+.PRECIOUS: Makefile |
|
268 |
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
|
269 |
+ @case '$?' in \ |
|
270 |
+ *config.status*) \ |
|
271 |
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ |
|
272 |
+ *) \ |
|
273 |
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ |
|
274 |
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ |
|
275 |
+ esac; |
|
276 |
+ |
|
277 |
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) |
|
278 |
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
|
279 |
+ |
|
280 |
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) |
|
281 |
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
|
282 |
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) |
|
283 |
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh |
|
284 |
+install-binPROGRAMS: $(bin_PROGRAMS) |
|
285 |
+ @$(NORMAL_INSTALL) |
|
286 |
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" |
|
287 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
288 |
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ |
|
289 |
+ if test -f $$p \ |
|
290 |
+ || test -f $$p1 \ |
|
291 |
+ ; then \ |
|
292 |
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
293 |
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ |
|
294 |
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ |
|
295 |
+ else :; fi; \ |
|
296 |
+ done |
|
297 |
+ |
|
298 |
+uninstall-binPROGRAMS: |
|
299 |
+ @$(NORMAL_UNINSTALL) |
|
300 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
301 |
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
302 |
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ |
|
303 |
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \ |
|
304 |
+ done |
|
305 |
+ |
|
306 |
+clean-binPROGRAMS: |
|
307 |
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \ |
|
308 |
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ |
|
309 |
+ echo " rm -f $$p $$f"; \ |
|
310 |
+ rm -f $$p $$f ; \ |
|
311 |
+ done |
|
312 |
+ |
|
313 |
+installcheck-binPROGRAMS: $(bin_PROGRAMS) |
|
314 |
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ |
|
315 |
+ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ |
|
316 |
+ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ |
|
317 |
+ esac; \ |
|
318 |
+ f=`echo "$$p" | \ |
|
319 |
+ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
|
320 |
+ for opt in --help --version; do \ |
|
321 |
+ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ |
|
322 |
+ 2>c$${pid}_.err </dev/null \ |
|
323 |
+ && test -n "`cat c$${pid}_.out`" \ |
|
324 |
+ && test -z "`cat c$${pid}_.err`"; then :; \ |
|
325 |
+ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ |
|
326 |
+ done; \ |
|
327 |
+ done; rm -f c$${pid}_.???; exit $$bad |
|
328 |
+clamdtop$(EXEEXT): $(clamdtop_OBJECTS) $(clamdtop_DEPENDENCIES) |
|
329 |
+ @rm -f clamdtop$(EXEEXT) |
|
330 |
+ $(LINK) $(clamdtop_OBJECTS) $(clamdtop_LDADD) $(LIBS) |
|
331 |
+ |
|
332 |
+mostlyclean-compile: |
|
333 |
+ -rm -f *.$(OBJEXT) |
|
334 |
+ |
|
335 |
+distclean-compile: |
|
336 |
+ -rm -f *.tab.c |
|
337 |
+ |
|
338 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clamdtop.Po@am__quote@ |
|
339 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ |
|
340 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ |
|
341 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optparser.Po@am__quote@ |
|
342 |
+ |
|
343 |
+.c.o: |
|
344 |
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
|
345 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
|
346 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
|
347 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
348 |
+@am__fastdepCC_FALSE@ $(COMPILE) -c $< |
|
349 |
+ |
|
350 |
+.c.obj: |
|
351 |
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` |
|
352 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po |
|
353 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ |
|
354 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
355 |
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` |
|
356 |
+ |
|
357 |
+.c.lo: |
|
358 |
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< |
|
359 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo |
|
360 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ |
|
361 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
362 |
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< |
|
363 |
+ |
|
364 |
+optparser.o: $(top_srcdir)/shared/optparser.c |
|
365 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT optparser.o -MD -MP -MF $(DEPDIR)/optparser.Tpo -c -o optparser.o `test -f '$(top_srcdir)/shared/optparser.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/optparser.c |
|
366 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/optparser.Tpo $(DEPDIR)/optparser.Po |
|
367 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/optparser.c' object='optparser.o' libtool=no @AMDEPBACKSLASH@ |
|
368 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
369 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o optparser.o `test -f '$(top_srcdir)/shared/optparser.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/optparser.c |
|
370 |
+ |
|
371 |
+optparser.obj: $(top_srcdir)/shared/optparser.c |
|
372 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT optparser.obj -MD -MP -MF $(DEPDIR)/optparser.Tpo -c -o optparser.obj `if test -f '$(top_srcdir)/shared/optparser.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/optparser.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/optparser.c'; fi` |
|
373 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/optparser.Tpo $(DEPDIR)/optparser.Po |
|
374 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/optparser.c' object='optparser.obj' libtool=no @AMDEPBACKSLASH@ |
|
375 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
376 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o optparser.obj `if test -f '$(top_srcdir)/shared/optparser.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/optparser.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/optparser.c'; fi` |
|
377 |
+ |
|
378 |
+getopt.o: $(top_srcdir)/shared/getopt.c |
|
379 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.o -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.o `test -f '$(top_srcdir)/shared/getopt.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/getopt.c |
|
380 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po |
|
381 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/getopt.c' object='getopt.o' libtool=no @AMDEPBACKSLASH@ |
|
382 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
383 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.o `test -f '$(top_srcdir)/shared/getopt.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/getopt.c |
|
384 |
+ |
|
385 |
+getopt.obj: $(top_srcdir)/shared/getopt.c |
|
386 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.obj -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.obj `if test -f '$(top_srcdir)/shared/getopt.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/getopt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/getopt.c'; fi` |
|
387 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po |
|
388 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/getopt.c' object='getopt.obj' libtool=no @AMDEPBACKSLASH@ |
|
389 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
390 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.obj `if test -f '$(top_srcdir)/shared/getopt.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/getopt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/getopt.c'; fi` |
|
391 |
+ |
|
392 |
+misc.o: $(top_srcdir)/shared/misc.c |
|
393 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.o -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.o `test -f '$(top_srcdir)/shared/misc.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/misc.c |
|
394 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po |
|
395 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/misc.c' object='misc.o' libtool=no @AMDEPBACKSLASH@ |
|
396 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
397 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.o `test -f '$(top_srcdir)/shared/misc.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/misc.c |
|
398 |
+ |
|
399 |
+misc.obj: $(top_srcdir)/shared/misc.c |
|
400 |
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT misc.obj -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.obj `if test -f '$(top_srcdir)/shared/misc.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/misc.c'; fi` |
|
401 |
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po |
|
402 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/shared/misc.c' object='misc.obj' libtool=no @AMDEPBACKSLASH@ |
|
403 |
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ |
|
404 |
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o misc.obj `if test -f '$(top_srcdir)/shared/misc.c'; then $(CYGPATH_W) '$(top_srcdir)/shared/misc.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/shared/misc.c'; fi` |
|
405 |
+ |
|
406 |
+mostlyclean-libtool: |
|
407 |
+ -rm -f *.lo |
|
408 |
+ |
|
409 |
+clean-libtool: |
|
410 |
+ -rm -rf .libs _libs |
|
411 |
+install-man1: $(man1_MANS) $(man_MANS) |
|
412 |
+ @$(NORMAL_INSTALL) |
|
413 |
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" |
|
414 |
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ |
|
415 |
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ |
|
416 |
+ for i in $$l2; do \ |
|
417 |
+ case "$$i" in \ |
|
418 |
+ *.1*) list="$$list $$i" ;; \ |
|
419 |
+ esac; \ |
|
420 |
+ done; \ |
|
421 |
+ for i in $$list; do \ |
|
422 |
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ |
|
423 |
+ else file=$$i; fi; \ |
|
424 |
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ |
|
425 |
+ case "$$ext" in \ |
|
426 |
+ 1*) ;; \ |
|
427 |
+ *) ext='1' ;; \ |
|
428 |
+ esac; \ |
|
429 |
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ |
|
430 |
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \ |
|
431 |
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ |
|
432 |
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ |
|
433 |
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ |
|
434 |
+ done |
|
435 |
+uninstall-man1: |
|
436 |
+ @$(NORMAL_UNINSTALL) |
|
437 |
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ |
|
438 |
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ |
|
439 |
+ for i in $$l2; do \ |
|
440 |
+ case "$$i" in \ |
|
441 |
+ *.1*) list="$$list $$i" ;; \ |
|
442 |
+ esac; \ |
|
443 |
+ done; \ |
|
444 |
+ for i in $$list; do \ |
|
445 |
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ |
|
446 |
+ case "$$ext" in \ |
|
447 |
+ 1*) ;; \ |
|
448 |
+ *) ext='1' ;; \ |
|
449 |
+ esac; \ |
|
450 |
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ |
|
451 |
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \ |
|
452 |
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ |
|
453 |
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ |
|
454 |
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ |
|
455 |
+ done |
|
456 |
+ |
|
457 |
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) |
|
458 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
459 |
+ unique=`for i in $$list; do \ |
|
460 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
461 |
+ done | \ |
|
462 |
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ |
|
463 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
464 |
+ mkid -fID $$unique |
|
465 |
+tags: TAGS |
|
466 |
+ |
|
467 |
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
|
468 |
+ $(TAGS_FILES) $(LISP) |
|
469 |
+ tags=; \ |
|
470 |
+ here=`pwd`; \ |
|
471 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
472 |
+ unique=`for i in $$list; do \ |
|
473 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
474 |
+ done | \ |
|
475 |
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
|
476 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
477 |
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ |
|
478 |
+ test -n "$$unique" || unique=$$empty_fix; \ |
|
479 |
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ |
|
480 |
+ $$tags $$unique; \ |
|
481 |
+ fi |
|
482 |
+ctags: CTAGS |
|
483 |
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ |
|
484 |
+ $(TAGS_FILES) $(LISP) |
|
485 |
+ tags=; \ |
|
486 |
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ |
|
487 |
+ unique=`for i in $$list; do \ |
|
488 |
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ |
|
489 |
+ done | \ |
|
490 |
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ |
|
491 |
+ END { if (nonempty) { for (i in files) print i; }; }'`; \ |
|
492 |
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \ |
|
493 |
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ |
|
494 |
+ $$tags $$unique |
|
495 |
+ |
|
496 |
+GTAGS: |
|
497 |
+ here=`$(am__cd) $(top_builddir) && pwd` \ |
|
498 |
+ && cd $(top_srcdir) \ |
|
499 |
+ && gtags -i $(GTAGS_ARGS) $$here |
|
500 |
+ |
|
501 |
+distclean-tags: |
|
502 |
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags |
|
503 |
+ |
|
504 |
+distdir: $(DISTFILES) |
|
505 |
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
|
506 |
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ |
|
507 |
+ list='$(DISTFILES)'; \ |
|
508 |
+ dist_files=`for file in $$list; do echo $$file; done | \ |
|
509 |
+ sed -e "s|^$$srcdirstrip/||;t" \ |
|
510 |
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ |
|
511 |
+ case $$dist_files in \ |
|
512 |
+ */*) $(MKDIR_P) `echo "$$dist_files" | \ |
|
513 |
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ |
|
514 |
+ sort -u` ;; \ |
|
515 |
+ esac; \ |
|
516 |
+ for file in $$dist_files; do \ |
|
517 |
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ |
|
518 |
+ if test -d $$d/$$file; then \ |
|
519 |
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ |
|
520 |
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ |
|
521 |
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ |
|
522 |
+ fi; \ |
|
523 |
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ |
|
524 |
+ else \ |
|
525 |
+ test -f $(distdir)/$$file \ |
|
526 |
+ || cp -p $$d/$$file $(distdir)/$$file \ |
|
527 |
+ || exit 1; \ |
|
528 |
+ fi; \ |
|
529 |
+ done |
|
530 |
+check-am: all-am |
|
531 |
+check: check-am |
|
532 |
+all-am: Makefile $(PROGRAMS) $(MANS) |
|
533 |
+installdirs: |
|
534 |
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ |
|
535 |
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ |
|
536 |
+ done |
|
537 |
+install: install-am |
|
538 |
+install-exec: install-exec-am |
|
539 |
+install-data: install-data-am |
|
540 |
+uninstall: uninstall-am |
|
541 |
+ |
|
542 |
+install-am: all-am |
|
543 |
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am |
|
544 |
+ |
|
545 |
+installcheck: installcheck-am |
|
546 |
+install-strip: |
|
547 |
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ |
|
548 |
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ |
|
549 |
+ `test -z '$(STRIP)' || \ |
|
550 |
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install |
|
551 |
+mostlyclean-generic: |
|
552 |
+ |
|
553 |
+clean-generic: |
|
554 |
+ |
|
555 |
+distclean-generic: |
|
556 |
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) |
|
557 |
+ |
|
558 |
+maintainer-clean-generic: |
|
559 |
+ @echo "This command is intended for maintainers to use" |
|
560 |
+ @echo "it deletes files that may require special tools to rebuild." |
|
561 |
+clean: clean-am |
|
562 |
+ |
|
563 |
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am |
|
564 |
+ |
|
565 |
+distclean: distclean-am |
|
566 |
+ -rm -rf ./$(DEPDIR) |
|
567 |
+ -rm -f Makefile |
|
568 |
+distclean-am: clean-am distclean-compile distclean-generic \ |
|
569 |
+ distclean-tags |
|
570 |
+ |
|
571 |
+dvi: dvi-am |
|
572 |
+ |
|
573 |
+dvi-am: |
|
574 |
+ |
|
575 |
+html: html-am |
|
576 |
+ |
|
577 |
+info: info-am |
|
578 |
+ |
|
579 |
+info-am: |
|
580 |
+ |
|
581 |
+install-data-am: install-man |
|
582 |
+ |
|
583 |
+install-dvi: install-dvi-am |
|
584 |
+ |
|
585 |
+install-exec-am: install-binPROGRAMS |
|
586 |
+ |
|
587 |
+install-html: install-html-am |
|
588 |
+ |
|
589 |
+install-info: install-info-am |
|
590 |
+ |
|
591 |
+install-man: install-man1 |
|
592 |
+ |
|
593 |
+install-pdf: install-pdf-am |
|
594 |
+ |
|
595 |
+install-ps: install-ps-am |
|
596 |
+ |
|
597 |
+installcheck-am: installcheck-binPROGRAMS |
|
598 |
+ |
|
599 |
+maintainer-clean: maintainer-clean-am |
|
600 |
+ -rm -rf ./$(DEPDIR) |
|
601 |
+ -rm -f Makefile |
|
602 |
+maintainer-clean-am: distclean-am maintainer-clean-generic |
|
603 |
+ |
|
604 |
+mostlyclean: mostlyclean-am |
|
605 |
+ |
|
606 |
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \ |
|
607 |
+ mostlyclean-libtool |
|
608 |
+ |
|
609 |
+pdf: pdf-am |
|
610 |
+ |
|
611 |
+pdf-am: |
|
612 |
+ |
|
613 |
+ps: ps-am |
|
614 |
+ |
|
615 |
+ps-am: |
|
616 |
+ |
|
617 |
+uninstall-am: uninstall-binPROGRAMS uninstall-man |
|
618 |
+ |
|
619 |
+uninstall-man: uninstall-man1 |
|
620 |
+ |
|
621 |
+.MAKE: install-am install-strip |
|
622 |
+ |
|
623 |
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ |
|
624 |
+ clean-generic clean-libtool ctags distclean distclean-compile \ |
|
625 |
+ distclean-generic distclean-libtool distclean-tags distdir dvi \ |
|
626 |
+ dvi-am html html-am info info-am install install-am \ |
|
627 |
+ install-binPROGRAMS install-data install-data-am install-dvi \ |
|
628 |
+ install-dvi-am install-exec install-exec-am install-html \ |
|
629 |
+ install-html-am install-info install-info-am install-man \ |
|
630 |
+ install-man1 install-pdf install-pdf-am install-ps \ |
|
631 |
+ install-ps-am install-strip installcheck installcheck-am \ |
|
632 |
+ installcheck-binPROGRAMS installdirs maintainer-clean \ |
|
633 |
+ maintainer-clean-generic mostlyclean mostlyclean-compile \ |
|
634 |
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ |
|
635 |
+ tags uninstall uninstall-am uninstall-binPROGRAMS \ |
|
636 |
+ uninstall-man uninstall-man1 |
|
637 |
+ |
|
638 |
+# Tell versions [3.59,3.63) of GNU make to not export all variables. |
|
639 |
+# Otherwise a system limit (for SysV at least) may be exceeded. |
|
640 |
+.NOEXPORT: |
0 | 641 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,1287 @@ |
0 |
+/* |
|
1 |
+ * ClamdTOP |
|
2 |
+ * |
|
3 |
+ * Copyright (C) 2008 - 2009 Sourcefire, Inc. |
|
4 |
+ * |
|
5 |
+ * Authors: Török Edvin |
|
6 |
+ * |
|
7 |
+ * This program is free software; you can redistribute it and/or modify |
|
8 |
+ * it under the terms of the GNU General Public License version 2 as |
|
9 |
+ * published by the Free Software Foundation. |
|
10 |
+ * |
|
11 |
+ * This program is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
+ * GNU General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU General Public License |
|
17 |
+ * along with this program; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
+ * MA 02110-1301, USA. |
|
20 |
+ */ |
|
21 |
+#define _GNU_SOURCE |
|
22 |
+#define __EXTENSIONS |
|
23 |
+#define GCC_PRINTF |
|
24 |
+#define GCC_SCANF |
|
25 |
+ |
|
26 |
+#ifdef HAVE_CONFIG_H |
|
27 |
+#include "clamav-config.h" |
|
28 |
+#endif |
|
29 |
+ |
|
30 |
+#include <unistd.h> |
|
31 |
+#include <stdio.h> |
|
32 |
+#include <stdlib.h> |
|
33 |
+#include <string.h> |
|
34 |
+#include <stdint.h> |
|
35 |
+#include <sys/types.h> |
|
36 |
+#include CURSES_INCLUDE |
|
37 |
+#include <time.h> |
|
38 |
+#include <ctype.h> |
|
39 |
+#include <signal.h> |
|
40 |
+#ifdef _WIN32 |
|
41 |
+#include <windows.h> |
|
42 |
+#include <winsock2.h> |
|
43 |
+/* this is not correct, perhaps winsock errors are not mapped on errno */ |
|
44 |
+#define herror perror |
|
45 |
+#else |
|
46 |
+#include <netdb.h> |
|
47 |
+#include <arpa/inet.h> |
|
48 |
+#include <netinet/in.h> |
|
49 |
+#include <sys/socket.h> |
|
50 |
+#include <sys/un.h> |
|
51 |
+#endif |
|
52 |
+#include <sys/time.h> |
|
53 |
+#include <assert.h> |
|
54 |
+#include <errno.h> |
|
55 |
+ |
|
56 |
+#include "shared/optparser.h" |
|
57 |
+#include "shared/misc.h" |
|
58 |
+ |
|
59 |
+/* Types, prototypes and globals*/ |
|
60 |
+typedef struct connection { |
|
61 |
+ int sd; |
|
62 |
+ const char *remote; |
|
63 |
+ int tcp; |
|
64 |
+ struct timeval tv_conn; |
|
65 |
+ char *version; |
|
66 |
+ int line; |
|
67 |
+} conn_t; |
|
68 |
+ |
|
69 |
+struct global_stats { |
|
70 |
+ struct task *tasks; |
|
71 |
+ ssize_t n; |
|
72 |
+ struct stats *all_stats; |
|
73 |
+ size_t num_clamd; |
|
74 |
+ conn_t *conn; |
|
75 |
+}; |
|
76 |
+ |
|
77 |
+struct stats { |
|
78 |
+ const char *remote; |
|
79 |
+ char *engine_version; |
|
80 |
+ char *db_version; |
|
81 |
+ struct tm db_time; |
|
82 |
+ const char *version; |
|
83 |
+ int stats_unsupp; |
|
84 |
+ uint8_t conn_hr, conn_min, conn_sec; |
|
85 |
+ /* threads - primary */ |
|
86 |
+ unsigned prim_live, prim_idle, prim_max; |
|
87 |
+ /* threads - sum */ |
|
88 |
+ unsigned live, idle, max; |
|
89 |
+ /* queue */ |
|
90 |
+ unsigned biggest_queue, current_q; |
|
91 |
+ double mem;/* in megabytes */ |
|
92 |
+ unsigned long lheapu, lmmapu, ltotalu, ltotalf, lreleasable, lpoolu, lpoolt; |
|
93 |
+ unsigned pools_cnt; |
|
94 |
+}; |
|
95 |
+ |
|
96 |
+static void cleanup(void); |
|
97 |
+static int send_string_noreconn(conn_t *conn, const char *cmd); |
|
98 |
+static void send_string(conn_t *conn, const char *cmd); |
|
99 |
+static void read_version(conn_t *conn); |
|
100 |
+ |
|
101 |
+enum exit_reason { |
|
102 |
+ FAIL_CMDLINE=1, |
|
103 |
+ FAIL_INITIAL_CONN, |
|
104 |
+ OUT_OF_MEMORY, |
|
105 |
+ RECONNECT_FAIL, |
|
106 |
+ SIGINT_REASON |
|
107 |
+}; |
|
108 |
+ |
|
109 |
+static void exit_program(enum exit_reason reason, const char *func, unsigned line); |
|
110 |
+#define EXIT_PROGRAM(r) exit_program(r, __PRETTY_FUNCTION__, __LINE__); |
|
111 |
+#define OOM_CHECK(p) do { if (!p) EXIT_PROGRAM(OUT_OF_MEMORY); } while (0) |
|
112 |
+ |
|
113 |
+ |
|
114 |
+static struct global_stats global; |
|
115 |
+static int curses_inited = 1; |
|
116 |
+static int maxystats=0; |
|
117 |
+static int detail_selected = -1; |
|
118 |
+ |
|
119 |
+static int detail_exists(void) |
|
120 |
+{ |
|
121 |
+ return global.num_clamd != 1; |
|
122 |
+} |
|
123 |
+ |
|
124 |
+static int detail_is_selected(int idx) |
|
125 |
+{ |
|
126 |
+ if (!detail_exists()) { |
|
127 |
+ assert(idx == 0); |
|
128 |
+ return 1; |
|
129 |
+ } |
|
130 |
+ return idx == detail_selected; |
|
131 |
+} |
|
132 |
+ |
|
133 |
+ |
|
134 |
+/* ---------------------- NCurses routines -----------------*/ |
|
135 |
+enum colors { |
|
136 |
+ header_color=1, |
|
137 |
+ version_color, |
|
138 |
+ error_color, |
|
139 |
+ value_color, |
|
140 |
+ descr_color, |
|
141 |
+ selected_color, |
|
142 |
+ queue_header_color, |
|
143 |
+ activ_color, |
|
144 |
+ dim_color, |
|
145 |
+ red_color, |
|
146 |
+}; |
|
147 |
+ |
|
148 |
+#define UPDATE_INTERVAL 2 |
|
149 |
+#define MIN_INTERVAL 1 |
|
150 |
+ |
|
151 |
+/* the default color of the terminal in ncurses */ |
|
152 |
+#define DEFAULT_COLOR -1 |
|
153 |
+ |
|
154 |
+#define VALUE_ATTR A_BOLD | COLOR_PAIR(value_color) |
|
155 |
+#define DESCR_ATTR COLOR_PAIR(descr_color) |
|
156 |
+#define ERROR_ATTR A_BOLD | COLOR_PAIR(error_color) |
|
157 |
+ |
|
158 |
+static WINDOW *header_window = NULL; |
|
159 |
+static WINDOW *stats_head_window = NULL; |
|
160 |
+static WINDOW *stats_window = NULL; |
|
161 |
+static WINDOW *status_bar_window = NULL; |
|
162 |
+static WINDOW *mem_window = NULL; |
|
163 |
+ |
|
164 |
+static const char *status_bar_keys[10]; |
|
165 |
+static unsigned maxy=0, maxx=0; |
|
166 |
+static char *queue_header = NULL; |
|
167 |
+static char *clamd_header = NULL; |
|
168 |
+ |
|
169 |
+#define CMDHEAD " COMMAND QUEUEDSINCE FILE" |
|
170 |
+#define CMDHEAD2 " # COMMAND QUEUEDSINCE FILE" |
|
171 |
+ |
|
172 |
+/* |
|
173 |
+ * CLAMD - which local/remote clamd this is |
|
174 |
+ * CONNTIM - since when we are connected (TODO: zeroed at reconnect) |
|
175 |
+ * QUEUE - no of items in queue (total) |
|
176 |
+ * MAXQUEUE - max no of items in queue observed |
|
177 |
+ * LIVETHR - sum of live threads |
|
178 |
+ * IDLETHR - sum of idle threads |
|
179 |
+ */ |
|
180 |
+#define SUMHEAD "NO CONNTIME LIV IDL QUEUE MAXQ MEM HOST ENGINE DBVER DBTIME" |
|
181 |
+ |
|
182 |
+static void resize(void) |
|
183 |
+{ |
|
184 |
+ char *p; |
|
185 |
+ unsigned new_maxy, new_maxx; |
|
186 |
+ getmaxyx(stdscr, new_maxy, new_maxx); |
|
187 |
+ if(new_maxy == maxy && new_maxx == maxx) |
|
188 |
+ return; |
|
189 |
+ maxx = new_maxx; |
|
190 |
+ maxy = new_maxy; |
|
191 |
+ free(queue_header); |
|
192 |
+ free(clamd_header); |
|
193 |
+ queue_header = malloc(maxx + 1); |
|
194 |
+ OOM_CHECK(queue_header); |
|
195 |
+ clamd_header = malloc(maxx + 1); |
|
196 |
+ OOM_CHECK(clamd_header); |
|
197 |
+ assert(clamd_header && queue_header); |
|
198 |
+ strncpy(queue_header, global.num_clamd>1 ? CMDHEAD2 : CMDHEAD, maxx); |
|
199 |
+ strncpy(clamd_header, SUMHEAD, maxx); |
|
200 |
+ queue_header[maxx] = '\0'; |
|
201 |
+ clamd_header[maxx] = '\0'; |
|
202 |
+ p = queue_header + strlen(queue_header); |
|
203 |
+ while(p < queue_header+maxx) |
|
204 |
+ *p++ = ' '; |
|
205 |
+ p = clamd_header + strlen(clamd_header); |
|
206 |
+ while(p < clamd_header+maxx) |
|
207 |
+ *p++ = ' '; |
|
208 |
+} |
|
209 |
+ |
|
210 |
+static void rm_windows(void) |
|
211 |
+{ |
|
212 |
+ if(header_window) { |
|
213 |
+ delwin(header_window); |
|
214 |
+ header_window = NULL; |
|
215 |
+ } |
|
216 |
+ if(mem_window) { |
|
217 |
+ delwin(mem_window); |
|
218 |
+ mem_window = NULL; |
|
219 |
+ } |
|
220 |
+ if(stats_window) { |
|
221 |
+ delwin(stats_window); |
|
222 |
+ stats_window = NULL; |
|
223 |
+ } |
|
224 |
+ if(stats_head_window) { |
|
225 |
+ delwin(stats_head_window); |
|
226 |
+ stats_head_window = NULL; |
|
227 |
+ } |
|
228 |
+ if(status_bar_window) { |
|
229 |
+ delwin(status_bar_window); |
|
230 |
+ status_bar_window = NULL; |
|
231 |
+ } |
|
232 |
+} |
|
233 |
+ |
|
234 |
+ |
|
235 |
+static void init_windows(int num_clamd) |
|
236 |
+{ |
|
237 |
+ resize(); |
|
238 |
+ |
|
239 |
+ rm_windows(); |
|
240 |
+ /* non-overlapping windows */ |
|
241 |
+ header_window = subwin(stdscr, 1, maxx, 0, 0); |
|
242 |
+ stats_head_window = subwin(stdscr, num_clamd+1, maxx, 1, 0); |
|
243 |
+ maxystats = maxy-num_clamd-3; |
|
244 |
+ stats_window = subwin(stdscr, maxystats, maxx, num_clamd+2, 0); |
|
245 |
+ status_bar_window = subwin(stdscr, 1, maxx, maxy-1, 0); |
|
246 |
+ /* memwindow overlaps, used only in details mode */ |
|
247 |
+ mem_window = derwin(stats_window, 6, 41, 1, maxx-41); |
|
248 |
+ touchwin(stdscr); |
|
249 |
+ werase(stdscr); |
|
250 |
+ refresh(); |
|
251 |
+ memset(status_bar_keys, 0, sizeof(status_bar_keys)); |
|
252 |
+ status_bar_keys[0] = "F1 - help"; |
|
253 |
+ status_bar_keys[1] = "Q - quit"; |
|
254 |
+ status_bar_keys[2] = "R - reset maximums"; |
|
255 |
+ if (num_clamd > 1) { |
|
256 |
+ status_bar_keys[3] = "^ - previous clamd"; |
|
257 |
+ status_bar_keys[4] = "v - next clamd"; |
|
258 |
+ } |
|
259 |
+} |
|
260 |
+ |
|
261 |
+static void init_ncurses(int num_clamd) |
|
262 |
+{ |
|
263 |
+ initscr(); |
|
264 |
+ curses_inited = 1; |
|
265 |
+ |
|
266 |
+ start_color(); |
|
267 |
+ keypad(stdscr, TRUE); /* enable keyboard mapping */ |
|
268 |
+ nonl(); /* tell curses not to do NL->CR/NL on output */ |
|
269 |
+ halfdelay(UPDATE_INTERVAL*10); /* timeout of 2s when waiting for input*/ |
|
270 |
+ noecho(); /* dont echo input */ |
|
271 |
+ curs_set(0); /* turn off cursor */ |
|
272 |
+ use_default_colors(); |
|
273 |
+ |
|
274 |
+ init_pair(header_color, COLOR_BLACK, COLOR_WHITE); |
|
275 |
+ init_pair(version_color, DEFAULT_COLOR, DEFAULT_COLOR); |
|
276 |
+ init_pair(error_color, COLOR_WHITE, COLOR_RED); |
|
277 |
+ init_pair(value_color, COLOR_GREEN, DEFAULT_COLOR); |
|
278 |
+ init_pair(descr_color, COLOR_CYAN, DEFAULT_COLOR); |
|
279 |
+ init_pair(selected_color, COLOR_BLACK, COLOR_CYAN); |
|
280 |
+ init_pair(queue_header_color, COLOR_BLACK, COLOR_GREEN); |
|
281 |
+ init_pair(activ_color, COLOR_MAGENTA, DEFAULT_COLOR); |
|
282 |
+ init_pair(dim_color, COLOR_GREEN, DEFAULT_COLOR); |
|
283 |
+ init_pair(red_color, COLOR_RED, DEFAULT_COLOR); |
|
284 |
+ |
|
285 |
+ init_windows(num_clamd); |
|
286 |
+} |
|
287 |
+ |
|
288 |
+static void win_start(WINDOW *win, enum colors col) |
|
289 |
+{ |
|
290 |
+ wattrset(win, COLOR_PAIR(col)); |
|
291 |
+ wbkgd(win, COLOR_PAIR(col)); |
|
292 |
+ werase(win); |
|
293 |
+} |
|
294 |
+ |
|
295 |
+ |
|
296 |
+static void print_colored(WINDOW *win, const char *p) |
|
297 |
+{ |
|
298 |
+ while(*p) { |
|
299 |
+ wattron(win, DESCR_ATTR); |
|
300 |
+ while(*p && !isdigit(*p)) |
|
301 |
+ waddch(win, *p++); |
|
302 |
+ wattroff(win, DESCR_ATTR); |
|
303 |
+ wattron(win, VALUE_ATTR); |
|
304 |
+ while(*p && isdigit(*p)) |
|
305 |
+ waddch(win, *p++); |
|
306 |
+ wattroff(win, VALUE_ATTR); |
|
307 |
+ } |
|
308 |
+} |
|
309 |
+ |
|
310 |
+static void header(void) |
|
311 |
+{ |
|
312 |
+ size_t i, x=0; |
|
313 |
+ time_t t; |
|
314 |
+ |
|
315 |
+ |
|
316 |
+ win_start(header_window, header_color); |
|
317 |
+ mvwprintw(header_window, 0, 0, " ClamdTOP version %s ", get_version()); |
|
318 |
+ time(&t); |
|
319 |
+ wprintw(header_window, "%s", ctime(&t)); |
|
320 |
+ wrefresh(header_window); |
|
321 |
+ |
|
322 |
+/* win_start(version_window, version_color); |
|
323 |
+ mvwprintw(version_window, 0, 0, "Connected to: "); |
|
324 |
+ print_colored(version_window, clamd_version ? clamd_version : "Unknown"); |
|
325 |
+ wrefresh(version_window);*/ |
|
326 |
+ |
|
327 |
+ werase(status_bar_window); |
|
328 |
+ for(i=0;i<sizeof(status_bar_keys)/sizeof(status_bar_keys[0]);i++) { |
|
329 |
+ const char *s = status_bar_keys[i]; |
|
330 |
+ if(!s) |
|
331 |
+ continue; |
|
332 |
+ wattron(status_bar_window, A_REVERSE); |
|
333 |
+ if (s[0] == '^') { |
|
334 |
+ mvwaddch(status_bar_window, 0, x, ACS_UARROW); |
|
335 |
+ s++; |
|
336 |
+ x++; |
|
337 |
+ } else if (s[0] == 'v') { |
|
338 |
+ mvwaddch(status_bar_window, 0, x, ACS_DARROW); |
|
339 |
+ s++; |
|
340 |
+ x++; |
|
341 |
+ } |
|
342 |
+ mvwprintw(status_bar_window, 0, x, "%s",s); |
|
343 |
+ wattroff(status_bar_window, A_REVERSE); |
|
344 |
+ x += strlen(status_bar_keys[i]) + 1; |
|
345 |
+ } |
|
346 |
+ wrefresh(status_bar_window); |
|
347 |
+} |
|
348 |
+ |
|
349 |
+static void show_bar(WINDOW *win, size_t i, unsigned live, unsigned idle, |
|
350 |
+ unsigned max, int blink) |
|
351 |
+{ |
|
352 |
+ int y,x; |
|
353 |
+ unsigned len = 39; |
|
354 |
+ unsigned start = 1; |
|
355 |
+ unsigned activ = max ? ((live-idle)*(len - start - 2) + (max/2)) / max : 0; |
|
356 |
+ unsigned dim = max ? idle*(len - start - 2) / max : 0; |
|
357 |
+ unsigned rem = len - activ - dim - start-2; |
|
358 |
+ |
|
359 |
+ assert(activ + 2 < len && activ+dim + 2 < len && activ+dim+rem + 2 < len && "Invalid values"); |
|
360 |
+ mvwaddch(win, i, start, '[' | A_BOLD); |
|
361 |
+ wattron(win, A_BOLD | COLOR_PAIR(activ_color)); |
|
362 |
+ for(i=0;i<activ;i++) |
|
363 |
+ waddch(win, '|'); |
|
364 |
+ wattroff(win, A_BOLD | COLOR_PAIR(activ_color)); |
|
365 |
+ wattron(win, A_DIM | COLOR_PAIR(dim_color)); |
|
366 |
+ for(i=0;i<dim;i++) |
|
367 |
+ waddch(win, '|'); |
|
368 |
+ wattroff(win, A_DIM | COLOR_PAIR(dim_color)); |
|
369 |
+ for(i=0;i<rem;i++) |
|
370 |
+ waddch(win, ' '); |
|
371 |
+ waddch(win, ']' | A_BOLD); |
|
372 |
+ if(blink) { |
|
373 |
+ getyx(win, y, x); |
|
374 |
+ mvwaddch(win, y, x-2, '>' | A_BLINK | COLOR_PAIR(red_color)); |
|
375 |
+ move(y, x); |
|
376 |
+ } |
|
377 |
+} |
|
378 |
+ |
|
379 |
+/* --------------------- Error handling ---------------------*/ |
|
380 |
+static int normal_exit = 0; |
|
381 |
+static const char *exit_reason = NULL; |
|
382 |
+static const char *exit_func = NULL; |
|
383 |
+static unsigned exit_line = 0; |
|
384 |
+ |
|
385 |
+static void cleanup(void) |
|
386 |
+{ |
|
387 |
+ unsigned i; |
|
388 |
+ if (curses_inited) { |
|
389 |
+ if (status_bar_window) { |
|
390 |
+ werase(status_bar_window); |
|
391 |
+ wrefresh(status_bar_window); |
|
392 |
+ } |
|
393 |
+ rm_windows(); |
|
394 |
+ endwin(); |
|
395 |
+ } |
|
396 |
+ curses_inited = 0; |
|
397 |
+ for (i=0;i<global.num_clamd;i++) { |
|
398 |
+ if (global.conn[i].sd && global.conn[i].sd != -1) { |
|
399 |
+ send_string_noreconn(&global.conn[i], "nEND\n"); |
|
400 |
+ close(global.conn[i].sd); |
|
401 |
+ } |
|
402 |
+ free(global.conn[i].version); |
|
403 |
+ } |
|
404 |
+ free(global.all_stats); |
|
405 |
+ free(global.conn); |
|
406 |
+ free(queue_header); |
|
407 |
+ free(clamd_header); |
|
408 |
+ if(!normal_exit) { |
|
409 |
+ fprintf(stderr, "Abnormal program termination"); |
|
410 |
+ if (exit_reason) fprintf(stderr, ": %s",exit_reason); |
|
411 |
+ if (exit_func) fprintf(stderr, " in %s", exit_func); |
|
412 |
+ if (exit_line) fprintf(stderr, " at line %u", exit_line); |
|
413 |
+ fputc('\n',stderr); |
|
414 |
+ } |
|
415 |
+} |
|
416 |
+ |
|
417 |
+#ifdef __GNUC__ |
|
418 |
+#define __noreturn __attribute__((noreturn)) |
|
419 |
+#else |
|
420 |
+#define __noreturn |
|
421 |
+#endif |
|
422 |
+ |
|
423 |
+static void __noreturn exit_program(enum exit_reason reason, const char *func, unsigned line) |
|
424 |
+{ |
|
425 |
+ switch(reason) { |
|
426 |
+ case FAIL_CMDLINE: |
|
427 |
+ exit_reason = "Invalid command-line arguments"; |
|
428 |
+ break; |
|
429 |
+ case FAIL_INITIAL_CONN: |
|
430 |
+ exit_reason = "Unable to connect to all clamds"; |
|
431 |
+ break; |
|
432 |
+ case OUT_OF_MEMORY: |
|
433 |
+ exit_reason = "Out of memory"; |
|
434 |
+ break; |
|
435 |
+ case RECONNECT_FAIL: |
|
436 |
+ exit_reason = "Failed to reconnect to clamd after connection was lost"; |
|
437 |
+ break; |
|
438 |
+ case SIGINT_REASON: |
|
439 |
+ exit_reason = "User interrupt"; |
|
440 |
+ break; |
|
441 |
+ default: |
|
442 |
+ exit_reason = "Unknown"; |
|
443 |
+ break; |
|
444 |
+ } |
|
445 |
+ exit_func = func; |
|
446 |
+ exit_line = line; |
|
447 |
+ exit(reason); |
|
448 |
+} |
|
449 |
+ |
|
450 |
+struct task { |
|
451 |
+ char *line; |
|
452 |
+ double tim; |
|
453 |
+ int clamd_no; |
|
454 |
+}; |
|
455 |
+ |
|
456 |
+static int tasks_compare(const void *a, const void *b) |
|
457 |
+{ |
|
458 |
+ const struct task *ta = a; |
|
459 |
+ const struct task *tb = b; |
|
460 |
+ if(ta->tim < tb->tim) |
|
461 |
+ return 1; |
|
462 |
+ if(ta->tim > tb->tim) |
|
463 |
+ return -1; |
|
464 |
+ return 0; |
|
465 |
+} |
|
466 |
+ |
|
467 |
+/* ----------- Socket routines ----------------------- */ |
|
468 |
+#ifdef __GNUC__ |
|
469 |
+static void print_con_info(conn_t *conn, const char *fmt, ...) __attribute__((format(printf, 2, 3))); |
|
470 |
+#endif |
|
471 |
+static void print_con_info(conn_t *conn, const char *fmt, ...) |
|
472 |
+{ |
|
473 |
+ va_list ap; |
|
474 |
+ va_start(ap, fmt); |
|
475 |
+ if (stats_head_window) { |
|
476 |
+ char *buf = malloc(maxx); |
|
477 |
+ memset(buf, ' ', maxx); |
|
478 |
+ OOM_CHECK(buf); |
|
479 |
+ vsnprintf(buf, maxx-1, fmt, ap); |
|
480 |
+ buf[strlen(buf)] = ' '; |
|
481 |
+ buf[maxx-1] = '\0'; |
|
482 |
+ wattron(stats_head_window, ERROR_ATTR); |
|
483 |
+ mvwprintw(stats_head_window, conn->line, 0, "%s", buf); |
|
484 |
+ wattroff(stats_head_window, ERROR_ATTR); |
|
485 |
+ wrefresh(stats_head_window); |
|
486 |
+ free(buf); |
|
487 |
+ } else |
|
488 |
+ vfprintf(stdout, fmt, ap); |
|
489 |
+ va_end(ap); |
|
490 |
+} |
|
491 |
+ |
|
492 |
+ |
|
493 |
+static int make_connection(const char *soname, conn_t *conn) |
|
494 |
+{ |
|
495 |
+ int s; |
|
496 |
+ struct timeval tv; |
|
497 |
+ conn->tcp = 0; |
|
498 |
+#ifdef _WIN32 |
|
499 |
+ { |
|
500 |
+#else |
|
501 |
+ if(soname[0] == '/' || (access(soname, F_OK) == 0)) { |
|
502 |
+ struct sockaddr_un addr; |
|
503 |
+ s = socket(AF_UNIX, SOCK_STREAM, 0); |
|
504 |
+ if(s < 0) { |
|
505 |
+ perror("socket"); |
|
506 |
+ return -1; |
|
507 |
+ } |
|
508 |
+ memset(&addr, 0, sizeof(addr)); |
|
509 |
+ addr.sun_family = AF_UNIX; |
|
510 |
+ strncpy(addr.sun_path, soname, sizeof(addr.sun_path)); |
|
511 |
+ print_con_info(conn, "Connecting to: %s\n", soname); |
|
512 |
+ if (connect(s, (struct sockaddr *)&addr, sizeof(addr))) { |
|
513 |
+ perror("connect"); |
|
514 |
+ return -1; |
|
515 |
+ } |
|
516 |
+ } else { |
|
517 |
+#endif |
|
518 |
+ struct sockaddr_in server; |
|
519 |
+ struct hostent *hp; |
|
520 |
+ unsigned port = 0; |
|
521 |
+ char *name, *pt = strdup(soname); |
|
522 |
+ const char *host = pt; |
|
523 |
+ conn->tcp=1; |
|
524 |
+ name = strchr(pt, ':'); |
|
525 |
+ if(name) { |
|
526 |
+ *name++ = '\0'; |
|
527 |
+ port = atoi(name); |
|
528 |
+ } |
|
529 |
+ if(!port) |
|
530 |
+ port = 3310; |
|
531 |
+ print_con_info(conn, "Looking up: %s\n", host); |
|
532 |
+ if((hp = gethostbyname(host)) == NULL) { |
|
533 |
+ fprintf(stderr, "Cannot find host"); |
|
534 |
+ return -1; |
|
535 |
+ } |
|
536 |
+ free(pt); |
|
537 |
+ s = socket(AF_INET, SOCK_STREAM, 0); |
|
538 |
+ if(s < 0) { |
|
539 |
+ perror("socket"); |
|
540 |
+ return -1; |
|
541 |
+ } |
|
542 |
+ server.sin_family = AF_INET; |
|
543 |
+ server.sin_port = htons(port); |
|
544 |
+ server.sin_addr.s_addr = ((struct in_addr*)(hp->h_addr))->s_addr; |
|
545 |
+ print_con_info(conn, "Connecting to: %s:%u\n", inet_ntoa(server.sin_addr), port); |
|
546 |
+ if (connect(s, (struct sockaddr *)&server, sizeof(server))) { |
|
547 |
+ perror("connect"); |
|
548 |
+ return -1; |
|
549 |
+ } |
|
550 |
+ } |
|
551 |
+ conn->remote = soname; |
|
552 |
+ conn->sd = s; |
|
553 |
+ gettimeofday(&conn->tv_conn, NULL); |
|
554 |
+ tv.tv_sec = 4; |
|
555 |
+ tv.tv_usec = 0; |
|
556 |
+ setsockopt(conn->sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); |
|
557 |
+ send_string(conn, "nIDSESSION\nnVERSION\n"); |
|
558 |
+ free(conn->version); |
|
559 |
+ conn->version = NULL; |
|
560 |
+ read_version(conn); |
|
561 |
+ return 0; |
|
562 |
+} |
|
563 |
+ |
|
564 |
+static void reconnect(conn_t *conn); |
|
565 |
+ |
|
566 |
+static int send_string_noreconn(conn_t *conn, const char *cmd) |
|
567 |
+{ |
|
568 |
+ assert(cmd); |
|
569 |
+ assert(conn && conn->sd > 0); |
|
570 |
+ return send(conn->sd, cmd, strlen(cmd), 0); |
|
571 |
+} |
|
572 |
+ |
|
573 |
+static void send_string(conn_t *conn, const char *cmd) |
|
574 |
+{ |
|
575 |
+ while(send_string_noreconn(conn, cmd) == -1) { |
|
576 |
+ reconnect(conn); |
|
577 |
+ } |
|
578 |
+} |
|
579 |
+ |
|
580 |
+static int tries = 0; |
|
581 |
+static void reconnect(conn_t *conn) |
|
582 |
+{ |
|
583 |
+ if(++tries > 3) { |
|
584 |
+ EXIT_PROGRAM(RECONNECT_FAIL); |
|
585 |
+ } |
|
586 |
+ if (make_connection(conn->remote, conn) < 0) { |
|
587 |
+ print_con_info(conn, "Unable to reconnect to %s: %s", conn->remote, strerror(errno)); |
|
588 |
+ EXIT_PROGRAM(RECONNECT_FAIL); |
|
589 |
+ } |
|
590 |
+ tries = 0; |
|
591 |
+} |
|
592 |
+ |
|
593 |
+static int recv_line(conn_t *conn, char *buf, size_t len) |
|
594 |
+{ |
|
595 |
+ assert(len > 0); |
|
596 |
+ assert(conn); |
|
597 |
+ assert(buf); |
|
598 |
+ |
|
599 |
+ len--; |
|
600 |
+ if (!len || conn->sd == -1) |
|
601 |
+ return 0; |
|
602 |
+ assert(conn->sd > 0); |
|
603 |
+ while (len > 0) { |
|
604 |
+ ssize_t nread = recv(conn->sd, buf, len, MSG_PEEK); |
|
605 |
+ if (nread <= 0) { |
|
606 |
+ print_con_info(conn, "%s: %s", conn->remote, strerror(errno)); |
|
607 |
+ /* it could be a timeout, be nice and send an END */ |
|
608 |
+ send_string_noreconn(conn, "nEND\n"); |
|
609 |
+ close(conn->sd); |
|
610 |
+ conn->sd = -1; |
|
611 |
+ return 0; |
|
612 |
+ } else { |
|
613 |
+ char *p = memchr(buf, '\n', nread); |
|
614 |
+ if (p) { |
|
615 |
+ len = p - buf + 1; |
|
616 |
+ } else |
|
617 |
+ len = nread; |
|
618 |
+ assert(len > 0); |
|
619 |
+ assert(len <= (size_t)nread); |
|
620 |
+ nread = recv(conn->sd, buf, len, 0); |
|
621 |
+ if (nread == -1) |
|
622 |
+ reconnect(conn); |
|
623 |
+ else { |
|
624 |
+ assert(nread >0 && (size_t)nread == len); |
|
625 |
+ buf += nread; |
|
626 |
+ } |
|
627 |
+ if (p) |
|
628 |
+ break; |
|
629 |
+ } |
|
630 |
+ } |
|
631 |
+ *buf = '\0'; |
|
632 |
+ return 1; |
|
633 |
+} |
|
634 |
+ |
|
635 |
+static void output_queue(size_t line, ssize_t max) |
|
636 |
+{ |
|
637 |
+ ssize_t i, j; |
|
638 |
+ struct task *tasks = global.tasks; |
|
639 |
+ struct task *filtered_tasks = calloc(global.n, sizeof(*filtered_tasks)); |
|
640 |
+ OOM_CHECK(filtered_tasks); |
|
641 |
+ for (i=0,j=0;i<global.n;i++) { |
|
642 |
+ if (detail_selected == -1 || detail_is_selected(tasks[i].clamd_no-1)) { |
|
643 |
+ filtered_tasks[j++] = tasks[i]; |
|
644 |
+ } |
|
645 |
+ } |
|
646 |
+ |
|
647 |
+ wattron(stats_window, COLOR_PAIR(queue_header_color)); |
|
648 |
+ mvwprintw(stats_window, line++, 0, "%s", queue_header); |
|
649 |
+ wattroff(stats_window, COLOR_PAIR(queue_header_color)); |
|
650 |
+ if (max >= j) |
|
651 |
+ max = j; |
|
652 |
+ else |
|
653 |
+ --max; |
|
654 |
+ if (max < 0) max = 0; |
|
655 |
+ for(i=0;i<max;i++) { |
|
656 |
+ char *cmde; |
|
657 |
+ assert(tasks); |
|
658 |
+ cmde = strchr(filtered_tasks[i].line, ' '); |
|
659 |
+ if(cmde) { |
|
660 |
+ char cmd[16]; |
|
661 |
+ const char *filstart = strchr(cmde + 1, ' '); |
|
662 |
+ strncpy(cmd, filtered_tasks[i].line, sizeof(cmd)-1); |
|
663 |
+ cmd[15]='\0'; |
|
664 |
+ if (filtered_tasks[i].line+15 > cmde) |
|
665 |
+ cmd[cmde - filtered_tasks[i].line] = '\0'; |
|
666 |
+ if(filstart) { |
|
667 |
+ ++filstart; |
|
668 |
+ if (detail_selected == -1 && global.num_clamd > 1) |
|
669 |
+ mvwprintw(stats_window, line + i, 0, "%2u %s", filtered_tasks[i].clamd_no, cmd + 1); |
|
670 |
+ else |
|
671 |
+ mvwprintw(stats_window, line + i, 0, " %s", cmd + 1); |
|
672 |
+ mvwprintw(stats_window, line + i, 15, "%10.03fs", filtered_tasks[i].tim); |
|
673 |
+ mvwprintw(stats_window, line + i, 30, "%s",filstart); |
|
674 |
+ } |
|
675 |
+ } |
|
676 |
+ } |
|
677 |
+ if (max < j) { |
|
678 |
+ /* in summary mode we can only show a max amount of tasks */ |
|
679 |
+ wattron(stats_window, A_DIM | COLOR_PAIR(header_color)); |
|
680 |
+ mvwprintw(stats_window, line+i, 0, "*** %u more task(s) not shown ***", (unsigned)(j - max)); |
|
681 |
+ wattroff(stats_window, A_DIM | COLOR_PAIR(header_color)); |
|
682 |
+ } |
|
683 |
+ free(filtered_tasks); |
|
684 |
+} |
|
685 |
+ |
|
686 |
+/* ---------------------- stats parsing routines ------------------- */ |
|
687 |
+ |
|
688 |
+ |
|
689 |
+static void parse_queue(conn_t *conn, char* buf, size_t len, unsigned idx) |
|
690 |
+{ |
|
691 |
+ do { |
|
692 |
+ double tim; |
|
693 |
+ const char *t = strchr(buf, ' '); |
|
694 |
+ if(!t) |
|
695 |
+ continue; |
|
696 |
+ if(sscanf(t,"%lf", &tim) != 1) |
|
697 |
+ continue; |
|
698 |
+ ++global.n; |
|
699 |
+ global.tasks = realloc(global.tasks, sizeof(*global.tasks)*global.n); |
|
700 |
+ OOM_CHECK(global.tasks); |
|
701 |
+ global.tasks[global.n-1].line = strdup(buf); |
|
702 |
+ OOM_CHECK(global.tasks[global.n-1].line); |
|
703 |
+ global.tasks[global.n-1].tim = tim; |
|
704 |
+ global.tasks[global.n-1].clamd_no = idx + 1; |
|
705 |
+ } while (recv_line(conn, buf, len) && buf[0] == '\t' && strcmp("END\n", buf) != 0); |
|
706 |
+} |
|
707 |
+ |
|
708 |
+static unsigned biggest_mem = 0; |
|
709 |
+ |
|
710 |
+static void output_memstats(struct stats *stats) |
|
711 |
+{ |
|
712 |
+ char buf[128]; |
|
713 |
+ unsigned long totalmem; |
|
714 |
+ int blink = 0; |
|
715 |
+ |
|
716 |
+ werase(mem_window); |
|
717 |
+ if (stats->mem > 0) { |
|
718 |
+ box(mem_window, 0, 0); |
|
719 |
+ |
|
720 |
+ snprintf(buf, sizeof(buf),"heap %4luM mmap %4luM unused %3luM", |
|
721 |
+ stats->lheapu/1024, stats->lmmapu/1024, stats->lreleasable/1024); |
|
722 |
+ mvwprintw(mem_window, 1, 1, "Mem: "); |
|
723 |
+ print_colored(mem_window, buf); |
|
724 |
+ |
|
725 |
+ mvwprintw(mem_window, 2, 1, "Libc: "); |
|
726 |
+ snprintf(buf, sizeof(buf),"used %4luM free %4luM total %4luM", |
|
727 |
+ stats->ltotalu/1024, stats->ltotalf/1024, (stats->ltotalu+stats->ltotalf)/1024); |
|
728 |
+ print_colored(mem_window, buf); |
|
729 |
+ |
|
730 |
+ mvwprintw(mem_window, 3, 1, "Pool: "); |
|
731 |
+ snprintf(buf, sizeof(buf), "count %u used %4luM total %4luM", |
|
732 |
+ stats->pools_cnt, stats->lpoolu/1024, stats->lpoolt/1024); |
|
733 |
+ print_colored(mem_window, buf); |
|
734 |
+ |
|
735 |
+ totalmem = stats->lheapu + stats->lmmapu + stats->lpoolt; |
|
736 |
+ if(totalmem > biggest_mem) { |
|
737 |
+ biggest_mem = totalmem; |
|
738 |
+ blink = 1; |
|
739 |
+ } |
|
740 |
+ show_bar(mem_window, 4, totalmem, stats->lmmapu + stats->lreleasable + stats->lpoolt - stats->lpoolu, |
|
741 |
+ biggest_mem, blink); |
|
742 |
+ } |
|
743 |
+ wrefresh(mem_window); |
|
744 |
+} |
|
745 |
+ |
|
746 |
+static void parse_memstats(const char *line, struct stats *stats) |
|
747 |
+{ |
|
748 |
+ double heapu, mmapu, totalu, totalf, releasable, pools_used, pools_total; |
|
749 |
+ |
|
750 |
+ if(sscanf(line, " heap %lfM mmap %lfM used %lfM free %lfM releasable %lfM pools %u pools_used %lfM pools_total %lfM", |
|
751 |
+ &heapu, &mmapu, &totalu, &totalf, &releasable, &stats->pools_cnt, &pools_used, &pools_total) != 8) |
|
752 |
+ return; |
|
753 |
+ stats->lheapu = heapu*1000; |
|
754 |
+ stats->lmmapu = mmapu*1000; |
|
755 |
+ stats->ltotalu = totalu*1000; |
|
756 |
+ stats->ltotalf = totalf*1000; |
|
757 |
+ stats->lreleasable = releasable*1000; |
|
758 |
+ stats->lpoolu = pools_used*1000; |
|
759 |
+ stats->lpoolt = pools_total*1000; |
|
760 |
+ stats->mem = heapu + mmapu + pools_total; |
|
761 |
+} |
|
762 |
+ |
|
763 |
+static int output_stats(struct stats *stats, unsigned idx) |
|
764 |
+{ |
|
765 |
+ char buf[128]; |
|
766 |
+ char timbuf[15]; |
|
767 |
+ int blink = 0; |
|
768 |
+ size_t i= 0; |
|
769 |
+ char mem[6]; |
|
770 |
+ WINDOW *win = stats_head_window; |
|
771 |
+ int sel = detail_is_selected(idx); |
|
772 |
+ char *line = malloc(maxx+1); |
|
773 |
+ |
|
774 |
+ OOM_CHECK(line); |
|
775 |
+ |
|
776 |
+ if (stats->mem >= 0 || stats->stats_unsupp) |
|
777 |
+ strncpy(mem, "N/A", sizeof(mem)); |
|
778 |
+ else { |
|
779 |
+ char c; |
|
780 |
+ double s; |
|
781 |
+ if (stats->mem > 999.0) { |
|
782 |
+ c = 'G'; |
|
783 |
+ s = stats->mem / 1024.0; |
|
784 |
+ } else { |
|
785 |
+ c = 'M'; |
|
786 |
+ s = stats->mem; |
|
787 |
+ } |
|
788 |
+ snprintf(mem, sizeof(mem), "%7.3f", s); |
|
789 |
+ i = 4; |
|
790 |
+ if (mem[i-1] == '.') i--; |
|
791 |
+ mem[i++] = c; |
|
792 |
+ mem[i] = '\0'; |
|
793 |
+ } |
|
794 |
+ i = idx+1; |
|
795 |
+ |
|
796 |
+ if (!stats->db_time.tm_year) |
|
797 |
+ strncpy(timbuf,"N/A",sizeof(timbuf)); |
|
798 |
+ else |
|
799 |
+ snprintf(timbuf, sizeof(timbuf), "%04u-%02u-%02u %02uh", |
|
800 |
+ 1900 + stats->db_time.tm_year, |
|
801 |
+ stats->db_time.tm_mon, |
|
802 |
+ stats->db_time.tm_mday, |
|
803 |
+ stats->db_time.tm_hour); |
|
804 |
+ |
|
805 |
+ memset(line, ' ', maxx+1); |
|
806 |
+ if (!stats->stats_unsupp) { |
|
807 |
+ snprintf(line, maxx-1, "%2u %02u:%02u:%02u %3u %3u %5u %5u %5s %-14s %-6s %5s %s", idx+1, stats->conn_hr, stats->conn_min, stats->conn_sec, |
|
808 |
+ stats->live, stats->idle, |
|
809 |
+ stats->current_q, stats->biggest_queue, |
|
810 |
+ mem, |
|
811 |
+ stats->remote, stats->engine_version, stats->db_version, timbuf); |
|
812 |
+ } else { |
|
813 |
+ snprintf(line, maxx-1, "%2u %02u:%02u:%02u N/A N/A N/A N/A N/A %-14s %-6s %5s %s", idx+1, stats->conn_hr, stats->conn_min, stats->conn_sec, |
|
814 |
+ stats->remote, stats->engine_version, stats->db_version, timbuf); |
|
815 |
+ } |
|
816 |
+ line[maxx] = '\0'; |
|
817 |
+ line[strlen(line)] = ' '; |
|
818 |
+ if (sel) { |
|
819 |
+ wattron(win, COLOR_PAIR(selected_color)); |
|
820 |
+ } |
|
821 |
+ mvwprintw(win, i, 0, "%s", line); |
|
822 |
+ if (sel) { |
|
823 |
+ wattroff(win, COLOR_PAIR(selected_color)); |
|
824 |
+ } |
|
825 |
+ win = stats_window; |
|
826 |
+ i = 0; |
|
827 |
+ if (sel && !stats->stats_unsupp) { |
|
828 |
+ memset(line, ' ', maxx+1); |
|
829 |
+ snprintf(line, maxx-1, "Details for Clamd version: %s", stats->version); |
|
830 |
+ line[maxx] = '\0'; |
|
831 |
+ line[strlen(line)]= ' '; |
|
832 |
+ wattron(win, COLOR_PAIR(queue_header_color)); |
|
833 |
+ mvwprintw(win, i++, 0, "%s", line); |
|
834 |
+ wattroff(win, COLOR_PAIR(queue_header_color)); |
|
835 |
+ mvwprintw(win, i++, 0, "Primary threads: "); |
|
836 |
+ snprintf(buf, sizeof(buf), "live %3u idle %3u max %3u", stats->prim_live, stats->prim_idle, stats->prim_max); |
|
837 |
+ print_colored(win, buf); |
|
838 |
+ show_bar(win, i++, stats->prim_live, stats->prim_idle, stats->prim_max, 0); |
|
839 |
+ |
|
840 |
+/* mvwprintw(win, i++, 0, "Multiscan pool : "); |
|
841 |
+ snprintf(buf, sizeof(buf), "live %3u idle %3u max %3u", stats->live, stats->idle, stats->max); |
|
842 |
+ print_colored(win, buf); |
|
843 |
+ show_bar(win, i++, stats->live, stats->idle, stats->max, 0);*/ |
|
844 |
+ |
|
845 |
+ blink = 0; |
|
846 |
+ if(stats->current_q > stats->biggest_queue) { |
|
847 |
+ stats->biggest_queue = stats->current_q; |
|
848 |
+ blink = 1; |
|
849 |
+ } |
|
850 |
+ mvwprintw(win, i++, 0, "Queue:"); |
|
851 |
+ snprintf(buf, sizeof(buf), "%6u items %6u max", stats->current_q, stats->biggest_queue); |
|
852 |
+ print_colored(win, buf); |
|
853 |
+ show_bar(win, i++, stats->current_q, 0, stats->biggest_queue, blink); |
|
854 |
+ werase(mem_window); |
|
855 |
+ output_memstats(stats); |
|
856 |
+ } |
|
857 |
+ free(line); |
|
858 |
+ return i; |
|
859 |
+} |
|
860 |
+ |
|
861 |
+static void output_all(void) |
|
862 |
+{ |
|
863 |
+ unsigned i, stats_line=0; |
|
864 |
+ werase(stats_head_window); |
|
865 |
+ werase(stats_window); |
|
866 |
+ wattron(stats_head_window, COLOR_PAIR(queue_header_color)); |
|
867 |
+ mvwprintw(stats_head_window, 0, 0, "%s", clamd_header); |
|
868 |
+ wattroff(stats_head_window, COLOR_PAIR(queue_header_color)); |
|
869 |
+ for (i=0;i<global.num_clamd;i++) { |
|
870 |
+ unsigned j = output_stats(&global.all_stats[i], i); |
|
871 |
+ if (j > stats_line) |
|
872 |
+ stats_line = j; |
|
873 |
+ } |
|
874 |
+ output_queue(stats_line, maxystats - stats_line-1); |
|
875 |
+ wrefresh(stats_head_window); |
|
876 |
+ wrefresh(stats_window); |
|
877 |
+ if (detail_exists()) { |
|
878 |
+ /* overlaps, must be done at the end */ |
|
879 |
+ wrefresh(mem_window); |
|
880 |
+ } |
|
881 |
+} |
|
882 |
+ |
|
883 |
+static void parse_stats(conn_t *conn, struct stats *stats, unsigned idx) |
|
884 |
+{ |
|
885 |
+ char buf[1024]; |
|
886 |
+ size_t j; |
|
887 |
+ struct timeval tv; |
|
888 |
+ unsigned conn_dt; |
|
889 |
+ int primary = 0; |
|
890 |
+ const char *pstart, *p, *vstart; |
|
891 |
+ |
|
892 |
+ if (conn->tcp) |
|
893 |
+ stats->remote = conn->remote; |
|
894 |
+ else |
|
895 |
+ stats->remote = "local"; |
|
896 |
+ |
|
897 |
+ if (!conn->version) { |
|
898 |
+ stats->engine_version = strdup("???"); |
|
899 |
+ return; |
|
900 |
+ } |
|
901 |
+ p = pstart = vstart = strchr(conn->version, ' '); |
|
902 |
+ if (!vstart) { |
|
903 |
+ stats->engine_version = strdup("???"); |
|
904 |
+ return; |
|
905 |
+ } |
|
906 |
+ /* find digit in version */ |
|
907 |
+ while (*p && !isdigit(*p)) |
|
908 |
+ p++; |
|
909 |
+ /* rewind to first space or dash */ |
|
910 |
+ while (p > pstart && *p && *p != ' ' && *p != '-') |
|
911 |
+ p--; |
|
912 |
+ if (*p) p++; |
|
913 |
+ /* keep only base version, and cut -exp, and -gittags */ |
|
914 |
+ pstart = p; |
|
915 |
+ while (*p && *p != '-' && *p != '/') |
|
916 |
+ p++; |
|
917 |
+ |
|
918 |
+ stats->engine_version = malloc(p - pstart+1); |
|
919 |
+ OOM_CHECK(stats->engine_version); |
|
920 |
+ |
|
921 |
+ memcpy(stats->engine_version, pstart, p-pstart); |
|
922 |
+ stats->engine_version[p-pstart] = '\0'; |
|
923 |
+ |
|
924 |
+ pstart = strchr(p, '/'); |
|
925 |
+ if (!pstart) |
|
926 |
+ stats->db_version = strdup("????"); |
|
927 |
+ else { |
|
928 |
+ pstart++; |
|
929 |
+ p = strchr(pstart, '/'); |
|
930 |
+ if (!p) |
|
931 |
+ p = pstart + strlen(pstart); |
|
932 |
+ stats->db_version = malloc(p - pstart + 1); |
|
933 |
+ OOM_CHECK(stats->db_version); |
|
934 |
+ memcpy(stats->db_version, pstart, p-pstart); |
|
935 |
+ stats->db_version[p-pstart] = '\0'; |
|
936 |
+ if(*p) p++; |
|
937 |
+ if (!*p || !strptime(p,"%a %b %d %H:%M:%S %Y", &stats->db_time)) { |
|
938 |
+ memset(&stats->db_time, 0, sizeof(stats->db_time)); |
|
939 |
+ } |
|
940 |
+ } |
|
941 |
+ if (maxx > 61 && strlen(stats->db_version) > (maxx-61)) { |
|
942 |
+ stats->db_version[maxx-61] = '\0'; |
|
943 |
+ } |
|
944 |
+ |
|
945 |
+ stats->version = vstart; /* for details view */ |
|
946 |
+ gettimeofday(&tv, NULL); |
|
947 |
+ tv.tv_sec -= conn->tv_conn.tv_sec; |
|
948 |
+ tv.tv_usec -= conn->tv_conn.tv_usec; |
|
949 |
+ conn_dt = tv.tv_sec + tv.tv_usec/1e6; |
|
950 |
+ |
|
951 |
+ stats->live = stats->idle = stats->max = 0; |
|
952 |
+ stats->conn_hr = conn_dt/3600; |
|
953 |
+ stats->conn_min = (conn_dt/60)%60; |
|
954 |
+ stats->conn_sec = conn_dt%60; |
|
955 |
+ stats->current_q = 0; |
|
956 |
+ |
|
957 |
+ while(recv_line(conn, buf, sizeof(buf)) && strcmp("END\n",buf) != 0) { |
|
958 |
+ char *val = strchr(buf, ':'); |
|
959 |
+ |
|
960 |
+ if(buf[0] == '\t') { |
|
961 |
+ parse_queue(conn, buf, sizeof(buf), idx); |
|
962 |
+ continue; |
|
963 |
+ } else if(val) |
|
964 |
+ *val++ = '\0'; |
|
965 |
+ if(!strcmp("MEMSTATS", buf)) { |
|
966 |
+ parse_memstats(val, stats); |
|
967 |
+ continue; |
|
968 |
+ } |
|
969 |
+ if(!strncmp("UNKNOWN COMMAND", buf, 15)) { |
|
970 |
+ stats->stats_unsupp = 1; |
|
971 |
+ break; |
|
972 |
+ } |
|
973 |
+ for(j=1;j<strlen(buf);j++) |
|
974 |
+ buf[j] = tolower(buf[j]); |
|
975 |
+ /* mvwprintw(win, i, 0, "%s", buf); |
|
976 |
+ if(!val) { |
|
977 |
+ i++; |
|
978 |
+ continue; |
|
979 |
+ } |
|
980 |
+ waddch(win, ':'); |
|
981 |
+ print_colored(win, val); |
|
982 |
+ i++;*/ |
|
983 |
+ if(!strncmp("State",buf,5)) { |
|
984 |
+ if(strstr(val, "PRIMARY")) { |
|
985 |
+ /* primary thread pool */ |
|
986 |
+ primary = 1; |
|
987 |
+ } else { |
|
988 |
+ /* multiscan pool */ |
|
989 |
+ primary = 0; |
|
990 |
+ } |
|
991 |
+ } |
|
992 |
+ if(!strcmp("Threads",buf)) { |
|
993 |
+ unsigned live, idle, max; |
|
994 |
+ if(sscanf(val, " live %u idle %u max %u", &live, &idle, &max) != 3) |
|
995 |
+ continue; |
|
996 |
+ if (primary) { |
|
997 |
+ stats->prim_live = live; |
|
998 |
+ stats->prim_idle = idle; |
|
999 |
+ assert(!stats->prim_max && "There can be only one primary pool!"); |
|
1000 |
+ stats->prim_max = max; |
|
1001 |
+ } |
|
1002 |
+ stats->live += live; |
|
1003 |
+ stats->idle += idle; |
|
1004 |
+ stats->max += max; |
|
1005 |
+ } else if (!strcmp("Queue",buf)) { |
|
1006 |
+ unsigned len; |
|
1007 |
+ if(sscanf(val, "%u", &len) != 1) |
|
1008 |
+ continue; |
|
1009 |
+ stats->current_q += len; |
|
1010 |
+ } |
|
1011 |
+ } |
|
1012 |
+} |
|
1013 |
+ |
|
1014 |
+static void read_version(conn_t *conn) |
|
1015 |
+{ |
|
1016 |
+ char buf[1024]; |
|
1017 |
+ if(recv_line(conn, buf, sizeof(buf))) { |
|
1018 |
+ unsigned i; |
|
1019 |
+ conn->version = strdup(buf); |
|
1020 |
+ OOM_CHECK(conn->version); |
|
1021 |
+ for (i=0;i<strlen(conn->version);i++) |
|
1022 |
+ if (conn->version[i] == '\n') |
|
1023 |
+ conn->version[i] = ' '; |
|
1024 |
+ } else { |
|
1025 |
+ reconnect(conn); |
|
1026 |
+ } |
|
1027 |
+} |
|
1028 |
+ |
|
1029 |
+static void sigint(int a) |
|
1030 |
+{ |
|
1031 |
+ EXIT_PROGRAM(SIGINT_REASON); |
|
1032 |
+} |
|
1033 |
+ |
|
1034 |
+static void help(void) |
|
1035 |
+{ |
|
1036 |
+ printf("\n"); |
|
1037 |
+ printf(" Clam AntiVirus: Monitoring Tool %s\n", get_version()); |
|
1038 |
+ printf(" (C) 2008 - 2009 ClamAV Team - http://www.clamav.net/team\n\n"); |
|
1039 |
+ printf("clamdtop [-hVc] [host[:port] /path/to/clamd.socket ...]\n\n"); |
|
1040 |
+ printf(" --help -h Show help\n"); |
|
1041 |
+ printf(" --version -V Show version\n"); |
|
1042 |
+ printf(" --config-file=FILE -c FILE Read clamd's configuration files from FILE\n"); |
|
1043 |
+ printf(" host[:port] Connect to clamd on host at port (default 3310)\n"); |
|
1044 |
+ printf(" /path/to/clamd.socket Connect to clamd over a local socket\n"); |
|
1045 |
+ printf("\n"); |
|
1046 |
+ return; |
|
1047 |
+} |
|
1048 |
+ |
|
1049 |
+/* -------------------------- Initialization ---------------- */ |
|
1050 |
+static void setup_connections(int argc, char *argv[]) |
|
1051 |
+{ |
|
1052 |
+ struct optstruct *opts; |
|
1053 |
+ struct optstruct *clamd_opts; |
|
1054 |
+ unsigned i; |
|
1055 |
+ char *conn = NULL; |
|
1056 |
+ |
|
1057 |
+ opts = optparse(NULL, argc, argv, 1, OPT_CLAMDTOP, 0, NULL); |
|
1058 |
+ if (!opts) { |
|
1059 |
+ fprintf(stderr, "ERROR: Can't parse command line options\n"); |
|
1060 |
+ EXIT_PROGRAM(FAIL_CMDLINE); |
|
1061 |
+ } |
|
1062 |
+ |
|
1063 |
+ if(optget(opts, "help")->enabled) { |
|
1064 |
+ optfree(opts); |
|
1065 |
+ help(); |
|
1066 |
+ normal_exit = 1; |
|
1067 |
+ exit(0); |
|
1068 |
+ } |
|
1069 |
+ |
|
1070 |
+ if(optget(opts, "version")->enabled) { |
|
1071 |
+ printf("Clam AntiVirus Monitoring Tool %s\n", get_version()); |
|
1072 |
+ optfree(opts); |
|
1073 |
+ normal_exit = 1; |
|
1074 |
+ exit(0); |
|
1075 |
+ } |
|
1076 |
+ |
|
1077 |
+ memset(&global, 0, sizeof(global)); |
|
1078 |
+ if (!opts->filename || !opts->filename[0]) { |
|
1079 |
+ char *aargv[2]; |
|
1080 |
+ const struct optstruct *opt; |
|
1081 |
+ const char *clamd_conf = optget(opts, "config-file")->strarg; |
|
1082 |
+ |
|
1083 |
+ if ((clamd_opts = optparse(clamd_conf, 0, NULL, 1, OPT_CLAMD, 0, NULL)) == NULL) { |
|
1084 |
+ fprintf(stderr, "Can't parse clamd configuration file %s\n", clamd_conf); |
|
1085 |
+ EXIT_PROGRAM(FAIL_CMDLINE); |
|
1086 |
+ } |
|
1087 |
+ |
|
1088 |
+ if((opt = optget(clamd_opts, "LocalSocket"))->enabled) { |
|
1089 |
+ conn = strdup(opt->strarg); |
|
1090 |
+ } else if ((opt = optget(clamd_opts, "TCPSocket"))->enabled) { |
|
1091 |
+ char buf[512]; |
|
1092 |
+ const struct optstruct *opt_addr; |
|
1093 |
+ const char *host = "localhost"; |
|
1094 |
+ if ((opt_addr = optget(clamd_opts, "TCPAddr"))->enabled) { |
|
1095 |
+ host = opt_addr->strarg; |
|
1096 |
+ } |
|
1097 |
+ snprintf(buf, sizeof(buf), "%s:%u", host, opt->numarg); |
|
1098 |
+ conn = strdup(buf); |
|
1099 |
+ } else { |
|
1100 |
+ fprintf(stderr, "Can't find how to connect to clamd\n"); |
|
1101 |
+ EXIT_PROGRAM(FAIL_INITIAL_CONN); |
|
1102 |
+ } |
|
1103 |
+ optfree(clamd_opts); |
|
1104 |
+ global.num_clamd = 1; |
|
1105 |
+ } else { |
|
1106 |
+ unsigned i = 0; |
|
1107 |
+ while (opts->filename[i]) { i++; } |
|
1108 |
+ global.num_clamd = i; |
|
1109 |
+ } |
|
1110 |
+ |
|
1111 |
+#ifdef _WIN32 |
|
1112 |
+ WSADATA wsaData; |
|
1113 |
+ if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { |
|
1114 |
+ fprintf(stderr, "Error at WSAStartup(): %d\n", WSAGetLastError()); |
|
1115 |
+ EXIT_PROGRAM(FAIL_INITIAL_CONN); |
|
1116 |
+ } |
|
1117 |
+#endif |
|
1118 |
+ /* clamdtop */ |
|
1119 |
+ puts( " __ ____"); |
|
1120 |
+ puts(" _____/ /___ _____ ___ ____/ / /_____ ____"); |
|
1121 |
+ puts(" / ___/ / __ `/ __ `__ \\/ __ / __/ __ \\/ __ \\"); |
|
1122 |
+ puts("/ /__/ / /_/ / / / / / / /_/ / /_/ /_/ / /_/ /"); |
|
1123 |
+ puts("\\___/_/\\__,_/_/ /_/ /_/\\__,_/\\__/\\____/ .___/"); |
|
1124 |
+ puts(" /_/"); |
|
1125 |
+ global.all_stats = calloc(global.num_clamd, sizeof(*global.all_stats)); |
|
1126 |
+ OOM_CHECK(global.all_stats); |
|
1127 |
+ global.conn = calloc(global.num_clamd, sizeof(*global.conn)); |
|
1128 |
+ OOM_CHECK(global.conn); |
|
1129 |
+ for (i=0;i < global.num_clamd;i++) { |
|
1130 |
+ const char *soname = conn ? conn : opts->filename[i]; |
|
1131 |
+ global.conn[i].line = i+1; |
|
1132 |
+ if (make_connection(soname, &global.conn[i]) < 0) { |
|
1133 |
+ EXIT_PROGRAM(FAIL_INITIAL_CONN); |
|
1134 |
+ } |
|
1135 |
+ } |
|
1136 |
+ optfree(opts); |
|
1137 |
+#ifndef _WIN32 |
|
1138 |
+ signal(SIGPIPE, SIG_IGN); |
|
1139 |
+ signal(SIGINT, sigint); |
|
1140 |
+#endif |
|
1141 |
+} |
|
1142 |
+ |
|
1143 |
+static void free_global_stats(void) |
|
1144 |
+{ |
|
1145 |
+ unsigned i; |
|
1146 |
+ for (i=0;i<(unsigned)global.n;i++) { |
|
1147 |
+ free(global.tasks[i].line); |
|
1148 |
+ } |
|
1149 |
+ for (i=0;i<global.num_clamd;i++) { |
|
1150 |
+ free(global.all_stats[i].engine_version); |
|
1151 |
+ free(global.all_stats[i].db_version); |
|
1152 |
+ } |
|
1153 |
+ free(global.tasks); |
|
1154 |
+ global.tasks = NULL; |
|
1155 |
+ global.n=0; |
|
1156 |
+} |
|
1157 |
+ |
|
1158 |
+static int help_line; |
|
1159 |
+static void explain(const char *abbrev, const char *msg) |
|
1160 |
+{ |
|
1161 |
+ wattron(stdscr, A_BOLD); |
|
1162 |
+ mvwprintw(stdscr, help_line++, 0, "%-15s", abbrev); |
|
1163 |
+ wattroff(stdscr, A_BOLD); |
|
1164 |
+ wprintw(stdscr," %s", msg); |
|
1165 |
+} |
|
1166 |
+ |
|
1167 |
+static int show_help(void) |
|
1168 |
+{ |
|
1169 |
+ int ch; |
|
1170 |
+ werase(stdscr); |
|
1171 |
+ help_line = 0; |
|
1172 |
+ |
|
1173 |
+ explain("NO","Unique clamd number"); |
|
1174 |
+ explain("CONNTIME", "How long it is connected"); |
|
1175 |
+ explain("LIV", "Total number of live threads"); |
|
1176 |
+ explain("IDL", "Total number of idle threads"); |
|
1177 |
+ explain("QUEUE", "Number of items in queue"); |
|
1178 |
+ explain("MAXQ","Maximum number of items observed in queue"); |
|
1179 |
+ explain("MEM", "Total memory usage (if available)"); |
|
1180 |
+ explain("HOST", "Which clamd, local means unix socket"); |
|
1181 |
+ explain("ENGINE", "Engine version"); |
|
1182 |
+ explain("DBVER", "Database version"); |
|
1183 |
+ explain("DBTIME", "Database publish time"); |
|
1184 |
+ explain("Primary threads", "Threadpool used to receive commands"); |
|
1185 |
+ explain("Multiscan pool","Threadpool used for multiscan"); |
|
1186 |
+ explain("live","Executing commands, or scanning"); |
|
1187 |
+ explain("idle","Waiting for commands, will exit after idle_timeout"); |
|
1188 |
+ explain("max", "Maximum number of threads configured for this pool"); |
|
1189 |
+ explain("Queue","Tasks queued for processing, but not yet picked up by a thread"); |
|
1190 |
+ explain("COMMAND","Command this thread is executing"); |
|
1191 |
+ explain("QUEUEDSINCE","How long this task is executing"); |
|
1192 |
+ explain("FILE","Which file it is processing (if applicable)"); |
|
1193 |
+ explain("Mem","Memory usage reported by libc"); |
|
1194 |
+ explain("Libc","Used/free memory reported by libc"); |
|
1195 |
+ explain("Pool","Memory usage reported by libclamav's pool"); |
|
1196 |
+ |
|
1197 |
+ wrefresh(stdscr); |
|
1198 |
+ werase(status_bar_window); |
|
1199 |
+ wattron(status_bar_window, A_REVERSE); |
|
1200 |
+ mvwprintw(status_bar_window, 0, 0, "Press any key to exit help"); |
|
1201 |
+ wattroff(status_bar_window, A_REVERSE); |
|
1202 |
+ wrefresh(status_bar_window); |
|
1203 |
+ /* getch() times out after a few seconds */ |
|
1204 |
+ do { |
|
1205 |
+ ch = getch(); |
|
1206 |
+ /* we do need to exit on resize, because the text scroll out of |
|
1207 |
+ * view */ |
|
1208 |
+ } while (ch == -1 /*|| ch == KEY_RESIZE*/); |
|
1209 |
+ return ch == KEY_RESIZE ? KEY_RESIZE : -1; |
|
1210 |
+} |
|
1211 |
+ |
|
1212 |
+int main(int argc, char *argv[]) |
|
1213 |
+{ |
|
1214 |
+ int ch = 0; |
|
1215 |
+ struct timeval tv_last, tv; |
|
1216 |
+ unsigned i; |
|
1217 |
+ |
|
1218 |
+ atexit(cleanup); |
|
1219 |
+ setup_connections(argc, argv); |
|
1220 |
+ init_ncurses(global.num_clamd); |
|
1221 |
+ |
|
1222 |
+ memset(&tv_last, 0, sizeof(tv_last)); |
|
1223 |
+ do { |
|
1224 |
+ if (ch == KEY_F(1)) { |
|
1225 |
+ ch = show_help(); |
|
1226 |
+ } |
|
1227 |
+ switch(ch) { |
|
1228 |
+ case KEY_RESIZE: |
|
1229 |
+ resize(); |
|
1230 |
+ endwin(); |
|
1231 |
+ refresh(); |
|
1232 |
+ init_windows(global.num_clamd); |
|
1233 |
+ break; |
|
1234 |
+ case 'R': |
|
1235 |
+ for (i=0;i<global.num_clamd;i++) |
|
1236 |
+ global.all_stats[i].biggest_queue = 1; |
|
1237 |
+ biggest_mem = 0; |
|
1238 |
+ break; |
|
1239 |
+ case KEY_UP: |
|
1240 |
+ if (global.num_clamd > 1) { |
|
1241 |
+ if (detail_selected == -1) |
|
1242 |
+ detail_selected = global.num_clamd-1; |
|
1243 |
+ else |
|
1244 |
+ --detail_selected; |
|
1245 |
+ } |
|
1246 |
+ break; |
|
1247 |
+ case KEY_DOWN: |
|
1248 |
+ if (global.num_clamd > 1) { |
|
1249 |
+ if (detail_selected == -1) |
|
1250 |
+ detail_selected = 0; |
|
1251 |
+ else { |
|
1252 |
+ if((unsigned)++detail_selected >= global.num_clamd) |
|
1253 |
+ detail_selected = -1; |
|
1254 |
+ } |
|
1255 |
+ } |
|
1256 |
+ break; |
|
1257 |
+ } |
|
1258 |
+ gettimeofday(&tv, NULL); |
|
1259 |
+ header(); |
|
1260 |
+ if(tv.tv_sec - tv_last.tv_sec >= MIN_INTERVAL) { |
|
1261 |
+ free_global_stats(); |
|
1262 |
+ for(i=0;i<global.num_clamd;i++) { |
|
1263 |
+ unsigned biggest_q; |
|
1264 |
+ struct stats *stats = &global.all_stats[i]; |
|
1265 |
+ if (global.conn[i].sd != -1) |
|
1266 |
+ send_string(&global.conn[i], "nSTATS\n"); |
|
1267 |
+ biggest_q = stats->biggest_queue; |
|
1268 |
+ memset(stats, 0, sizeof(*stats)); |
|
1269 |
+ stats->biggest_queue = biggest_q; |
|
1270 |
+ parse_stats(&global.conn[i], stats, i); |
|
1271 |
+ } |
|
1272 |
+ if (global.tasks) |
|
1273 |
+ qsort(global.tasks, global.n, sizeof(*global.tasks), tasks_compare); |
|
1274 |
+ tv_last = tv; |
|
1275 |
+ } |
|
1276 |
+ /* always show, so that screen resizes take effect instantly*/ |
|
1277 |
+ output_all(); |
|
1278 |
+ for(i=0;i<global.num_clamd;i++) { |
|
1279 |
+ if (global.conn[i].sd == -1) |
|
1280 |
+ reconnect(&global.conn[i]); |
|
1281 |
+ } |
|
1282 |
+ } while(toupper(ch = getch()) != 'Q'); |
|
1283 |
+ free_global_stats(); |
|
1284 |
+ normal_exit = 1; |
|
1285 |
+ return 0; |
|
1286 |
+} |
... | ... |
@@ -114,6 +114,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
114 | 114 |
CLAMD_LIBS = @CLAMD_LIBS@ |
115 | 115 |
CPP = @CPP@ |
116 | 116 |
CPPFLAGS = @CPPFLAGS@ |
117 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
118 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
117 | 119 |
CYGPATH_W = @CYGPATH_W@ |
118 | 120 |
DBDIR = @DBDIR@ |
119 | 121 |
DEFS = @DEFS@ -DCL_NOTHREADS |
... | ... |
@@ -932,6 +932,10 @@ HAVE_MILTER_FALSE |
932 | 932 |
GETENT |
933 | 933 |
CLAMAVUSER |
934 | 934 |
CLAMAVGROUP |
935 |
+CURSES_CPPFLAGS |
|
936 |
+CURSES_LIBS |
|
937 |
+HAVE_CURSES_TRUE |
|
938 |
+HAVE_CURSES_FALSE |
|
935 | 939 |
LIBOBJS |
936 | 940 |
LTLIBOBJS |
937 | 941 |
ltdl_LIBOBJS |
... | ... |
@@ -1563,6 +1567,7 @@ Optional Features: |
1563 | 1563 |
--disable-gethostbyname_r disable support for gethostbyname_r |
1564 | 1564 |
--enable-readdir_r enable support for readdir_r |
1565 | 1565 |
--disable-fdpassing don't build file descriptor passing support |
1566 |
+ --enable-clamdtop Enable 'clamdtop' tool [default=auto] |
|
1566 | 1567 |
|
1567 | 1568 |
Optional Packages: |
1568 | 1569 |
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] |
... | ... |
@@ -1586,6 +1591,10 @@ Optional Packages: |
1586 | 1586 |
--with-user=uid name of the clamav user (default=clamav) |
1587 | 1587 |
--with-group=gid name of the clamav group (default=clamav) |
1588 | 1588 |
--with-dbdir=path path to virus database directory |
1589 |
+ --with-libncurses-prefix[=DIR] search for libncurses in DIR/include and DIR/lib |
|
1590 |
+ --without-libncurses-prefix don't search for libncurses in includedir and libdir |
|
1591 |
+ --with-libpdcurses-prefix[=DIR] search for libpdcurses in DIR/include and DIR/lib |
|
1592 |
+ --without-libpdcurses-prefix don't search for libpdcurses in includedir and libdir |
|
1589 | 1593 |
|
1590 | 1594 |
Some influential environment variables: |
1591 | 1595 |
CC C compiler command |
... | ... |
@@ -4781,13 +4790,13 @@ if test "${lt_cv_nm_interface+set}" = set; then |
4781 | 4781 |
else |
4782 | 4782 |
lt_cv_nm_interface="BSD nm" |
4783 | 4783 |
echo "int some_variable = 0;" > conftest.$ac_ext |
4784 |
- (eval echo "\"\$as_me:4784: $ac_compile\"" >&5) |
|
4784 |
+ (eval echo "\"\$as_me:4793: $ac_compile\"" >&5) |
|
4785 | 4785 |
(eval "$ac_compile" 2>conftest.err) |
4786 | 4786 |
cat conftest.err >&5 |
4787 |
- (eval echo "\"\$as_me:4787: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
|
4787 |
+ (eval echo "\"\$as_me:4796: $NM \\\"conftest.$ac_objext\\\"\"" >&5) |
|
4788 | 4788 |
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) |
4789 | 4789 |
cat conftest.err >&5 |
4790 |
- (eval echo "\"\$as_me:4790: output\"" >&5) |
|
4790 |
+ (eval echo "\"\$as_me:4799: output\"" >&5) |
|
4791 | 4791 |
cat conftest.out >&5 |
4792 | 4792 |
if $GREP 'External.*some_variable' conftest.out > /dev/null; then |
4793 | 4793 |
lt_cv_nm_interface="MS dumpbin" |
... | ... |
@@ -5998,7 +6007,7 @@ ia64-*-hpux*) |
5998 | 5998 |
;; |
5999 | 5999 |
*-*-irix6*) |
6000 | 6000 |
# Find out which ABI we are using. |
6001 |
- echo '#line 6001 "configure"' > conftest.$ac_ext |
|
6001 |
+ echo '#line 6010 "configure"' > conftest.$ac_ext |
|
6002 | 6002 |
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 |
6003 | 6003 |
(eval $ac_compile) 2>&5 |
6004 | 6004 |
ac_status=$? |
... | ... |
@@ -7848,11 +7857,11 @@ else |
7848 | 7848 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
7849 | 7849 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
7850 | 7850 |
-e 's:$: $lt_compiler_flag:'` |
7851 |
- (eval echo "\"\$as_me:7851: $lt_compile\"" >&5) |
|
7851 |
+ (eval echo "\"\$as_me:7860: $lt_compile\"" >&5) |
|
7852 | 7852 |
(eval "$lt_compile" 2>conftest.err) |
7853 | 7853 |
ac_status=$? |
7854 | 7854 |
cat conftest.err >&5 |
7855 |
- echo "$as_me:7855: \$? = $ac_status" >&5 |
|
7855 |
+ echo "$as_me:7864: \$? = $ac_status" >&5 |
|
7856 | 7856 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
7857 | 7857 |
# The compiler can only warn and ignore the option if not recognized |
7858 | 7858 |
# So say no if there are warnings other than the usual output. |
... | ... |
@@ -8187,11 +8196,11 @@ else |
8187 | 8187 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8188 | 8188 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8189 | 8189 |
-e 's:$: $lt_compiler_flag:'` |
8190 |
- (eval echo "\"\$as_me:8190: $lt_compile\"" >&5) |
|
8190 |
+ (eval echo "\"\$as_me:8199: $lt_compile\"" >&5) |
|
8191 | 8191 |
(eval "$lt_compile" 2>conftest.err) |
8192 | 8192 |
ac_status=$? |
8193 | 8193 |
cat conftest.err >&5 |
8194 |
- echo "$as_me:8194: \$? = $ac_status" >&5 |
|
8194 |
+ echo "$as_me:8203: \$? = $ac_status" >&5 |
|
8195 | 8195 |
if (exit $ac_status) && test -s "$ac_outfile"; then |
8196 | 8196 |
# The compiler can only warn and ignore the option if not recognized |
8197 | 8197 |
# So say no if there are warnings other than the usual output. |
... | ... |
@@ -8292,11 +8301,11 @@ else |
8292 | 8292 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8293 | 8293 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8294 | 8294 |
-e 's:$: $lt_compiler_flag:'` |
8295 |
- (eval echo "\"\$as_me:8295: $lt_compile\"" >&5) |
|
8295 |
+ (eval echo "\"\$as_me:8304: $lt_compile\"" >&5) |
|
8296 | 8296 |
(eval "$lt_compile" 2>out/conftest.err) |
8297 | 8297 |
ac_status=$? |
8298 | 8298 |
cat out/conftest.err >&5 |
8299 |
- echo "$as_me:8299: \$? = $ac_status" >&5 |
|
8299 |
+ echo "$as_me:8308: \$? = $ac_status" >&5 |
|
8300 | 8300 |
if (exit $ac_status) && test -s out/conftest2.$ac_objext |
8301 | 8301 |
then |
8302 | 8302 |
# The compiler can only warn and ignore the option if not recognized |
... | ... |
@@ -8347,11 +8356,11 @@ else |
8347 | 8347 |
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ |
8348 | 8348 |
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ |
8349 | 8349 |
-e 's:$: $lt_compiler_flag:'` |
8350 |
- (eval echo "\"\$as_me:8350: $lt_compile\"" >&5) |
|
8350 |
+ (eval echo "\"\$as_me:8359: $lt_compile\"" >&5) |
|
8351 | 8351 |
(eval "$lt_compile" 2>out/conftest.err) |
8352 | 8352 |
ac_status=$? |
8353 | 8353 |
cat out/conftest.err >&5 |
8354 |
- echo "$as_me:8354: \$? = $ac_status" >&5 |
|
8354 |
+ echo "$as_me:8363: \$? = $ac_status" >&5 |
|
8355 | 8355 |
if (exit $ac_status) && test -s out/conftest2.$ac_objext |
8356 | 8356 |
then |
8357 | 8357 |
# The compiler can only warn and ignore the option if not recognized |
... | ... |
@@ -11103,7 +11112,7 @@ else |
11103 | 11103 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
11104 | 11104 |
lt_status=$lt_dlunknown |
11105 | 11105 |
cat > conftest.$ac_ext <<_LT_EOF |
11106 |
-#line 11106 "configure" |
|
11106 |
+#line 11115 "configure" |
|
11107 | 11107 |
#include "confdefs.h" |
11108 | 11108 |
|
11109 | 11109 |
#if HAVE_DLFCN_H |
... | ... |
@@ -11199,7 +11208,7 @@ else |
11199 | 11199 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
11200 | 11200 |
lt_status=$lt_dlunknown |
11201 | 11201 |
cat > conftest.$ac_ext <<_LT_EOF |
11202 |
-#line 11202 "configure" |
|
11202 |
+#line 11211 "configure" |
|
11203 | 11203 |
#include "confdefs.h" |
11204 | 11204 |
|
11205 | 11205 |
#if HAVE_DLFCN_H |
... | ... |
@@ -12314,7 +12323,7 @@ else |
12314 | 12314 |
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
12315 | 12315 |
lt_status=$lt_dlunknown |
12316 | 12316 |
cat > conftest.$ac_ext <<_LT_EOF |
12317 |
-#line 12317 "configure" |
|
12317 |
+#line 12326 "configure" |
|
12318 | 12318 |
#include "confdefs.h" |
12319 | 12319 |
|
12320 | 12320 |
#if HAVE_DLFCN_H |
... | ... |
@@ -16476,12 +16485,6 @@ fi |
16476 | 16476 |
|
16477 | 16477 |
|
16478 | 16478 |
|
16479 |
- { echo "$as_me:$LINENO: checking how to compile and link with check" >&5 |
|
16480 |
-echo $ECHO_N "checking how to compile and link with check... $ECHO_C" >&6; } |
|
16481 |
-if test "${ac_cv_findlib_CHECK_libs+set}" = set; then |
|
16482 |
- echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
16483 |
-else |
|
16484 |
- |
|
16485 | 16479 |
save_CPPFLAGS="$CPPFLAGS" |
16486 | 16480 |
save_LIBS="$LIBS" |
16487 | 16481 |
|
... | ... |
@@ -17130,10 +17133,6 @@ fi |
17130 | 17130 |
|
17131 | 17131 |
CPPFLAGS="$save_CPPFLAGS" |
17132 | 17132 |
LIBS="$save_LIBS" |
17133 |
- |
|
17134 |
-fi |
|
17135 |
-{ echo "$as_me:$LINENO: result: $ac_cv_findlib_CHECK_libs" >&5 |
|
17136 |
-echo "${ECHO_T}$ac_cv_findlib_CHECK_libs" >&6; } |
|
17137 | 17133 |
if test "X$ac_cv_findlib_CHECK_libs" = "X"; then |
17138 | 17134 |
|
17139 | 17135 |
{ echo "$as_me:$LINENO: unable to compile/link with check" >&5 |
... | ... |
@@ -22549,7 +22548,2097 @@ cat >>confdefs.h <<_ACEOF |
22549 | 22549 |
_ACEOF |
22550 | 22550 |
|
22551 | 22551 |
|
22552 |
-ac_config_files="$ac_config_files libclamav/Makefile libclamav/lzma/Makefile clamscan/Makefile database/Makefile docs/Makefile clamd/Makefile clamdscan/Makefile clamav-milter/Makefile freshclam/Makefile sigtool/Makefile clamconf/Makefile etc/Makefile test/Makefile unit_tests/Makefile Makefile clamav-config libclamav.pc docs/man/clamav-milter.8 docs/man/clamconf.1 docs/man/clamd.8 docs/man/clamd.conf.5 docs/man/clamdscan.1 docs/man/clamscan.1 docs/man/freshclam.1 docs/man/freshclam.conf.5 docs/man/sigtool.1" |
|
22552 |
+# Check whether --enable-clamdtop was given. |
|
22553 |
+if test "${enable_clamdtop+set}" = set; then |
|
22554 |
+ enableval=$enable_clamdtop; enable_clamdtop=$enableval |
|
22555 |
+else |
|
22556 |
+ enable_clamdtop="auto" |
|
22557 |
+fi |
|
22558 |
+ |
|
22559 |
+ |
|
22560 |
+if test "$enable_clamdtop" != "no"; then |
|
22561 |
+ |
|
22562 |
+ |
|
22563 |
+ |
|
22564 |
+ |
|
22565 |
+ |
|
22566 |
+ |
|
22567 |
+ save_CPPFLAGS="$CPPFLAGS" |
|
22568 |
+ save_LIBS="$LIBS" |
|
22569 |
+ |
|
22570 |
+ |
|
22571 |
+ |
|
22572 |
+ |
|
22573 |
+ use_additional=yes |
|
22574 |
+ |
|
22575 |
+ acl_save_prefix="$prefix" |
|
22576 |
+ prefix="$acl_final_prefix" |
|
22577 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22578 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22579 |
+ |
|
22580 |
+ eval additional_includedir=\"$includedir\" |
|
22581 |
+ eval additional_libdir=\"$libdir\" |
|
22582 |
+ |
|
22583 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22584 |
+ prefix="$acl_save_prefix" |
|
22585 |
+ |
|
22586 |
+ |
|
22587 |
+# Check whether --with-libncurses-prefix was given. |
|
22588 |
+if test "${with_libncurses_prefix+set}" = set; then |
|
22589 |
+ withval=$with_libncurses_prefix; |
|
22590 |
+ if test "X$withval" = "Xno"; then |
|
22591 |
+ use_additional=no |
|
22592 |
+ else |
|
22593 |
+ additional_compat_libdir= |
|
22594 |
+ if test "X$withval" = "X"; then |
|
22595 |
+ |
|
22596 |
+ acl_save_prefix="$prefix" |
|
22597 |
+ prefix="$acl_final_prefix" |
|
22598 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22599 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22600 |
+ |
|
22601 |
+ eval additional_includedir=\"$includedir\" |
|
22602 |
+ eval additional_libdir=\"$libdir\" |
|
22603 |
+ |
|
22604 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22605 |
+ prefix="$acl_save_prefix" |
|
22606 |
+ |
|
22607 |
+ else |
|
22608 |
+ additional_includedir="$withval/include" |
|
22609 |
+ additional_libdir="$withval/$acl_libdirstem" |
|
22610 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
22611 |
+ additional_compat_libdir="-L$withval/lib" |
|
22612 |
+ fi |
|
22613 |
+ fi |
|
22614 |
+ fi |
|
22615 |
+ |
|
22616 |
+fi |
|
22617 |
+ |
|
22618 |
+ LIBNCURSES= |
|
22619 |
+ LTLIBNCURSES= |
|
22620 |
+ INCNCURSES= |
|
22621 |
+ LIBNCURSES_PREFIX= |
|
22622 |
+ rpathdirs= |
|
22623 |
+ ltrpathdirs= |
|
22624 |
+ names_already_handled= |
|
22625 |
+ names_next_round='ncurses ' |
|
22626 |
+ while test -n "$names_next_round"; do |
|
22627 |
+ names_this_round="$names_next_round" |
|
22628 |
+ names_next_round= |
|
22629 |
+ for name in $names_this_round; do |
|
22630 |
+ already_handled= |
|
22631 |
+ for n in $names_already_handled; do |
|
22632 |
+ if test "$n" = "$name"; then |
|
22633 |
+ already_handled=yes |
|
22634 |
+ break |
|
22635 |
+ fi |
|
22636 |
+ done |
|
22637 |
+ if test -z "$already_handled"; then |
|
22638 |
+ names_already_handled="$names_already_handled $name" |
|
22639 |
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` |
|
22640 |
+ eval value=\"\$HAVE_LIB$uppername\" |
|
22641 |
+ if test -n "$value"; then |
|
22642 |
+ if test "$value" = yes; then |
|
22643 |
+ eval value=\"\$LIB$uppername\" |
|
22644 |
+ test -z "$value" || LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$value" |
|
22645 |
+ eval value=\"\$LTLIB$uppername\" |
|
22646 |
+ test -z "$value" || LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }$value" |
|
22647 |
+ else |
|
22648 |
+ : |
|
22649 |
+ fi |
|
22650 |
+ else |
|
22651 |
+ found_dir= |
|
22652 |
+ found_la= |
|
22653 |
+ found_so= |
|
22654 |
+ found_a= |
|
22655 |
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name |
|
22656 |
+ if test -n "$acl_shlibext"; then |
|
22657 |
+ shrext=".$acl_shlibext" # typically: shrext=.so |
|
22658 |
+ else |
|
22659 |
+ shrext= |
|
22660 |
+ fi |
|
22661 |
+ if test $use_additional = yes; then |
|
22662 |
+ dir="$additional_libdir" |
|
22663 |
+ if test -n "$acl_shlibext"; then |
|
22664 |
+ if test -f "$dir/$libname$shrext"; then |
|
22665 |
+ found_dir="$dir" |
|
22666 |
+ found_so="$dir/$libname$shrext" |
|
22667 |
+ else |
|
22668 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
22669 |
+ ver=`(cd "$dir" && \ |
|
22670 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
22671 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
22672 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
22673 |
+ | sed 1q ) 2>/dev/null` |
|
22674 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
22675 |
+ found_dir="$dir" |
|
22676 |
+ found_so="$dir/$libname$shrext.$ver" |
|
22677 |
+ fi |
|
22678 |
+ else |
|
22679 |
+ eval library_names=\"$acl_library_names_spec\" |
|
22680 |
+ for f in $library_names; do |
|
22681 |
+ if test -f "$dir/$f"; then |
|
22682 |
+ found_dir="$dir" |
|
22683 |
+ found_so="$dir/$f" |
|
22684 |
+ break |
|
22685 |
+ fi |
|
22686 |
+ done |
|
22687 |
+ fi |
|
22688 |
+ fi |
|
22689 |
+ fi |
|
22690 |
+ if test "X$found_dir" = "X"; then |
|
22691 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
22692 |
+ found_dir="$dir" |
|
22693 |
+ found_a="$dir/$libname.$acl_libext" |
|
22694 |
+ fi |
|
22695 |
+ fi |
|
22696 |
+ if test "X$found_dir" != "X"; then |
|
22697 |
+ if test -f "$dir/$libname.la"; then |
|
22698 |
+ found_la="$dir/$libname.la" |
|
22699 |
+ fi |
|
22700 |
+ fi |
|
22701 |
+ fi |
|
22702 |
+ if test "X$found_dir" = "X"; then |
|
22703 |
+ compat_libdir= |
|
22704 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
22705 |
+ compat_libdir=-L'${exec_prefix}'/lib |
|
22706 |
+ fi |
|
22707 |
+ for x in $LDFLAGS $LTLIBNCURSES $compat_libdir $additional_compat_libdir; do |
|
22708 |
+ |
|
22709 |
+ acl_save_prefix="$prefix" |
|
22710 |
+ prefix="$acl_final_prefix" |
|
22711 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22712 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22713 |
+ eval x=\"$x\" |
|
22714 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22715 |
+ prefix="$acl_save_prefix" |
|
22716 |
+ |
|
22717 |
+ case "$x" in |
|
22718 |
+ -L*) |
|
22719 |
+ dir=`echo "X$x" | sed -e 's/^X-L//'` |
|
22720 |
+ if test -n "$acl_shlibext"; then |
|
22721 |
+ if test -f "$dir/$libname$shrext"; then |
|
22722 |
+ found_dir="$dir" |
|
22723 |
+ found_so="$dir/$libname$shrext" |
|
22724 |
+ else |
|
22725 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
22726 |
+ ver=`(cd "$dir" && \ |
|
22727 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
22728 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
22729 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
22730 |
+ | sed 1q ) 2>/dev/null` |
|
22731 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
22732 |
+ found_dir="$dir" |
|
22733 |
+ found_so="$dir/$libname$shrext.$ver" |
|
22734 |
+ fi |
|
22735 |
+ else |
|
22736 |
+ eval library_names=\"$acl_library_names_spec\" |
|
22737 |
+ for f in $library_names; do |
|
22738 |
+ if test -f "$dir/$f"; then |
|
22739 |
+ found_dir="$dir" |
|
22740 |
+ found_so="$dir/$f" |
|
22741 |
+ break |
|
22742 |
+ fi |
|
22743 |
+ done |
|
22744 |
+ fi |
|
22745 |
+ fi |
|
22746 |
+ fi |
|
22747 |
+ if test "X$found_dir" = "X"; then |
|
22748 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
22749 |
+ found_dir="$dir" |
|
22750 |
+ found_a="$dir/$libname.$acl_libext" |
|
22751 |
+ fi |
|
22752 |
+ fi |
|
22753 |
+ if test "X$found_dir" != "X"; then |
|
22754 |
+ if test -f "$dir/$libname.la"; then |
|
22755 |
+ found_la="$dir/$libname.la" |
|
22756 |
+ fi |
|
22757 |
+ fi |
|
22758 |
+ ;; |
|
22759 |
+ esac |
|
22760 |
+ if test "X$found_dir" != "X"; then |
|
22761 |
+ break |
|
22762 |
+ fi |
|
22763 |
+ done |
|
22764 |
+ fi |
|
22765 |
+ if test "X$found_dir" != "X"; then |
|
22766 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-L$found_dir -l$name" |
|
22767 |
+ if test "X$found_so" != "X"; then |
|
22768 |
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then |
|
22769 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
22770 |
+ else |
|
22771 |
+ haveit= |
|
22772 |
+ for x in $ltrpathdirs; do |
|
22773 |
+ if test "X$x" = "X$found_dir"; then |
|
22774 |
+ haveit=yes |
|
22775 |
+ break |
|
22776 |
+ fi |
|
22777 |
+ done |
|
22778 |
+ if test -z "$haveit"; then |
|
22779 |
+ ltrpathdirs="$ltrpathdirs $found_dir" |
|
22780 |
+ fi |
|
22781 |
+ if test "$acl_hardcode_direct" = yes; then |
|
22782 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
22783 |
+ else |
|
22784 |
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then |
|
22785 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
22786 |
+ haveit= |
|
22787 |
+ for x in $rpathdirs; do |
|
22788 |
+ if test "X$x" = "X$found_dir"; then |
|
22789 |
+ haveit=yes |
|
22790 |
+ break |
|
22791 |
+ fi |
|
22792 |
+ done |
|
22793 |
+ if test -z "$haveit"; then |
|
22794 |
+ rpathdirs="$rpathdirs $found_dir" |
|
22795 |
+ fi |
|
22796 |
+ else |
|
22797 |
+ haveit= |
|
22798 |
+ for x in $LDFLAGS $LIBNCURSES; do |
|
22799 |
+ |
|
22800 |
+ acl_save_prefix="$prefix" |
|
22801 |
+ prefix="$acl_final_prefix" |
|
22802 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22803 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22804 |
+ eval x=\"$x\" |
|
22805 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22806 |
+ prefix="$acl_save_prefix" |
|
22807 |
+ |
|
22808 |
+ if test "X$x" = "X-L$found_dir"; then |
|
22809 |
+ haveit=yes |
|
22810 |
+ break |
|
22811 |
+ fi |
|
22812 |
+ done |
|
22813 |
+ if test -z "$haveit"; then |
|
22814 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$found_dir" |
|
22815 |
+ fi |
|
22816 |
+ if test "$acl_hardcode_minus_L" != no; then |
|
22817 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
22818 |
+ else |
|
22819 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-l$name" |
|
22820 |
+ fi |
|
22821 |
+ fi |
|
22822 |
+ fi |
|
22823 |
+ fi |
|
22824 |
+ else |
|
22825 |
+ if test "X$found_a" != "X"; then |
|
22826 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_a" |
|
22827 |
+ else |
|
22828 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$found_dir -l$name" |
|
22829 |
+ fi |
|
22830 |
+ fi |
|
22831 |
+ additional_includedir= |
|
22832 |
+ case "$found_dir" in |
|
22833 |
+ */$acl_libdirstem | */$acl_libdirstem/) |
|
22834 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` |
|
22835 |
+ LIBNCURSES_PREFIX="$basedir" |
|
22836 |
+ additional_includedir="$basedir/include" |
|
22837 |
+ ;; |
|
22838 |
+ */lib | */lib/) |
|
22839 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/lib/"'*$,,'` |
|
22840 |
+ LIBNCURSES_PREFIX="$basedir" |
|
22841 |
+ additional_includedir="$basedir/include" |
|
22842 |
+ ;; |
|
22843 |
+ esac |
|
22844 |
+ if test "X$additional_includedir" != "X"; then |
|
22845 |
+ if test "X$additional_includedir" != "X/usr/include"; then |
|
22846 |
+ haveit= |
|
22847 |
+ if test "X$additional_includedir" = "X/usr/local/include"; then |
|
22848 |
+ if test -n "$GCC"; then |
|
22849 |
+ case $host_os in |
|
22850 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
22851 |
+ esac |
|
22852 |
+ fi |
|
22853 |
+ fi |
|
22854 |
+ if test -z "$haveit"; then |
|
22855 |
+ for x in $CPPFLAGS $INCNCURSES; do |
|
22856 |
+ |
|
22857 |
+ acl_save_prefix="$prefix" |
|
22858 |
+ prefix="$acl_final_prefix" |
|
22859 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22860 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22861 |
+ eval x=\"$x\" |
|
22862 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22863 |
+ prefix="$acl_save_prefix" |
|
22864 |
+ |
|
22865 |
+ if test "X$x" = "X-I$additional_includedir"; then |
|
22866 |
+ haveit=yes |
|
22867 |
+ break |
|
22868 |
+ fi |
|
22869 |
+ done |
|
22870 |
+ if test -z "$haveit"; then |
|
22871 |
+ if test -d "$additional_includedir"; then |
|
22872 |
+ INCNCURSES="${INCNCURSES}${INCNCURSES:+ }-I$additional_includedir" |
|
22873 |
+ fi |
|
22874 |
+ fi |
|
22875 |
+ fi |
|
22876 |
+ fi |
|
22877 |
+ fi |
|
22878 |
+ if test -n "$found_la"; then |
|
22879 |
+ save_libdir="$libdir" |
|
22880 |
+ case "$found_la" in |
|
22881 |
+ */* | *\\*) . "$found_la" ;; |
|
22882 |
+ *) . "./$found_la" ;; |
|
22883 |
+ esac |
|
22884 |
+ libdir="$save_libdir" |
|
22885 |
+ for dep in $dependency_libs; do |
|
22886 |
+ case "$dep" in |
|
22887 |
+ -L*) |
|
22888 |
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` |
|
22889 |
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
|
22890 |
+ haveit= |
|
22891 |
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
|
22892 |
+ if test -n "$GCC"; then |
|
22893 |
+ case $host_os in |
|
22894 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
22895 |
+ esac |
|
22896 |
+ fi |
|
22897 |
+ fi |
|
22898 |
+ if test -z "$haveit"; then |
|
22899 |
+ haveit= |
|
22900 |
+ for x in $LDFLAGS $LIBNCURSES; do |
|
22901 |
+ |
|
22902 |
+ acl_save_prefix="$prefix" |
|
22903 |
+ prefix="$acl_final_prefix" |
|
22904 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22905 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22906 |
+ eval x=\"$x\" |
|
22907 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22908 |
+ prefix="$acl_save_prefix" |
|
22909 |
+ |
|
22910 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
22911 |
+ haveit=yes |
|
22912 |
+ break |
|
22913 |
+ fi |
|
22914 |
+ done |
|
22915 |
+ if test -z "$haveit"; then |
|
22916 |
+ if test -d "$additional_libdir"; then |
|
22917 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$additional_libdir" |
|
22918 |
+ fi |
|
22919 |
+ fi |
|
22920 |
+ haveit= |
|
22921 |
+ for x in $LDFLAGS $LTLIBNCURSES; do |
|
22922 |
+ |
|
22923 |
+ acl_save_prefix="$prefix" |
|
22924 |
+ prefix="$acl_final_prefix" |
|
22925 |
+ acl_save_exec_prefix="$exec_prefix" |
|
22926 |
+ exec_prefix="$acl_final_exec_prefix" |
|
22927 |
+ eval x=\"$x\" |
|
22928 |
+ exec_prefix="$acl_save_exec_prefix" |
|
22929 |
+ prefix="$acl_save_prefix" |
|
22930 |
+ |
|
22931 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
22932 |
+ haveit=yes |
|
22933 |
+ break |
|
22934 |
+ fi |
|
22935 |
+ done |
|
22936 |
+ if test -z "$haveit"; then |
|
22937 |
+ if test -d "$additional_libdir"; then |
|
22938 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-L$additional_libdir" |
|
22939 |
+ fi |
|
22940 |
+ fi |
|
22941 |
+ fi |
|
22942 |
+ fi |
|
22943 |
+ ;; |
|
22944 |
+ -R*) |
|
22945 |
+ dir=`echo "X$dep" | sed -e 's/^X-R//'` |
|
22946 |
+ if test "$enable_rpath" != no; then |
|
22947 |
+ haveit= |
|
22948 |
+ for x in $rpathdirs; do |
|
22949 |
+ if test "X$x" = "X$dir"; then |
|
22950 |
+ haveit=yes |
|
22951 |
+ break |
|
22952 |
+ fi |
|
22953 |
+ done |
|
22954 |
+ if test -z "$haveit"; then |
|
22955 |
+ rpathdirs="$rpathdirs $dir" |
|
22956 |
+ fi |
|
22957 |
+ haveit= |
|
22958 |
+ for x in $ltrpathdirs; do |
|
22959 |
+ if test "X$x" = "X$dir"; then |
|
22960 |
+ haveit=yes |
|
22961 |
+ break |
|
22962 |
+ fi |
|
22963 |
+ done |
|
22964 |
+ if test -z "$haveit"; then |
|
22965 |
+ ltrpathdirs="$ltrpathdirs $dir" |
|
22966 |
+ fi |
|
22967 |
+ fi |
|
22968 |
+ ;; |
|
22969 |
+ -l*) |
|
22970 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` |
|
22971 |
+ ;; |
|
22972 |
+ *.la) |
|
22973 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` |
|
22974 |
+ ;; |
|
22975 |
+ *) |
|
22976 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$dep" |
|
22977 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }$dep" |
|
22978 |
+ ;; |
|
22979 |
+ esac |
|
22980 |
+ done |
|
22981 |
+ fi |
|
22982 |
+ else |
|
22983 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-l$name" |
|
22984 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-l$name" |
|
22985 |
+ fi |
|
22986 |
+ fi |
|
22987 |
+ fi |
|
22988 |
+ done |
|
22989 |
+ done |
|
22990 |
+ if test "X$rpathdirs" != "X"; then |
|
22991 |
+ if test -n "$acl_hardcode_libdir_separator"; then |
|
22992 |
+ alldirs= |
|
22993 |
+ for found_dir in $rpathdirs; do |
|
22994 |
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" |
|
22995 |
+ done |
|
22996 |
+ acl_save_libdir="$libdir" |
|
22997 |
+ libdir="$alldirs" |
|
22998 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
22999 |
+ libdir="$acl_save_libdir" |
|
23000 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$flag" |
|
23001 |
+ else |
|
23002 |
+ for found_dir in $rpathdirs; do |
|
23003 |
+ acl_save_libdir="$libdir" |
|
23004 |
+ libdir="$found_dir" |
|
23005 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
23006 |
+ libdir="$acl_save_libdir" |
|
23007 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$flag" |
|
23008 |
+ done |
|
23009 |
+ fi |
|
23010 |
+ fi |
|
23011 |
+ if test "X$ltrpathdirs" != "X"; then |
|
23012 |
+ for found_dir in $ltrpathdirs; do |
|
23013 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-R$found_dir" |
|
23014 |
+ done |
|
23015 |
+ fi |
|
23016 |
+ |
|
23017 |
+ CPPFLAGS="$CPPFLAGS $INCNCURSES" |
|
23018 |
+ if test "${ac_cv_header_ncurses_ncurses_h+set}" = set; then |
|
23019 |
+ { echo "$as_me:$LINENO: checking for ncurses/ncurses.h" >&5 |
|
23020 |
+echo $ECHO_N "checking for ncurses/ncurses.h... $ECHO_C" >&6; } |
|
23021 |
+if test "${ac_cv_header_ncurses_ncurses_h+set}" = set; then |
|
23022 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
23023 |
+fi |
|
23024 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_ncurses_h" >&5 |
|
23025 |
+echo "${ECHO_T}$ac_cv_header_ncurses_ncurses_h" >&6; } |
|
23026 |
+else |
|
23027 |
+ # Is the header compilable? |
|
23028 |
+{ echo "$as_me:$LINENO: checking ncurses/ncurses.h usability" >&5 |
|
23029 |
+echo $ECHO_N "checking ncurses/ncurses.h usability... $ECHO_C" >&6; } |
|
23030 |
+cat >conftest.$ac_ext <<_ACEOF |
|
23031 |
+/* confdefs.h. */ |
|
23032 |
+_ACEOF |
|
23033 |
+cat confdefs.h >>conftest.$ac_ext |
|
23034 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23035 |
+/* end confdefs.h. */ |
|
23036 |
+$ac_includes_default |
|
23037 |
+#include <ncurses/ncurses.h> |
|
23038 |
+_ACEOF |
|
23039 |
+rm -f conftest.$ac_objext |
|
23040 |
+if { (ac_try="$ac_compile" |
|
23041 |
+case "(($ac_try" in |
|
23042 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23043 |
+ *) ac_try_echo=$ac_try;; |
|
23044 |
+esac |
|
23045 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23046 |
+ (eval "$ac_compile") 2>conftest.er1 |
|
23047 |
+ ac_status=$? |
|
23048 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23049 |
+ rm -f conftest.er1 |
|
23050 |
+ cat conftest.err >&5 |
|
23051 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23052 |
+ (exit $ac_status); } && { |
|
23053 |
+ test -z "$ac_c_werror_flag" || |
|
23054 |
+ test ! -s conftest.err |
|
23055 |
+ } && test -s conftest.$ac_objext; then |
|
23056 |
+ ac_header_compiler=yes |
|
23057 |
+else |
|
23058 |
+ echo "$as_me: failed program was:" >&5 |
|
23059 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23060 |
+ |
|
23061 |
+ ac_header_compiler=no |
|
23062 |
+fi |
|
23063 |
+ |
|
23064 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
23065 |
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 |
|
23066 |
+echo "${ECHO_T}$ac_header_compiler" >&6; } |
|
23067 |
+ |
|
23068 |
+# Is the header present? |
|
23069 |
+{ echo "$as_me:$LINENO: checking ncurses/ncurses.h presence" >&5 |
|
23070 |
+echo $ECHO_N "checking ncurses/ncurses.h presence... $ECHO_C" >&6; } |
|
23071 |
+cat >conftest.$ac_ext <<_ACEOF |
|
23072 |
+/* confdefs.h. */ |
|
23073 |
+_ACEOF |
|
23074 |
+cat confdefs.h >>conftest.$ac_ext |
|
23075 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23076 |
+/* end confdefs.h. */ |
|
23077 |
+#include <ncurses/ncurses.h> |
|
23078 |
+_ACEOF |
|
23079 |
+if { (ac_try="$ac_cpp conftest.$ac_ext" |
|
23080 |
+case "(($ac_try" in |
|
23081 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23082 |
+ *) ac_try_echo=$ac_try;; |
|
23083 |
+esac |
|
23084 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23085 |
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 |
|
23086 |
+ ac_status=$? |
|
23087 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23088 |
+ rm -f conftest.er1 |
|
23089 |
+ cat conftest.err >&5 |
|
23090 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23091 |
+ (exit $ac_status); } >/dev/null && { |
|
23092 |
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || |
|
23093 |
+ test ! -s conftest.err |
|
23094 |
+ }; then |
|
23095 |
+ ac_header_preproc=yes |
|
23096 |
+else |
|
23097 |
+ echo "$as_me: failed program was:" >&5 |
|
23098 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23099 |
+ |
|
23100 |
+ ac_header_preproc=no |
|
23101 |
+fi |
|
23102 |
+ |
|
23103 |
+rm -f conftest.err conftest.$ac_ext |
|
23104 |
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 |
|
23105 |
+echo "${ECHO_T}$ac_header_preproc" >&6; } |
|
23106 |
+ |
|
23107 |
+# So? What about this header? |
|
23108 |
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in |
|
23109 |
+ yes:no: ) |
|
23110 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&5 |
|
23111 |
+echo "$as_me: WARNING: ncurses/ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} |
|
23112 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: proceeding with the compiler's result" >&5 |
|
23113 |
+echo "$as_me: WARNING: ncurses/ncurses.h: proceeding with the compiler's result" >&2;} |
|
23114 |
+ ac_header_preproc=yes |
|
23115 |
+ ;; |
|
23116 |
+ no:yes:* ) |
|
23117 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: present but cannot be compiled" >&5 |
|
23118 |
+echo "$as_me: WARNING: ncurses/ncurses.h: present but cannot be compiled" >&2;} |
|
23119 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: check for missing prerequisite headers?" >&5 |
|
23120 |
+echo "$as_me: WARNING: ncurses/ncurses.h: check for missing prerequisite headers?" >&2;} |
|
23121 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: see the Autoconf documentation" >&5 |
|
23122 |
+echo "$as_me: WARNING: ncurses/ncurses.h: see the Autoconf documentation" >&2;} |
|
23123 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: section \"Present But Cannot Be Compiled\"" >&5 |
|
23124 |
+echo "$as_me: WARNING: ncurses/ncurses.h: section \"Present But Cannot Be Compiled\"" >&2;} |
|
23125 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: proceeding with the preprocessor's result" >&5 |
|
23126 |
+echo "$as_me: WARNING: ncurses/ncurses.h: proceeding with the preprocessor's result" >&2;} |
|
23127 |
+ { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: in the future, the compiler will take precedence" >&5 |
|
23128 |
+echo "$as_me: WARNING: ncurses/ncurses.h: in the future, the compiler will take precedence" >&2;} |
|
23129 |
+ ( cat <<\_ASBOX |
|
23130 |
+## -------------------------------------- ## |
|
23131 |
+## Report this to http://bugs.clamav.net/ ## |
|
23132 |
+## -------------------------------------- ## |
|
23133 |
+_ASBOX |
|
23134 |
+ ) | sed "s/^/$as_me: WARNING: /" >&2 |
|
23135 |
+ ;; |
|
23136 |
+esac |
|
23137 |
+{ echo "$as_me:$LINENO: checking for ncurses/ncurses.h" >&5 |
|
23138 |
+echo $ECHO_N "checking for ncurses/ncurses.h... $ECHO_C" >&6; } |
|
23139 |
+if test "${ac_cv_header_ncurses_ncurses_h+set}" = set; then |
|
23140 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
23141 |
+else |
|
23142 |
+ ac_cv_header_ncurses_ncurses_h=$ac_header_preproc |
|
23143 |
+fi |
|
23144 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_ncurses_h" >&5 |
|
23145 |
+echo "${ECHO_T}$ac_cv_header_ncurses_ncurses_h" >&6; } |
|
23146 |
+ |
|
23147 |
+fi |
|
23148 |
+if test $ac_cv_header_ncurses_ncurses_h = yes; then |
|
23149 |
+ have_header=yes |
|
23150 |
+else |
|
23151 |
+ have_header=no |
|
23152 |
+fi |
|
23153 |
+ |
|
23154 |
+ |
|
23155 |
+ ac_cv_findlib_NCURSES_libs= |
|
23156 |
+ ac_cv_findlib_NCURSES_ltlibs= |
|
23157 |
+ ac_cv_findlib_NCURSES_inc= |
|
23158 |
+ if test "$have_header" = "yes"; then |
|
23159 |
+ |
|
23160 |
+ LIBS="$LIBS $LIBNCURSES" |
|
23161 |
+ { echo "$as_me:$LINENO: checking linking with ncurses" >&5 |
|
23162 |
+echo $ECHO_N "checking linking with ncurses... $ECHO_C" >&6; } |
|
23163 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
23164 |
+/* confdefs.h. */ |
|
23165 |
+_ACEOF |
|
23166 |
+cat confdefs.h >>conftest.$ac_ext |
|
23167 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23168 |
+/* end confdefs.h. */ |
|
23169 |
+#include <ncurses/ncurses.h> |
|
23170 |
+int |
|
23171 |
+main () |
|
23172 |
+{ |
|
23173 |
+initscr(); KEY_RESIZE; |
|
23174 |
+ ; |
|
23175 |
+ return 0; |
|
23176 |
+} |
|
23177 |
+_ACEOF |
|
23178 |
+rm -f conftest.$ac_objext conftest$ac_exeext |
|
23179 |
+if { (ac_try="$ac_link" |
|
23180 |
+case "(($ac_try" in |
|
23181 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23182 |
+ *) ac_try_echo=$ac_try;; |
|
23183 |
+esac |
|
23184 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23185 |
+ (eval "$ac_link") 2>conftest.er1 |
|
23186 |
+ ac_status=$? |
|
23187 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23188 |
+ rm -f conftest.er1 |
|
23189 |
+ cat conftest.err >&5 |
|
23190 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23191 |
+ (exit $ac_status); } && { |
|
23192 |
+ test -z "$ac_c_werror_flag" || |
|
23193 |
+ test ! -s conftest.err |
|
23194 |
+ } && test -s conftest$ac_exeext && |
|
23195 |
+ $as_test_x conftest$ac_exeext; then |
|
23196 |
+ |
|
23197 |
+ ac_cv_findlib_NCURSES_libs="$LIBNCURSES" |
|
23198 |
+ ac_cv_findlib_NCURSES_ltlibs="$LTLIBNCURSES" |
|
23199 |
+ ac_cv_findlib_NCURSES_inc="$INCNCURSES" |
|
23200 |
+ |
|
23201 |
+else |
|
23202 |
+ echo "$as_me: failed program was:" >&5 |
|
23203 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23204 |
+ |
|
23205 |
+ |
|
23206 |
+fi |
|
23207 |
+ |
|
23208 |
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
23209 |
+ conftest$ac_exeext conftest.$ac_ext |
|
23210 |
+ |
|
23211 |
+fi |
|
23212 |
+ |
|
23213 |
+ CPPFLAGS="$save_CPPFLAGS" |
|
23214 |
+ LIBS="$save_LIBS" |
|
23215 |
+ if test "X$ac_cv_findlib_NCURSES_libs" = "X"; then |
|
23216 |
+ |
|
23217 |
+ { echo "$as_me:$LINENO: unable to compile/link with ncurses" >&5 |
|
23218 |
+echo "$as_me: unable to compile/link with ncurses" >&6;} |
|
23219 |
+ HAVE_LIBNCURSES=no |
|
23220 |
+ |
|
23221 |
+ |
|
23222 |
+else |
|
23223 |
+ |
|
23224 |
+ { echo "$as_me:$LINENO: Compiling and linking with ncurses by using $ac_cv_findlib_NCURSES_inc $ac_cv_findlib_NCURSES_libs" >&5 |
|
23225 |
+echo "$as_me: Compiling and linking with ncurses by using $ac_cv_findlib_NCURSES_inc $ac_cv_findlib_NCURSES_libs" >&6;} |
|
23226 |
+ |
|
23227 |
+cat >>confdefs.h <<\_ACEOF |
|
23228 |
+#define HAVE_LIBNCURSES 1 |
|
23229 |
+_ACEOF |
|
23230 |
+ |
|
23231 |
+ HAVE_LIBNCURSES=yes |
|
23232 |
+ LIBNCURSES="$ac_cv_findlib_NCURSES_libs" |
|
23233 |
+ LTLIBNCURSES="$ac_cv_findlib_NCURSES_ltlibs" |
|
23234 |
+ INCNCURSES="$ac_cv_findlib_NCURSES_inc" |
|
23235 |
+ CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES"; |
|
23236 |
+ CURSES_INCLUDE="<ncurses/ncurses.h>" |
|
23237 |
+ |
|
23238 |
+fi |
|
23239 |
+ |
|
23240 |
+ |
|
23241 |
+ |
|
23242 |
+ |
|
23243 |
+if test "X$HAVE_LIBNCURSES" != "Xyes"; then |
|
23244 |
+ HAVE_LIBNCURSES= |
|
23245 |
+ |
|
23246 |
+ |
|
23247 |
+ |
|
23248 |
+ |
|
23249 |
+ |
|
23250 |
+ save_CPPFLAGS="$CPPFLAGS" |
|
23251 |
+ save_LIBS="$LIBS" |
|
23252 |
+ |
|
23253 |
+ |
|
23254 |
+ |
|
23255 |
+ |
|
23256 |
+ use_additional=yes |
|
23257 |
+ |
|
23258 |
+ acl_save_prefix="$prefix" |
|
23259 |
+ prefix="$acl_final_prefix" |
|
23260 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23261 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23262 |
+ |
|
23263 |
+ eval additional_includedir=\"$includedir\" |
|
23264 |
+ eval additional_libdir=\"$libdir\" |
|
23265 |
+ |
|
23266 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23267 |
+ prefix="$acl_save_prefix" |
|
23268 |
+ |
|
23269 |
+ |
|
23270 |
+# Check whether --with-libncurses-prefix was given. |
|
23271 |
+if test "${with_libncurses_prefix+set}" = set; then |
|
23272 |
+ withval=$with_libncurses_prefix; |
|
23273 |
+ if test "X$withval" = "Xno"; then |
|
23274 |
+ use_additional=no |
|
23275 |
+ else |
|
23276 |
+ additional_compat_libdir= |
|
23277 |
+ if test "X$withval" = "X"; then |
|
23278 |
+ |
|
23279 |
+ acl_save_prefix="$prefix" |
|
23280 |
+ prefix="$acl_final_prefix" |
|
23281 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23282 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23283 |
+ |
|
23284 |
+ eval additional_includedir=\"$includedir\" |
|
23285 |
+ eval additional_libdir=\"$libdir\" |
|
23286 |
+ |
|
23287 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23288 |
+ prefix="$acl_save_prefix" |
|
23289 |
+ |
|
23290 |
+ else |
|
23291 |
+ additional_includedir="$withval/include" |
|
23292 |
+ additional_libdir="$withval/$acl_libdirstem" |
|
23293 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
23294 |
+ additional_compat_libdir="-L$withval/lib" |
|
23295 |
+ fi |
|
23296 |
+ fi |
|
23297 |
+ fi |
|
23298 |
+ |
|
23299 |
+fi |
|
23300 |
+ |
|
23301 |
+ LIBNCURSES= |
|
23302 |
+ LTLIBNCURSES= |
|
23303 |
+ INCNCURSES= |
|
23304 |
+ LIBNCURSES_PREFIX= |
|
23305 |
+ rpathdirs= |
|
23306 |
+ ltrpathdirs= |
|
23307 |
+ names_already_handled= |
|
23308 |
+ names_next_round='ncurses ' |
|
23309 |
+ while test -n "$names_next_round"; do |
|
23310 |
+ names_this_round="$names_next_round" |
|
23311 |
+ names_next_round= |
|
23312 |
+ for name in $names_this_round; do |
|
23313 |
+ already_handled= |
|
23314 |
+ for n in $names_already_handled; do |
|
23315 |
+ if test "$n" = "$name"; then |
|
23316 |
+ already_handled=yes |
|
23317 |
+ break |
|
23318 |
+ fi |
|
23319 |
+ done |
|
23320 |
+ if test -z "$already_handled"; then |
|
23321 |
+ names_already_handled="$names_already_handled $name" |
|
23322 |
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` |
|
23323 |
+ eval value=\"\$HAVE_LIB$uppername\" |
|
23324 |
+ if test -n "$value"; then |
|
23325 |
+ if test "$value" = yes; then |
|
23326 |
+ eval value=\"\$LIB$uppername\" |
|
23327 |
+ test -z "$value" || LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$value" |
|
23328 |
+ eval value=\"\$LTLIB$uppername\" |
|
23329 |
+ test -z "$value" || LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }$value" |
|
23330 |
+ else |
|
23331 |
+ : |
|
23332 |
+ fi |
|
23333 |
+ else |
|
23334 |
+ found_dir= |
|
23335 |
+ found_la= |
|
23336 |
+ found_so= |
|
23337 |
+ found_a= |
|
23338 |
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name |
|
23339 |
+ if test -n "$acl_shlibext"; then |
|
23340 |
+ shrext=".$acl_shlibext" # typically: shrext=.so |
|
23341 |
+ else |
|
23342 |
+ shrext= |
|
23343 |
+ fi |
|
23344 |
+ if test $use_additional = yes; then |
|
23345 |
+ dir="$additional_libdir" |
|
23346 |
+ if test -n "$acl_shlibext"; then |
|
23347 |
+ if test -f "$dir/$libname$shrext"; then |
|
23348 |
+ found_dir="$dir" |
|
23349 |
+ found_so="$dir/$libname$shrext" |
|
23350 |
+ else |
|
23351 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
23352 |
+ ver=`(cd "$dir" && \ |
|
23353 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
23354 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
23355 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
23356 |
+ | sed 1q ) 2>/dev/null` |
|
23357 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
23358 |
+ found_dir="$dir" |
|
23359 |
+ found_so="$dir/$libname$shrext.$ver" |
|
23360 |
+ fi |
|
23361 |
+ else |
|
23362 |
+ eval library_names=\"$acl_library_names_spec\" |
|
23363 |
+ for f in $library_names; do |
|
23364 |
+ if test -f "$dir/$f"; then |
|
23365 |
+ found_dir="$dir" |
|
23366 |
+ found_so="$dir/$f" |
|
23367 |
+ break |
|
23368 |
+ fi |
|
23369 |
+ done |
|
23370 |
+ fi |
|
23371 |
+ fi |
|
23372 |
+ fi |
|
23373 |
+ if test "X$found_dir" = "X"; then |
|
23374 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
23375 |
+ found_dir="$dir" |
|
23376 |
+ found_a="$dir/$libname.$acl_libext" |
|
23377 |
+ fi |
|
23378 |
+ fi |
|
23379 |
+ if test "X$found_dir" != "X"; then |
|
23380 |
+ if test -f "$dir/$libname.la"; then |
|
23381 |
+ found_la="$dir/$libname.la" |
|
23382 |
+ fi |
|
23383 |
+ fi |
|
23384 |
+ fi |
|
23385 |
+ if test "X$found_dir" = "X"; then |
|
23386 |
+ compat_libdir= |
|
23387 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
23388 |
+ compat_libdir=-L'${exec_prefix}'/lib |
|
23389 |
+ fi |
|
23390 |
+ for x in $LDFLAGS $LTLIBNCURSES $compat_libdir $additional_compat_libdir; do |
|
23391 |
+ |
|
23392 |
+ acl_save_prefix="$prefix" |
|
23393 |
+ prefix="$acl_final_prefix" |
|
23394 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23395 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23396 |
+ eval x=\"$x\" |
|
23397 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23398 |
+ prefix="$acl_save_prefix" |
|
23399 |
+ |
|
23400 |
+ case "$x" in |
|
23401 |
+ -L*) |
|
23402 |
+ dir=`echo "X$x" | sed -e 's/^X-L//'` |
|
23403 |
+ if test -n "$acl_shlibext"; then |
|
23404 |
+ if test -f "$dir/$libname$shrext"; then |
|
23405 |
+ found_dir="$dir" |
|
23406 |
+ found_so="$dir/$libname$shrext" |
|
23407 |
+ else |
|
23408 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
23409 |
+ ver=`(cd "$dir" && \ |
|
23410 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
23411 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
23412 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
23413 |
+ | sed 1q ) 2>/dev/null` |
|
23414 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
23415 |
+ found_dir="$dir" |
|
23416 |
+ found_so="$dir/$libname$shrext.$ver" |
|
23417 |
+ fi |
|
23418 |
+ else |
|
23419 |
+ eval library_names=\"$acl_library_names_spec\" |
|
23420 |
+ for f in $library_names; do |
|
23421 |
+ if test -f "$dir/$f"; then |
|
23422 |
+ found_dir="$dir" |
|
23423 |
+ found_so="$dir/$f" |
|
23424 |
+ break |
|
23425 |
+ fi |
|
23426 |
+ done |
|
23427 |
+ fi |
|
23428 |
+ fi |
|
23429 |
+ fi |
|
23430 |
+ if test "X$found_dir" = "X"; then |
|
23431 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
23432 |
+ found_dir="$dir" |
|
23433 |
+ found_a="$dir/$libname.$acl_libext" |
|
23434 |
+ fi |
|
23435 |
+ fi |
|
23436 |
+ if test "X$found_dir" != "X"; then |
|
23437 |
+ if test -f "$dir/$libname.la"; then |
|
23438 |
+ found_la="$dir/$libname.la" |
|
23439 |
+ fi |
|
23440 |
+ fi |
|
23441 |
+ ;; |
|
23442 |
+ esac |
|
23443 |
+ if test "X$found_dir" != "X"; then |
|
23444 |
+ break |
|
23445 |
+ fi |
|
23446 |
+ done |
|
23447 |
+ fi |
|
23448 |
+ if test "X$found_dir" != "X"; then |
|
23449 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-L$found_dir -l$name" |
|
23450 |
+ if test "X$found_so" != "X"; then |
|
23451 |
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then |
|
23452 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
23453 |
+ else |
|
23454 |
+ haveit= |
|
23455 |
+ for x in $ltrpathdirs; do |
|
23456 |
+ if test "X$x" = "X$found_dir"; then |
|
23457 |
+ haveit=yes |
|
23458 |
+ break |
|
23459 |
+ fi |
|
23460 |
+ done |
|
23461 |
+ if test -z "$haveit"; then |
|
23462 |
+ ltrpathdirs="$ltrpathdirs $found_dir" |
|
23463 |
+ fi |
|
23464 |
+ if test "$acl_hardcode_direct" = yes; then |
|
23465 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
23466 |
+ else |
|
23467 |
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then |
|
23468 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
23469 |
+ haveit= |
|
23470 |
+ for x in $rpathdirs; do |
|
23471 |
+ if test "X$x" = "X$found_dir"; then |
|
23472 |
+ haveit=yes |
|
23473 |
+ break |
|
23474 |
+ fi |
|
23475 |
+ done |
|
23476 |
+ if test -z "$haveit"; then |
|
23477 |
+ rpathdirs="$rpathdirs $found_dir" |
|
23478 |
+ fi |
|
23479 |
+ else |
|
23480 |
+ haveit= |
|
23481 |
+ for x in $LDFLAGS $LIBNCURSES; do |
|
23482 |
+ |
|
23483 |
+ acl_save_prefix="$prefix" |
|
23484 |
+ prefix="$acl_final_prefix" |
|
23485 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23486 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23487 |
+ eval x=\"$x\" |
|
23488 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23489 |
+ prefix="$acl_save_prefix" |
|
23490 |
+ |
|
23491 |
+ if test "X$x" = "X-L$found_dir"; then |
|
23492 |
+ haveit=yes |
|
23493 |
+ break |
|
23494 |
+ fi |
|
23495 |
+ done |
|
23496 |
+ if test -z "$haveit"; then |
|
23497 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$found_dir" |
|
23498 |
+ fi |
|
23499 |
+ if test "$acl_hardcode_minus_L" != no; then |
|
23500 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_so" |
|
23501 |
+ else |
|
23502 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-l$name" |
|
23503 |
+ fi |
|
23504 |
+ fi |
|
23505 |
+ fi |
|
23506 |
+ fi |
|
23507 |
+ else |
|
23508 |
+ if test "X$found_a" != "X"; then |
|
23509 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$found_a" |
|
23510 |
+ else |
|
23511 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$found_dir -l$name" |
|
23512 |
+ fi |
|
23513 |
+ fi |
|
23514 |
+ additional_includedir= |
|
23515 |
+ case "$found_dir" in |
|
23516 |
+ */$acl_libdirstem | */$acl_libdirstem/) |
|
23517 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` |
|
23518 |
+ LIBNCURSES_PREFIX="$basedir" |
|
23519 |
+ additional_includedir="$basedir/include" |
|
23520 |
+ ;; |
|
23521 |
+ */lib | */lib/) |
|
23522 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/lib/"'*$,,'` |
|
23523 |
+ LIBNCURSES_PREFIX="$basedir" |
|
23524 |
+ additional_includedir="$basedir/include" |
|
23525 |
+ ;; |
|
23526 |
+ esac |
|
23527 |
+ if test "X$additional_includedir" != "X"; then |
|
23528 |
+ if test "X$additional_includedir" != "X/usr/include"; then |
|
23529 |
+ haveit= |
|
23530 |
+ if test "X$additional_includedir" = "X/usr/local/include"; then |
|
23531 |
+ if test -n "$GCC"; then |
|
23532 |
+ case $host_os in |
|
23533 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
23534 |
+ esac |
|
23535 |
+ fi |
|
23536 |
+ fi |
|
23537 |
+ if test -z "$haveit"; then |
|
23538 |
+ for x in $CPPFLAGS $INCNCURSES; do |
|
23539 |
+ |
|
23540 |
+ acl_save_prefix="$prefix" |
|
23541 |
+ prefix="$acl_final_prefix" |
|
23542 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23543 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23544 |
+ eval x=\"$x\" |
|
23545 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23546 |
+ prefix="$acl_save_prefix" |
|
23547 |
+ |
|
23548 |
+ if test "X$x" = "X-I$additional_includedir"; then |
|
23549 |
+ haveit=yes |
|
23550 |
+ break |
|
23551 |
+ fi |
|
23552 |
+ done |
|
23553 |
+ if test -z "$haveit"; then |
|
23554 |
+ if test -d "$additional_includedir"; then |
|
23555 |
+ INCNCURSES="${INCNCURSES}${INCNCURSES:+ }-I$additional_includedir" |
|
23556 |
+ fi |
|
23557 |
+ fi |
|
23558 |
+ fi |
|
23559 |
+ fi |
|
23560 |
+ fi |
|
23561 |
+ if test -n "$found_la"; then |
|
23562 |
+ save_libdir="$libdir" |
|
23563 |
+ case "$found_la" in |
|
23564 |
+ */* | *\\*) . "$found_la" ;; |
|
23565 |
+ *) . "./$found_la" ;; |
|
23566 |
+ esac |
|
23567 |
+ libdir="$save_libdir" |
|
23568 |
+ for dep in $dependency_libs; do |
|
23569 |
+ case "$dep" in |
|
23570 |
+ -L*) |
|
23571 |
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` |
|
23572 |
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
|
23573 |
+ haveit= |
|
23574 |
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
|
23575 |
+ if test -n "$GCC"; then |
|
23576 |
+ case $host_os in |
|
23577 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
23578 |
+ esac |
|
23579 |
+ fi |
|
23580 |
+ fi |
|
23581 |
+ if test -z "$haveit"; then |
|
23582 |
+ haveit= |
|
23583 |
+ for x in $LDFLAGS $LIBNCURSES; do |
|
23584 |
+ |
|
23585 |
+ acl_save_prefix="$prefix" |
|
23586 |
+ prefix="$acl_final_prefix" |
|
23587 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23588 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23589 |
+ eval x=\"$x\" |
|
23590 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23591 |
+ prefix="$acl_save_prefix" |
|
23592 |
+ |
|
23593 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
23594 |
+ haveit=yes |
|
23595 |
+ break |
|
23596 |
+ fi |
|
23597 |
+ done |
|
23598 |
+ if test -z "$haveit"; then |
|
23599 |
+ if test -d "$additional_libdir"; then |
|
23600 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-L$additional_libdir" |
|
23601 |
+ fi |
|
23602 |
+ fi |
|
23603 |
+ haveit= |
|
23604 |
+ for x in $LDFLAGS $LTLIBNCURSES; do |
|
23605 |
+ |
|
23606 |
+ acl_save_prefix="$prefix" |
|
23607 |
+ prefix="$acl_final_prefix" |
|
23608 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23609 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23610 |
+ eval x=\"$x\" |
|
23611 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23612 |
+ prefix="$acl_save_prefix" |
|
23613 |
+ |
|
23614 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
23615 |
+ haveit=yes |
|
23616 |
+ break |
|
23617 |
+ fi |
|
23618 |
+ done |
|
23619 |
+ if test -z "$haveit"; then |
|
23620 |
+ if test -d "$additional_libdir"; then |
|
23621 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-L$additional_libdir" |
|
23622 |
+ fi |
|
23623 |
+ fi |
|
23624 |
+ fi |
|
23625 |
+ fi |
|
23626 |
+ ;; |
|
23627 |
+ -R*) |
|
23628 |
+ dir=`echo "X$dep" | sed -e 's/^X-R//'` |
|
23629 |
+ if test "$enable_rpath" != no; then |
|
23630 |
+ haveit= |
|
23631 |
+ for x in $rpathdirs; do |
|
23632 |
+ if test "X$x" = "X$dir"; then |
|
23633 |
+ haveit=yes |
|
23634 |
+ break |
|
23635 |
+ fi |
|
23636 |
+ done |
|
23637 |
+ if test -z "$haveit"; then |
|
23638 |
+ rpathdirs="$rpathdirs $dir" |
|
23639 |
+ fi |
|
23640 |
+ haveit= |
|
23641 |
+ for x in $ltrpathdirs; do |
|
23642 |
+ if test "X$x" = "X$dir"; then |
|
23643 |
+ haveit=yes |
|
23644 |
+ break |
|
23645 |
+ fi |
|
23646 |
+ done |
|
23647 |
+ if test -z "$haveit"; then |
|
23648 |
+ ltrpathdirs="$ltrpathdirs $dir" |
|
23649 |
+ fi |
|
23650 |
+ fi |
|
23651 |
+ ;; |
|
23652 |
+ -l*) |
|
23653 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` |
|
23654 |
+ ;; |
|
23655 |
+ *.la) |
|
23656 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` |
|
23657 |
+ ;; |
|
23658 |
+ *) |
|
23659 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$dep" |
|
23660 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }$dep" |
|
23661 |
+ ;; |
|
23662 |
+ esac |
|
23663 |
+ done |
|
23664 |
+ fi |
|
23665 |
+ else |
|
23666 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }-l$name" |
|
23667 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-l$name" |
|
23668 |
+ fi |
|
23669 |
+ fi |
|
23670 |
+ fi |
|
23671 |
+ done |
|
23672 |
+ done |
|
23673 |
+ if test "X$rpathdirs" != "X"; then |
|
23674 |
+ if test -n "$acl_hardcode_libdir_separator"; then |
|
23675 |
+ alldirs= |
|
23676 |
+ for found_dir in $rpathdirs; do |
|
23677 |
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" |
|
23678 |
+ done |
|
23679 |
+ acl_save_libdir="$libdir" |
|
23680 |
+ libdir="$alldirs" |
|
23681 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
23682 |
+ libdir="$acl_save_libdir" |
|
23683 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$flag" |
|
23684 |
+ else |
|
23685 |
+ for found_dir in $rpathdirs; do |
|
23686 |
+ acl_save_libdir="$libdir" |
|
23687 |
+ libdir="$found_dir" |
|
23688 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
23689 |
+ libdir="$acl_save_libdir" |
|
23690 |
+ LIBNCURSES="${LIBNCURSES}${LIBNCURSES:+ }$flag" |
|
23691 |
+ done |
|
23692 |
+ fi |
|
23693 |
+ fi |
|
23694 |
+ if test "X$ltrpathdirs" != "X"; then |
|
23695 |
+ for found_dir in $ltrpathdirs; do |
|
23696 |
+ LTLIBNCURSES="${LTLIBNCURSES}${LTLIBNCURSES:+ }-R$found_dir" |
|
23697 |
+ done |
|
23698 |
+ fi |
|
23699 |
+ |
|
23700 |
+ CPPFLAGS="$CPPFLAGS $INCNCURSES" |
|
23701 |
+ if test "${ac_cv_header_ncurses_h+set}" = set; then |
|
23702 |
+ { echo "$as_me:$LINENO: checking for ncurses.h" >&5 |
|
23703 |
+echo $ECHO_N "checking for ncurses.h... $ECHO_C" >&6; } |
|
23704 |
+if test "${ac_cv_header_ncurses_h+set}" = set; then |
|
23705 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
23706 |
+fi |
|
23707 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_h" >&5 |
|
23708 |
+echo "${ECHO_T}$ac_cv_header_ncurses_h" >&6; } |
|
23709 |
+else |
|
23710 |
+ # Is the header compilable? |
|
23711 |
+{ echo "$as_me:$LINENO: checking ncurses.h usability" >&5 |
|
23712 |
+echo $ECHO_N "checking ncurses.h usability... $ECHO_C" >&6; } |
|
23713 |
+cat >conftest.$ac_ext <<_ACEOF |
|
23714 |
+/* confdefs.h. */ |
|
23715 |
+_ACEOF |
|
23716 |
+cat confdefs.h >>conftest.$ac_ext |
|
23717 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23718 |
+/* end confdefs.h. */ |
|
23719 |
+$ac_includes_default |
|
23720 |
+#include <ncurses.h> |
|
23721 |
+_ACEOF |
|
23722 |
+rm -f conftest.$ac_objext |
|
23723 |
+if { (ac_try="$ac_compile" |
|
23724 |
+case "(($ac_try" in |
|
23725 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23726 |
+ *) ac_try_echo=$ac_try;; |
|
23727 |
+esac |
|
23728 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23729 |
+ (eval "$ac_compile") 2>conftest.er1 |
|
23730 |
+ ac_status=$? |
|
23731 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23732 |
+ rm -f conftest.er1 |
|
23733 |
+ cat conftest.err >&5 |
|
23734 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23735 |
+ (exit $ac_status); } && { |
|
23736 |
+ test -z "$ac_c_werror_flag" || |
|
23737 |
+ test ! -s conftest.err |
|
23738 |
+ } && test -s conftest.$ac_objext; then |
|
23739 |
+ ac_header_compiler=yes |
|
23740 |
+else |
|
23741 |
+ echo "$as_me: failed program was:" >&5 |
|
23742 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23743 |
+ |
|
23744 |
+ ac_header_compiler=no |
|
23745 |
+fi |
|
23746 |
+ |
|
23747 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
23748 |
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 |
|
23749 |
+echo "${ECHO_T}$ac_header_compiler" >&6; } |
|
23750 |
+ |
|
23751 |
+# Is the header present? |
|
23752 |
+{ echo "$as_me:$LINENO: checking ncurses.h presence" >&5 |
|
23753 |
+echo $ECHO_N "checking ncurses.h presence... $ECHO_C" >&6; } |
|
23754 |
+cat >conftest.$ac_ext <<_ACEOF |
|
23755 |
+/* confdefs.h. */ |
|
23756 |
+_ACEOF |
|
23757 |
+cat confdefs.h >>conftest.$ac_ext |
|
23758 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23759 |
+/* end confdefs.h. */ |
|
23760 |
+#include <ncurses.h> |
|
23761 |
+_ACEOF |
|
23762 |
+if { (ac_try="$ac_cpp conftest.$ac_ext" |
|
23763 |
+case "(($ac_try" in |
|
23764 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23765 |
+ *) ac_try_echo=$ac_try;; |
|
23766 |
+esac |
|
23767 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23768 |
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 |
|
23769 |
+ ac_status=$? |
|
23770 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23771 |
+ rm -f conftest.er1 |
|
23772 |
+ cat conftest.err >&5 |
|
23773 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23774 |
+ (exit $ac_status); } >/dev/null && { |
|
23775 |
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || |
|
23776 |
+ test ! -s conftest.err |
|
23777 |
+ }; then |
|
23778 |
+ ac_header_preproc=yes |
|
23779 |
+else |
|
23780 |
+ echo "$as_me: failed program was:" >&5 |
|
23781 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23782 |
+ |
|
23783 |
+ ac_header_preproc=no |
|
23784 |
+fi |
|
23785 |
+ |
|
23786 |
+rm -f conftest.err conftest.$ac_ext |
|
23787 |
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 |
|
23788 |
+echo "${ECHO_T}$ac_header_preproc" >&6; } |
|
23789 |
+ |
|
23790 |
+# So? What about this header? |
|
23791 |
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in |
|
23792 |
+ yes:no: ) |
|
23793 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&5 |
|
23794 |
+echo "$as_me: WARNING: ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} |
|
23795 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: proceeding with the compiler's result" >&5 |
|
23796 |
+echo "$as_me: WARNING: ncurses.h: proceeding with the compiler's result" >&2;} |
|
23797 |
+ ac_header_preproc=yes |
|
23798 |
+ ;; |
|
23799 |
+ no:yes:* ) |
|
23800 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: present but cannot be compiled" >&5 |
|
23801 |
+echo "$as_me: WARNING: ncurses.h: present but cannot be compiled" >&2;} |
|
23802 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: check for missing prerequisite headers?" >&5 |
|
23803 |
+echo "$as_me: WARNING: ncurses.h: check for missing prerequisite headers?" >&2;} |
|
23804 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: see the Autoconf documentation" >&5 |
|
23805 |
+echo "$as_me: WARNING: ncurses.h: see the Autoconf documentation" >&2;} |
|
23806 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: section \"Present But Cannot Be Compiled\"" >&5 |
|
23807 |
+echo "$as_me: WARNING: ncurses.h: section \"Present But Cannot Be Compiled\"" >&2;} |
|
23808 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: proceeding with the preprocessor's result" >&5 |
|
23809 |
+echo "$as_me: WARNING: ncurses.h: proceeding with the preprocessor's result" >&2;} |
|
23810 |
+ { echo "$as_me:$LINENO: WARNING: ncurses.h: in the future, the compiler will take precedence" >&5 |
|
23811 |
+echo "$as_me: WARNING: ncurses.h: in the future, the compiler will take precedence" >&2;} |
|
23812 |
+ ( cat <<\_ASBOX |
|
23813 |
+## -------------------------------------- ## |
|
23814 |
+## Report this to http://bugs.clamav.net/ ## |
|
23815 |
+## -------------------------------------- ## |
|
23816 |
+_ASBOX |
|
23817 |
+ ) | sed "s/^/$as_me: WARNING: /" >&2 |
|
23818 |
+ ;; |
|
23819 |
+esac |
|
23820 |
+{ echo "$as_me:$LINENO: checking for ncurses.h" >&5 |
|
23821 |
+echo $ECHO_N "checking for ncurses.h... $ECHO_C" >&6; } |
|
23822 |
+if test "${ac_cv_header_ncurses_h+set}" = set; then |
|
23823 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
23824 |
+else |
|
23825 |
+ ac_cv_header_ncurses_h=$ac_header_preproc |
|
23826 |
+fi |
|
23827 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_h" >&5 |
|
23828 |
+echo "${ECHO_T}$ac_cv_header_ncurses_h" >&6; } |
|
23829 |
+ |
|
23830 |
+fi |
|
23831 |
+if test $ac_cv_header_ncurses_h = yes; then |
|
23832 |
+ have_header=yes |
|
23833 |
+else |
|
23834 |
+ have_header=no |
|
23835 |
+fi |
|
23836 |
+ |
|
23837 |
+ |
|
23838 |
+ ac_cv_findlib_NCURSES_libs= |
|
23839 |
+ ac_cv_findlib_NCURSES_ltlibs= |
|
23840 |
+ ac_cv_findlib_NCURSES_inc= |
|
23841 |
+ if test "$have_header" = "yes"; then |
|
23842 |
+ |
|
23843 |
+ LIBS="$LIBS $LIBNCURSES" |
|
23844 |
+ { echo "$as_me:$LINENO: checking linking with ncurses" >&5 |
|
23845 |
+echo $ECHO_N "checking linking with ncurses... $ECHO_C" >&6; } |
|
23846 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
23847 |
+/* confdefs.h. */ |
|
23848 |
+_ACEOF |
|
23849 |
+cat confdefs.h >>conftest.$ac_ext |
|
23850 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
23851 |
+/* end confdefs.h. */ |
|
23852 |
+#include <ncurses.h> |
|
23853 |
+int |
|
23854 |
+main () |
|
23855 |
+{ |
|
23856 |
+initscr(); KEY_RESIZE; |
|
23857 |
+ ; |
|
23858 |
+ return 0; |
|
23859 |
+} |
|
23860 |
+_ACEOF |
|
23861 |
+rm -f conftest.$ac_objext conftest$ac_exeext |
|
23862 |
+if { (ac_try="$ac_link" |
|
23863 |
+case "(($ac_try" in |
|
23864 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
23865 |
+ *) ac_try_echo=$ac_try;; |
|
23866 |
+esac |
|
23867 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
23868 |
+ (eval "$ac_link") 2>conftest.er1 |
|
23869 |
+ ac_status=$? |
|
23870 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
23871 |
+ rm -f conftest.er1 |
|
23872 |
+ cat conftest.err >&5 |
|
23873 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
23874 |
+ (exit $ac_status); } && { |
|
23875 |
+ test -z "$ac_c_werror_flag" || |
|
23876 |
+ test ! -s conftest.err |
|
23877 |
+ } && test -s conftest$ac_exeext && |
|
23878 |
+ $as_test_x conftest$ac_exeext; then |
|
23879 |
+ |
|
23880 |
+ ac_cv_findlib_NCURSES_libs="$LIBNCURSES" |
|
23881 |
+ ac_cv_findlib_NCURSES_ltlibs="$LTLIBNCURSES" |
|
23882 |
+ ac_cv_findlib_NCURSES_inc="$INCNCURSES" |
|
23883 |
+ |
|
23884 |
+else |
|
23885 |
+ echo "$as_me: failed program was:" >&5 |
|
23886 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
23887 |
+ |
|
23888 |
+ |
|
23889 |
+fi |
|
23890 |
+ |
|
23891 |
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
23892 |
+ conftest$ac_exeext conftest.$ac_ext |
|
23893 |
+ |
|
23894 |
+fi |
|
23895 |
+ |
|
23896 |
+ CPPFLAGS="$save_CPPFLAGS" |
|
23897 |
+ LIBS="$save_LIBS" |
|
23898 |
+ if test "X$ac_cv_findlib_NCURSES_libs" = "X"; then |
|
23899 |
+ |
|
23900 |
+ { echo "$as_me:$LINENO: unable to compile/link with ncurses" >&5 |
|
23901 |
+echo "$as_me: unable to compile/link with ncurses" >&6;} |
|
23902 |
+ HAVE_LIBNCURSES=no |
|
23903 |
+ |
|
23904 |
+ |
|
23905 |
+else |
|
23906 |
+ |
|
23907 |
+ { echo "$as_me:$LINENO: Compiling and linking with ncurses by using $ac_cv_findlib_NCURSES_inc $ac_cv_findlib_NCURSES_libs" >&5 |
|
23908 |
+echo "$as_me: Compiling and linking with ncurses by using $ac_cv_findlib_NCURSES_inc $ac_cv_findlib_NCURSES_libs" >&6;} |
|
23909 |
+ |
|
23910 |
+cat >>confdefs.h <<\_ACEOF |
|
23911 |
+#define HAVE_LIBNCURSES 1 |
|
23912 |
+_ACEOF |
|
23913 |
+ |
|
23914 |
+ HAVE_LIBNCURSES=yes |
|
23915 |
+ LIBNCURSES="$ac_cv_findlib_NCURSES_libs" |
|
23916 |
+ LTLIBNCURSES="$ac_cv_findlib_NCURSES_ltlibs" |
|
23917 |
+ INCNCURSES="$ac_cv_findlib_NCURSES_inc" |
|
23918 |
+ CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES"; |
|
23919 |
+ CURSES_INCLUDE="<ncurses.h>" |
|
23920 |
+ |
|
23921 |
+fi |
|
23922 |
+ |
|
23923 |
+ |
|
23924 |
+ |
|
23925 |
+fi |
|
23926 |
+ |
|
23927 |
+if test "X$HAVE_LIBNCURSES" != "Xyes"; then |
|
23928 |
+ |
|
23929 |
+ |
|
23930 |
+ |
|
23931 |
+ |
|
23932 |
+ |
|
23933 |
+ save_CPPFLAGS="$CPPFLAGS" |
|
23934 |
+ save_LIBS="$LIBS" |
|
23935 |
+ |
|
23936 |
+ |
|
23937 |
+ |
|
23938 |
+ |
|
23939 |
+ use_additional=yes |
|
23940 |
+ |
|
23941 |
+ acl_save_prefix="$prefix" |
|
23942 |
+ prefix="$acl_final_prefix" |
|
23943 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23944 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23945 |
+ |
|
23946 |
+ eval additional_includedir=\"$includedir\" |
|
23947 |
+ eval additional_libdir=\"$libdir\" |
|
23948 |
+ |
|
23949 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23950 |
+ prefix="$acl_save_prefix" |
|
23951 |
+ |
|
23952 |
+ |
|
23953 |
+# Check whether --with-libpdcurses-prefix was given. |
|
23954 |
+if test "${with_libpdcurses_prefix+set}" = set; then |
|
23955 |
+ withval=$with_libpdcurses_prefix; |
|
23956 |
+ if test "X$withval" = "Xno"; then |
|
23957 |
+ use_additional=no |
|
23958 |
+ else |
|
23959 |
+ additional_compat_libdir= |
|
23960 |
+ if test "X$withval" = "X"; then |
|
23961 |
+ |
|
23962 |
+ acl_save_prefix="$prefix" |
|
23963 |
+ prefix="$acl_final_prefix" |
|
23964 |
+ acl_save_exec_prefix="$exec_prefix" |
|
23965 |
+ exec_prefix="$acl_final_exec_prefix" |
|
23966 |
+ |
|
23967 |
+ eval additional_includedir=\"$includedir\" |
|
23968 |
+ eval additional_libdir=\"$libdir\" |
|
23969 |
+ |
|
23970 |
+ exec_prefix="$acl_save_exec_prefix" |
|
23971 |
+ prefix="$acl_save_prefix" |
|
23972 |
+ |
|
23973 |
+ else |
|
23974 |
+ additional_includedir="$withval/include" |
|
23975 |
+ additional_libdir="$withval/$acl_libdirstem" |
|
23976 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
23977 |
+ additional_compat_libdir="-L$withval/lib" |
|
23978 |
+ fi |
|
23979 |
+ fi |
|
23980 |
+ fi |
|
23981 |
+ |
|
23982 |
+fi |
|
23983 |
+ |
|
23984 |
+ LIBPDCURSES= |
|
23985 |
+ LTLIBPDCURSES= |
|
23986 |
+ INCPDCURSES= |
|
23987 |
+ LIBPDCURSES_PREFIX= |
|
23988 |
+ rpathdirs= |
|
23989 |
+ ltrpathdirs= |
|
23990 |
+ names_already_handled= |
|
23991 |
+ names_next_round='pdcurses ' |
|
23992 |
+ while test -n "$names_next_round"; do |
|
23993 |
+ names_this_round="$names_next_round" |
|
23994 |
+ names_next_round= |
|
23995 |
+ for name in $names_this_round; do |
|
23996 |
+ already_handled= |
|
23997 |
+ for n in $names_already_handled; do |
|
23998 |
+ if test "$n" = "$name"; then |
|
23999 |
+ already_handled=yes |
|
24000 |
+ break |
|
24001 |
+ fi |
|
24002 |
+ done |
|
24003 |
+ if test -z "$already_handled"; then |
|
24004 |
+ names_already_handled="$names_already_handled $name" |
|
24005 |
+ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` |
|
24006 |
+ eval value=\"\$HAVE_LIB$uppername\" |
|
24007 |
+ if test -n "$value"; then |
|
24008 |
+ if test "$value" = yes; then |
|
24009 |
+ eval value=\"\$LIB$uppername\" |
|
24010 |
+ test -z "$value" || LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$value" |
|
24011 |
+ eval value=\"\$LTLIB$uppername\" |
|
24012 |
+ test -z "$value" || LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }$value" |
|
24013 |
+ else |
|
24014 |
+ : |
|
24015 |
+ fi |
|
24016 |
+ else |
|
24017 |
+ found_dir= |
|
24018 |
+ found_la= |
|
24019 |
+ found_so= |
|
24020 |
+ found_a= |
|
24021 |
+ eval libname=\"$acl_libname_spec\" # typically: libname=lib$name |
|
24022 |
+ if test -n "$acl_shlibext"; then |
|
24023 |
+ shrext=".$acl_shlibext" # typically: shrext=.so |
|
24024 |
+ else |
|
24025 |
+ shrext= |
|
24026 |
+ fi |
|
24027 |
+ if test $use_additional = yes; then |
|
24028 |
+ dir="$additional_libdir" |
|
24029 |
+ if test -n "$acl_shlibext"; then |
|
24030 |
+ if test -f "$dir/$libname$shrext"; then |
|
24031 |
+ found_dir="$dir" |
|
24032 |
+ found_so="$dir/$libname$shrext" |
|
24033 |
+ else |
|
24034 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
24035 |
+ ver=`(cd "$dir" && \ |
|
24036 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
24037 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
24038 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
24039 |
+ | sed 1q ) 2>/dev/null` |
|
24040 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
24041 |
+ found_dir="$dir" |
|
24042 |
+ found_so="$dir/$libname$shrext.$ver" |
|
24043 |
+ fi |
|
24044 |
+ else |
|
24045 |
+ eval library_names=\"$acl_library_names_spec\" |
|
24046 |
+ for f in $library_names; do |
|
24047 |
+ if test -f "$dir/$f"; then |
|
24048 |
+ found_dir="$dir" |
|
24049 |
+ found_so="$dir/$f" |
|
24050 |
+ break |
|
24051 |
+ fi |
|
24052 |
+ done |
|
24053 |
+ fi |
|
24054 |
+ fi |
|
24055 |
+ fi |
|
24056 |
+ if test "X$found_dir" = "X"; then |
|
24057 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
24058 |
+ found_dir="$dir" |
|
24059 |
+ found_a="$dir/$libname.$acl_libext" |
|
24060 |
+ fi |
|
24061 |
+ fi |
|
24062 |
+ if test "X$found_dir" != "X"; then |
|
24063 |
+ if test -f "$dir/$libname.la"; then |
|
24064 |
+ found_la="$dir/$libname.la" |
|
24065 |
+ fi |
|
24066 |
+ fi |
|
24067 |
+ fi |
|
24068 |
+ if test "X$found_dir" = "X"; then |
|
24069 |
+ compat_libdir= |
|
24070 |
+ if test "X$acl_libdirstem" != "Xlib"; then |
|
24071 |
+ compat_libdir=-L'${exec_prefix}'/lib |
|
24072 |
+ fi |
|
24073 |
+ for x in $LDFLAGS $LTLIBPDCURSES $compat_libdir $additional_compat_libdir; do |
|
24074 |
+ |
|
24075 |
+ acl_save_prefix="$prefix" |
|
24076 |
+ prefix="$acl_final_prefix" |
|
24077 |
+ acl_save_exec_prefix="$exec_prefix" |
|
24078 |
+ exec_prefix="$acl_final_exec_prefix" |
|
24079 |
+ eval x=\"$x\" |
|
24080 |
+ exec_prefix="$acl_save_exec_prefix" |
|
24081 |
+ prefix="$acl_save_prefix" |
|
24082 |
+ |
|
24083 |
+ case "$x" in |
|
24084 |
+ -L*) |
|
24085 |
+ dir=`echo "X$x" | sed -e 's/^X-L//'` |
|
24086 |
+ if test -n "$acl_shlibext"; then |
|
24087 |
+ if test -f "$dir/$libname$shrext"; then |
|
24088 |
+ found_dir="$dir" |
|
24089 |
+ found_so="$dir/$libname$shrext" |
|
24090 |
+ else |
|
24091 |
+ if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then |
|
24092 |
+ ver=`(cd "$dir" && \ |
|
24093 |
+ for f in "$libname$shrext".*; do echo "$f"; done \ |
|
24094 |
+ | sed -e "s,^$libname$shrext\\\\.,," \ |
|
24095 |
+ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ |
|
24096 |
+ | sed 1q ) 2>/dev/null` |
|
24097 |
+ if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then |
|
24098 |
+ found_dir="$dir" |
|
24099 |
+ found_so="$dir/$libname$shrext.$ver" |
|
24100 |
+ fi |
|
24101 |
+ else |
|
24102 |
+ eval library_names=\"$acl_library_names_spec\" |
|
24103 |
+ for f in $library_names; do |
|
24104 |
+ if test -f "$dir/$f"; then |
|
24105 |
+ found_dir="$dir" |
|
24106 |
+ found_so="$dir/$f" |
|
24107 |
+ break |
|
24108 |
+ fi |
|
24109 |
+ done |
|
24110 |
+ fi |
|
24111 |
+ fi |
|
24112 |
+ fi |
|
24113 |
+ if test "X$found_dir" = "X"; then |
|
24114 |
+ if test -f "$dir/$libname.$acl_libext"; then |
|
24115 |
+ found_dir="$dir" |
|
24116 |
+ found_a="$dir/$libname.$acl_libext" |
|
24117 |
+ fi |
|
24118 |
+ fi |
|
24119 |
+ if test "X$found_dir" != "X"; then |
|
24120 |
+ if test -f "$dir/$libname.la"; then |
|
24121 |
+ found_la="$dir/$libname.la" |
|
24122 |
+ fi |
|
24123 |
+ fi |
|
24124 |
+ ;; |
|
24125 |
+ esac |
|
24126 |
+ if test "X$found_dir" != "X"; then |
|
24127 |
+ break |
|
24128 |
+ fi |
|
24129 |
+ done |
|
24130 |
+ fi |
|
24131 |
+ if test "X$found_dir" != "X"; then |
|
24132 |
+ LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }-L$found_dir -l$name" |
|
24133 |
+ if test "X$found_so" != "X"; then |
|
24134 |
+ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then |
|
24135 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$found_so" |
|
24136 |
+ else |
|
24137 |
+ haveit= |
|
24138 |
+ for x in $ltrpathdirs; do |
|
24139 |
+ if test "X$x" = "X$found_dir"; then |
|
24140 |
+ haveit=yes |
|
24141 |
+ break |
|
24142 |
+ fi |
|
24143 |
+ done |
|
24144 |
+ if test -z "$haveit"; then |
|
24145 |
+ ltrpathdirs="$ltrpathdirs $found_dir" |
|
24146 |
+ fi |
|
24147 |
+ if test "$acl_hardcode_direct" = yes; then |
|
24148 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$found_so" |
|
24149 |
+ else |
|
24150 |
+ if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then |
|
24151 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$found_so" |
|
24152 |
+ haveit= |
|
24153 |
+ for x in $rpathdirs; do |
|
24154 |
+ if test "X$x" = "X$found_dir"; then |
|
24155 |
+ haveit=yes |
|
24156 |
+ break |
|
24157 |
+ fi |
|
24158 |
+ done |
|
24159 |
+ if test -z "$haveit"; then |
|
24160 |
+ rpathdirs="$rpathdirs $found_dir" |
|
24161 |
+ fi |
|
24162 |
+ else |
|
24163 |
+ haveit= |
|
24164 |
+ for x in $LDFLAGS $LIBPDCURSES; do |
|
24165 |
+ |
|
24166 |
+ acl_save_prefix="$prefix" |
|
24167 |
+ prefix="$acl_final_prefix" |
|
24168 |
+ acl_save_exec_prefix="$exec_prefix" |
|
24169 |
+ exec_prefix="$acl_final_exec_prefix" |
|
24170 |
+ eval x=\"$x\" |
|
24171 |
+ exec_prefix="$acl_save_exec_prefix" |
|
24172 |
+ prefix="$acl_save_prefix" |
|
24173 |
+ |
|
24174 |
+ if test "X$x" = "X-L$found_dir"; then |
|
24175 |
+ haveit=yes |
|
24176 |
+ break |
|
24177 |
+ fi |
|
24178 |
+ done |
|
24179 |
+ if test -z "$haveit"; then |
|
24180 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }-L$found_dir" |
|
24181 |
+ fi |
|
24182 |
+ if test "$acl_hardcode_minus_L" != no; then |
|
24183 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$found_so" |
|
24184 |
+ else |
|
24185 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }-l$name" |
|
24186 |
+ fi |
|
24187 |
+ fi |
|
24188 |
+ fi |
|
24189 |
+ fi |
|
24190 |
+ else |
|
24191 |
+ if test "X$found_a" != "X"; then |
|
24192 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$found_a" |
|
24193 |
+ else |
|
24194 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }-L$found_dir -l$name" |
|
24195 |
+ fi |
|
24196 |
+ fi |
|
24197 |
+ additional_includedir= |
|
24198 |
+ case "$found_dir" in |
|
24199 |
+ */$acl_libdirstem | */$acl_libdirstem/) |
|
24200 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` |
|
24201 |
+ LIBPDCURSES_PREFIX="$basedir" |
|
24202 |
+ additional_includedir="$basedir/include" |
|
24203 |
+ ;; |
|
24204 |
+ */lib | */lib/) |
|
24205 |
+ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/lib/"'*$,,'` |
|
24206 |
+ LIBPDCURSES_PREFIX="$basedir" |
|
24207 |
+ additional_includedir="$basedir/include" |
|
24208 |
+ ;; |
|
24209 |
+ esac |
|
24210 |
+ if test "X$additional_includedir" != "X"; then |
|
24211 |
+ if test "X$additional_includedir" != "X/usr/include"; then |
|
24212 |
+ haveit= |
|
24213 |
+ if test "X$additional_includedir" = "X/usr/local/include"; then |
|
24214 |
+ if test -n "$GCC"; then |
|
24215 |
+ case $host_os in |
|
24216 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
24217 |
+ esac |
|
24218 |
+ fi |
|
24219 |
+ fi |
|
24220 |
+ if test -z "$haveit"; then |
|
24221 |
+ for x in $CPPFLAGS $INCPDCURSES; do |
|
24222 |
+ |
|
24223 |
+ acl_save_prefix="$prefix" |
|
24224 |
+ prefix="$acl_final_prefix" |
|
24225 |
+ acl_save_exec_prefix="$exec_prefix" |
|
24226 |
+ exec_prefix="$acl_final_exec_prefix" |
|
24227 |
+ eval x=\"$x\" |
|
24228 |
+ exec_prefix="$acl_save_exec_prefix" |
|
24229 |
+ prefix="$acl_save_prefix" |
|
24230 |
+ |
|
24231 |
+ if test "X$x" = "X-I$additional_includedir"; then |
|
24232 |
+ haveit=yes |
|
24233 |
+ break |
|
24234 |
+ fi |
|
24235 |
+ done |
|
24236 |
+ if test -z "$haveit"; then |
|
24237 |
+ if test -d "$additional_includedir"; then |
|
24238 |
+ INCPDCURSES="${INCPDCURSES}${INCPDCURSES:+ }-I$additional_includedir" |
|
24239 |
+ fi |
|
24240 |
+ fi |
|
24241 |
+ fi |
|
24242 |
+ fi |
|
24243 |
+ fi |
|
24244 |
+ if test -n "$found_la"; then |
|
24245 |
+ save_libdir="$libdir" |
|
24246 |
+ case "$found_la" in |
|
24247 |
+ */* | *\\*) . "$found_la" ;; |
|
24248 |
+ *) . "./$found_la" ;; |
|
24249 |
+ esac |
|
24250 |
+ libdir="$save_libdir" |
|
24251 |
+ for dep in $dependency_libs; do |
|
24252 |
+ case "$dep" in |
|
24253 |
+ -L*) |
|
24254 |
+ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` |
|
24255 |
+ if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
|
24256 |
+ haveit= |
|
24257 |
+ if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
|
24258 |
+ if test -n "$GCC"; then |
|
24259 |
+ case $host_os in |
|
24260 |
+ linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
|
24261 |
+ esac |
|
24262 |
+ fi |
|
24263 |
+ fi |
|
24264 |
+ if test -z "$haveit"; then |
|
24265 |
+ haveit= |
|
24266 |
+ for x in $LDFLAGS $LIBPDCURSES; do |
|
24267 |
+ |
|
24268 |
+ acl_save_prefix="$prefix" |
|
24269 |
+ prefix="$acl_final_prefix" |
|
24270 |
+ acl_save_exec_prefix="$exec_prefix" |
|
24271 |
+ exec_prefix="$acl_final_exec_prefix" |
|
24272 |
+ eval x=\"$x\" |
|
24273 |
+ exec_prefix="$acl_save_exec_prefix" |
|
24274 |
+ prefix="$acl_save_prefix" |
|
24275 |
+ |
|
24276 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
24277 |
+ haveit=yes |
|
24278 |
+ break |
|
24279 |
+ fi |
|
24280 |
+ done |
|
24281 |
+ if test -z "$haveit"; then |
|
24282 |
+ if test -d "$additional_libdir"; then |
|
24283 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }-L$additional_libdir" |
|
24284 |
+ fi |
|
24285 |
+ fi |
|
24286 |
+ haveit= |
|
24287 |
+ for x in $LDFLAGS $LTLIBPDCURSES; do |
|
24288 |
+ |
|
24289 |
+ acl_save_prefix="$prefix" |
|
24290 |
+ prefix="$acl_final_prefix" |
|
24291 |
+ acl_save_exec_prefix="$exec_prefix" |
|
24292 |
+ exec_prefix="$acl_final_exec_prefix" |
|
24293 |
+ eval x=\"$x\" |
|
24294 |
+ exec_prefix="$acl_save_exec_prefix" |
|
24295 |
+ prefix="$acl_save_prefix" |
|
24296 |
+ |
|
24297 |
+ if test "X$x" = "X-L$additional_libdir"; then |
|
24298 |
+ haveit=yes |
|
24299 |
+ break |
|
24300 |
+ fi |
|
24301 |
+ done |
|
24302 |
+ if test -z "$haveit"; then |
|
24303 |
+ if test -d "$additional_libdir"; then |
|
24304 |
+ LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }-L$additional_libdir" |
|
24305 |
+ fi |
|
24306 |
+ fi |
|
24307 |
+ fi |
|
24308 |
+ fi |
|
24309 |
+ ;; |
|
24310 |
+ -R*) |
|
24311 |
+ dir=`echo "X$dep" | sed -e 's/^X-R//'` |
|
24312 |
+ if test "$enable_rpath" != no; then |
|
24313 |
+ haveit= |
|
24314 |
+ for x in $rpathdirs; do |
|
24315 |
+ if test "X$x" = "X$dir"; then |
|
24316 |
+ haveit=yes |
|
24317 |
+ break |
|
24318 |
+ fi |
|
24319 |
+ done |
|
24320 |
+ if test -z "$haveit"; then |
|
24321 |
+ rpathdirs="$rpathdirs $dir" |
|
24322 |
+ fi |
|
24323 |
+ haveit= |
|
24324 |
+ for x in $ltrpathdirs; do |
|
24325 |
+ if test "X$x" = "X$dir"; then |
|
24326 |
+ haveit=yes |
|
24327 |
+ break |
|
24328 |
+ fi |
|
24329 |
+ done |
|
24330 |
+ if test -z "$haveit"; then |
|
24331 |
+ ltrpathdirs="$ltrpathdirs $dir" |
|
24332 |
+ fi |
|
24333 |
+ fi |
|
24334 |
+ ;; |
|
24335 |
+ -l*) |
|
24336 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` |
|
24337 |
+ ;; |
|
24338 |
+ *.la) |
|
24339 |
+ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` |
|
24340 |
+ ;; |
|
24341 |
+ *) |
|
24342 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$dep" |
|
24343 |
+ LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }$dep" |
|
24344 |
+ ;; |
|
24345 |
+ esac |
|
24346 |
+ done |
|
24347 |
+ fi |
|
24348 |
+ else |
|
24349 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }-l$name" |
|
24350 |
+ LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }-l$name" |
|
24351 |
+ fi |
|
24352 |
+ fi |
|
24353 |
+ fi |
|
24354 |
+ done |
|
24355 |
+ done |
|
24356 |
+ if test "X$rpathdirs" != "X"; then |
|
24357 |
+ if test -n "$acl_hardcode_libdir_separator"; then |
|
24358 |
+ alldirs= |
|
24359 |
+ for found_dir in $rpathdirs; do |
|
24360 |
+ alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" |
|
24361 |
+ done |
|
24362 |
+ acl_save_libdir="$libdir" |
|
24363 |
+ libdir="$alldirs" |
|
24364 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
24365 |
+ libdir="$acl_save_libdir" |
|
24366 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$flag" |
|
24367 |
+ else |
|
24368 |
+ for found_dir in $rpathdirs; do |
|
24369 |
+ acl_save_libdir="$libdir" |
|
24370 |
+ libdir="$found_dir" |
|
24371 |
+ eval flag=\"$acl_hardcode_libdir_flag_spec\" |
|
24372 |
+ libdir="$acl_save_libdir" |
|
24373 |
+ LIBPDCURSES="${LIBPDCURSES}${LIBPDCURSES:+ }$flag" |
|
24374 |
+ done |
|
24375 |
+ fi |
|
24376 |
+ fi |
|
24377 |
+ if test "X$ltrpathdirs" != "X"; then |
|
24378 |
+ for found_dir in $ltrpathdirs; do |
|
24379 |
+ LTLIBPDCURSES="${LTLIBPDCURSES}${LTLIBPDCURSES:+ }-R$found_dir" |
|
24380 |
+ done |
|
24381 |
+ fi |
|
24382 |
+ |
|
24383 |
+ CPPFLAGS="$CPPFLAGS $INCPDCURSES" |
|
24384 |
+ if test "${ac_cv_header_curses_h+set}" = set; then |
|
24385 |
+ { echo "$as_me:$LINENO: checking for curses.h" >&5 |
|
24386 |
+echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } |
|
24387 |
+if test "${ac_cv_header_curses_h+set}" = set; then |
|
24388 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
24389 |
+fi |
|
24390 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 |
|
24391 |
+echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } |
|
24392 |
+else |
|
24393 |
+ # Is the header compilable? |
|
24394 |
+{ echo "$as_me:$LINENO: checking curses.h usability" >&5 |
|
24395 |
+echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; } |
|
24396 |
+cat >conftest.$ac_ext <<_ACEOF |
|
24397 |
+/* confdefs.h. */ |
|
24398 |
+_ACEOF |
|
24399 |
+cat confdefs.h >>conftest.$ac_ext |
|
24400 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
24401 |
+/* end confdefs.h. */ |
|
24402 |
+$ac_includes_default |
|
24403 |
+#include <curses.h> |
|
24404 |
+_ACEOF |
|
24405 |
+rm -f conftest.$ac_objext |
|
24406 |
+if { (ac_try="$ac_compile" |
|
24407 |
+case "(($ac_try" in |
|
24408 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
24409 |
+ *) ac_try_echo=$ac_try;; |
|
24410 |
+esac |
|
24411 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
24412 |
+ (eval "$ac_compile") 2>conftest.er1 |
|
24413 |
+ ac_status=$? |
|
24414 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
24415 |
+ rm -f conftest.er1 |
|
24416 |
+ cat conftest.err >&5 |
|
24417 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
24418 |
+ (exit $ac_status); } && { |
|
24419 |
+ test -z "$ac_c_werror_flag" || |
|
24420 |
+ test ! -s conftest.err |
|
24421 |
+ } && test -s conftest.$ac_objext; then |
|
24422 |
+ ac_header_compiler=yes |
|
24423 |
+else |
|
24424 |
+ echo "$as_me: failed program was:" >&5 |
|
24425 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
24426 |
+ |
|
24427 |
+ ac_header_compiler=no |
|
24428 |
+fi |
|
24429 |
+ |
|
24430 |
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
|
24431 |
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 |
|
24432 |
+echo "${ECHO_T}$ac_header_compiler" >&6; } |
|
24433 |
+ |
|
24434 |
+# Is the header present? |
|
24435 |
+{ echo "$as_me:$LINENO: checking curses.h presence" >&5 |
|
24436 |
+echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; } |
|
24437 |
+cat >conftest.$ac_ext <<_ACEOF |
|
24438 |
+/* confdefs.h. */ |
|
24439 |
+_ACEOF |
|
24440 |
+cat confdefs.h >>conftest.$ac_ext |
|
24441 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
24442 |
+/* end confdefs.h. */ |
|
24443 |
+#include <curses.h> |
|
24444 |
+_ACEOF |
|
24445 |
+if { (ac_try="$ac_cpp conftest.$ac_ext" |
|
24446 |
+case "(($ac_try" in |
|
24447 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
24448 |
+ *) ac_try_echo=$ac_try;; |
|
24449 |
+esac |
|
24450 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
24451 |
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 |
|
24452 |
+ ac_status=$? |
|
24453 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
24454 |
+ rm -f conftest.er1 |
|
24455 |
+ cat conftest.err >&5 |
|
24456 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
24457 |
+ (exit $ac_status); } >/dev/null && { |
|
24458 |
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || |
|
24459 |
+ test ! -s conftest.err |
|
24460 |
+ }; then |
|
24461 |
+ ac_header_preproc=yes |
|
24462 |
+else |
|
24463 |
+ echo "$as_me: failed program was:" >&5 |
|
24464 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
24465 |
+ |
|
24466 |
+ ac_header_preproc=no |
|
24467 |
+fi |
|
24468 |
+ |
|
24469 |
+rm -f conftest.err conftest.$ac_ext |
|
24470 |
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 |
|
24471 |
+echo "${ECHO_T}$ac_header_preproc" >&6; } |
|
24472 |
+ |
|
24473 |
+# So? What about this header? |
|
24474 |
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in |
|
24475 |
+ yes:no: ) |
|
24476 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 |
|
24477 |
+echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} |
|
24478 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 |
|
24479 |
+echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} |
|
24480 |
+ ac_header_preproc=yes |
|
24481 |
+ ;; |
|
24482 |
+ no:yes:* ) |
|
24483 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 |
|
24484 |
+echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} |
|
24485 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 |
|
24486 |
+echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} |
|
24487 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 |
|
24488 |
+echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} |
|
24489 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 |
|
24490 |
+echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} |
|
24491 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 |
|
24492 |
+echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} |
|
24493 |
+ { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 |
|
24494 |
+echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} |
|
24495 |
+ ( cat <<\_ASBOX |
|
24496 |
+## -------------------------------------- ## |
|
24497 |
+## Report this to http://bugs.clamav.net/ ## |
|
24498 |
+## -------------------------------------- ## |
|
24499 |
+_ASBOX |
|
24500 |
+ ) | sed "s/^/$as_me: WARNING: /" >&2 |
|
24501 |
+ ;; |
|
24502 |
+esac |
|
24503 |
+{ echo "$as_me:$LINENO: checking for curses.h" >&5 |
|
24504 |
+echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } |
|
24505 |
+if test "${ac_cv_header_curses_h+set}" = set; then |
|
24506 |
+ echo $ECHO_N "(cached) $ECHO_C" >&6 |
|
24507 |
+else |
|
24508 |
+ ac_cv_header_curses_h=$ac_header_preproc |
|
24509 |
+fi |
|
24510 |
+{ echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 |
|
24511 |
+echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } |
|
24512 |
+ |
|
24513 |
+fi |
|
24514 |
+if test $ac_cv_header_curses_h = yes; then |
|
24515 |
+ have_header=yes |
|
24516 |
+else |
|
24517 |
+ have_header=no |
|
24518 |
+fi |
|
24519 |
+ |
|
24520 |
+ |
|
24521 |
+ ac_cv_findlib_PDCURSES_libs= |
|
24522 |
+ ac_cv_findlib_PDCURSES_ltlibs= |
|
24523 |
+ ac_cv_findlib_PDCURSES_inc= |
|
24524 |
+ if test "$have_header" = "yes"; then |
|
24525 |
+ |
|
24526 |
+ LIBS="$LIBS $LIBPDCURSES" |
|
24527 |
+ { echo "$as_me:$LINENO: checking linking with pdcurses" >&5 |
|
24528 |
+echo $ECHO_N "checking linking with pdcurses... $ECHO_C" >&6; } |
|
24529 |
+ cat >conftest.$ac_ext <<_ACEOF |
|
24530 |
+/* confdefs.h. */ |
|
24531 |
+_ACEOF |
|
24532 |
+cat confdefs.h >>conftest.$ac_ext |
|
24533 |
+cat >>conftest.$ac_ext <<_ACEOF |
|
24534 |
+/* end confdefs.h. */ |
|
24535 |
+#include <curses.h> |
|
24536 |
+int |
|
24537 |
+main () |
|
24538 |
+{ |
|
24539 |
+initscr(); KEY_RESIZE; |
|
24540 |
+ ; |
|
24541 |
+ return 0; |
|
24542 |
+} |
|
24543 |
+_ACEOF |
|
24544 |
+rm -f conftest.$ac_objext conftest$ac_exeext |
|
24545 |
+if { (ac_try="$ac_link" |
|
24546 |
+case "(($ac_try" in |
|
24547 |
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; |
|
24548 |
+ *) ac_try_echo=$ac_try;; |
|
24549 |
+esac |
|
24550 |
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 |
|
24551 |
+ (eval "$ac_link") 2>conftest.er1 |
|
24552 |
+ ac_status=$? |
|
24553 |
+ grep -v '^ *+' conftest.er1 >conftest.err |
|
24554 |
+ rm -f conftest.er1 |
|
24555 |
+ cat conftest.err >&5 |
|
24556 |
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5 |
|
24557 |
+ (exit $ac_status); } && { |
|
24558 |
+ test -z "$ac_c_werror_flag" || |
|
24559 |
+ test ! -s conftest.err |
|
24560 |
+ } && test -s conftest$ac_exeext && |
|
24561 |
+ $as_test_x conftest$ac_exeext; then |
|
24562 |
+ |
|
24563 |
+ ac_cv_findlib_PDCURSES_libs="$LIBPDCURSES" |
|
24564 |
+ ac_cv_findlib_PDCURSES_ltlibs="$LTLIBPDCURSES" |
|
24565 |
+ ac_cv_findlib_PDCURSES_inc="$INCPDCURSES" |
|
24566 |
+ |
|
24567 |
+else |
|
24568 |
+ echo "$as_me: failed program was:" >&5 |
|
24569 |
+sed 's/^/| /' conftest.$ac_ext >&5 |
|
24570 |
+ |
|
24571 |
+ |
|
24572 |
+fi |
|
24573 |
+ |
|
24574 |
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ |
|
24575 |
+ conftest$ac_exeext conftest.$ac_ext |
|
24576 |
+ |
|
24577 |
+fi |
|
24578 |
+ |
|
24579 |
+ CPPFLAGS="$save_CPPFLAGS" |
|
24580 |
+ LIBS="$save_LIBS" |
|
24581 |
+ if test "X$ac_cv_findlib_PDCURSES_libs" = "X"; then |
|
24582 |
+ |
|
24583 |
+ { echo "$as_me:$LINENO: unable to compile/link with pdcurses" >&5 |
|
24584 |
+echo "$as_me: unable to compile/link with pdcurses" >&6;} |
|
24585 |
+ HAVE_LIBPDCURSES=no |
|
24586 |
+ { echo "$as_me:$LINENO: WARNING: ****** not building clamdtop: ncurses not found" >&5 |
|
24587 |
+echo "$as_me: WARNING: ****** not building clamdtop: ncurses not found" >&2;} |
|
24588 |
+ |
|
24589 |
+else |
|
24590 |
+ |
|
24591 |
+ { echo "$as_me:$LINENO: Compiling and linking with pdcurses by using $ac_cv_findlib_PDCURSES_inc $ac_cv_findlib_PDCURSES_libs" >&5 |
|
24592 |
+echo "$as_me: Compiling and linking with pdcurses by using $ac_cv_findlib_PDCURSES_inc $ac_cv_findlib_PDCURSES_libs" >&6;} |
|
24593 |
+ |
|
24594 |
+cat >>confdefs.h <<\_ACEOF |
|
24595 |
+#define HAVE_LIBPDCURSES 1 |
|
24596 |
+_ACEOF |
|
24597 |
+ |
|
24598 |
+ HAVE_LIBPDCURSES=yes |
|
24599 |
+ LIBPDCURSES="$ac_cv_findlib_PDCURSES_libs" |
|
24600 |
+ LTLIBPDCURSES="$ac_cv_findlib_PDCURSES_ltlibs" |
|
24601 |
+ INCPDCURSES="$ac_cv_findlib_PDCURSES_inc" |
|
24602 |
+ CURSES_CPPFLAGS="$INCPDCURSES"; |
|
24603 |
+ CURSES_LIBS="$LTLIBPDCURSES"; |
|
24604 |
+ CURSES_INCLUDE="<curses.h>" |
|
24605 |
+ |
|
24606 |
+fi |
|
24607 |
+ |
|
24608 |
+ |
|
24609 |
+ |
|
24610 |
+fi |
|
24611 |
+ |
|
24612 |
+if test "x$CURSES_LIBS" = "x" -a "$enable_clamdtop" = "yes"; then |
|
24613 |
+ { { echo "$as_me:$LINENO: error: |
|
24614 |
+ |
|
24615 |
+ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev. |
|
24616 |
+" >&5 |
|
24617 |
+echo "$as_me: error: |
|
24618 |
+ |
|
24619 |
+ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev. |
|
24620 |
+" >&2;} |
|
24621 |
+ { (exit 1); exit 1; }; } |
|
24622 |
+fi |
|
24623 |
+ |
|
24624 |
+fi |
|
24625 |
+ |
|
24626 |
+ |
|
24627 |
+cat >>confdefs.h <<_ACEOF |
|
24628 |
+#define CURSES_INCLUDE $CURSES_INCLUDE |
|
24629 |
+_ACEOF |
|
24630 |
+ |
|
24631 |
+ |
|
24632 |
+ |
|
24633 |
+ if test "X$HAVE_LIBNCURSES" = "Xyes" || test "X$HAVE_LIBPDCURSES" = "Xyes"; then |
|
24634 |
+ HAVE_CURSES_TRUE= |
|
24635 |
+ HAVE_CURSES_FALSE='#' |
|
24636 |
+else |
|
24637 |
+ HAVE_CURSES_TRUE='#' |
|
24638 |
+ HAVE_CURSES_FALSE= |
|
24639 |
+fi |
|
24640 |
+ |
|
24641 |
+ |
|
24642 |
+ac_config_files="$ac_config_files libclamav/Makefile libclamav/lzma/Makefile clamscan/Makefile database/Makefile docs/Makefile clamd/Makefile clamdscan/Makefile clamav-milter/Makefile freshclam/Makefile sigtool/Makefile clamconf/Makefile etc/Makefile test/Makefile unit_tests/Makefile clamdtop/Makefile Makefile clamav-config libclamav.pc docs/man/clamav-milter.8 docs/man/clamconf.1 docs/man/clamd.8 docs/man/clamd.conf.5 docs/man/clamdscan.1 docs/man/clamscan.1 docs/man/freshclam.1 docs/man/freshclam.conf.5 docs/man/sigtool.1 docs/man/clamdtop.1" |
|
22553 | 24643 |
|
22554 | 24644 |
cat >confcache <<\_ACEOF |
22555 | 24645 |
# This file is a shell script that caches the results of configure |
... | ... |
@@ -22755,6 +24844,13 @@ echo "$as_me: error: conditional \"HAVE_MILTER\" was never defined. |
22755 | 22755 |
Usually this means the macro was only invoked conditionally." >&2;} |
22756 | 22756 |
{ (exit 1); exit 1; }; } |
22757 | 22757 |
fi |
22758 |
+if test -z "${HAVE_CURSES_TRUE}" && test -z "${HAVE_CURSES_FALSE}"; then |
|
22759 |
+ { { echo "$as_me:$LINENO: error: conditional \"HAVE_CURSES\" was never defined. |
|
22760 |
+Usually this means the macro was only invoked conditionally." >&5 |
|
22761 |
+echo "$as_me: error: conditional \"HAVE_CURSES\" was never defined. |
|
22762 |
+Usually this means the macro was only invoked conditionally." >&2;} |
|
22763 |
+ { (exit 1); exit 1; }; } |
|
22764 |
+fi |
|
22758 | 22765 |
|
22759 | 22766 |
: ${CONFIG_STATUS=./config.status} |
22760 | 22767 |
ac_clean_files_save=$ac_clean_files |
... | ... |
@@ -23495,6 +25591,7 @@ do |
23495 | 23495 |
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; |
23496 | 23496 |
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; |
23497 | 23497 |
"unit_tests/Makefile") CONFIG_FILES="$CONFIG_FILES unit_tests/Makefile" ;; |
23498 |
+ "clamdtop/Makefile") CONFIG_FILES="$CONFIG_FILES clamdtop/Makefile" ;; |
|
23498 | 23499 |
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; |
23499 | 23500 |
"clamav-config") CONFIG_FILES="$CONFIG_FILES clamav-config" ;; |
23500 | 23501 |
"libclamav.pc") CONFIG_FILES="$CONFIG_FILES libclamav.pc" ;; |
... | ... |
@@ -23507,6 +25604,7 @@ do |
23507 | 23507 |
"docs/man/freshclam.1") CONFIG_FILES="$CONFIG_FILES docs/man/freshclam.1" ;; |
23508 | 23508 |
"docs/man/freshclam.conf.5") CONFIG_FILES="$CONFIG_FILES docs/man/freshclam.conf.5" ;; |
23509 | 23509 |
"docs/man/sigtool.1") CONFIG_FILES="$CONFIG_FILES docs/man/sigtool.1" ;; |
23510 |
+ "docs/man/clamdtop.1") CONFIG_FILES="$CONFIG_FILES docs/man/clamdtop.1" ;; |
|
23510 | 23511 |
|
23511 | 23512 |
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 |
23512 | 23513 |
echo "$as_me: error: invalid argument: $ac_config_target" >&2;} |
... | ... |
@@ -23776,13 +25874,17 @@ HAVE_MILTER_FALSE!$HAVE_MILTER_FALSE$ac_delim |
23776 | 23776 |
GETENT!$GETENT$ac_delim |
23777 | 23777 |
CLAMAVUSER!$CLAMAVUSER$ac_delim |
23778 | 23778 |
CLAMAVGROUP!$CLAMAVGROUP$ac_delim |
23779 |
+CURSES_CPPFLAGS!$CURSES_CPPFLAGS$ac_delim |
|
23780 |
+CURSES_LIBS!$CURSES_LIBS$ac_delim |
|
23781 |
+HAVE_CURSES_TRUE!$HAVE_CURSES_TRUE$ac_delim |
|
23782 |
+HAVE_CURSES_FALSE!$HAVE_CURSES_FALSE$ac_delim |
|
23779 | 23783 |
LIBOBJS!$LIBOBJS$ac_delim |
23780 | 23784 |
LTLIBOBJS!$LTLIBOBJS$ac_delim |
23781 | 23785 |
ltdl_LIBOBJS!$ltdl_LIBOBJS$ac_delim |
23782 | 23786 |
ltdl_LTLIBOBJS!$ltdl_LTLIBOBJS$ac_delim |
23783 | 23787 |
_ACEOF |
23784 | 23788 |
|
23785 |
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then |
|
23789 |
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then |
|
23786 | 23790 |
break |
23787 | 23791 |
elif $ac_last_try; then |
23788 | 23792 |
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 |
... | ... |
@@ -1517,6 +1517,55 @@ AC_C_FDPASSING |
1517 | 1517 |
|
1518 | 1518 |
AC_DEFINE_UNQUOTED([VERSION_SUFFIX],"$VERSION_SUFFIX",[Version suffix for package]) |
1519 | 1519 |
|
1520 |
+AC_ARG_ENABLE(clamdtop, |
|
1521 |
+ AC_HELP_STRING([--enable-clamdtop], |
|
1522 |
+ [Enable 'clamdtop' tool @<:@default=auto@:>@]), |
|
1523 |
+[enable_clamdtop=$enableval], [enable_clamdtop="auto"]) |
|
1524 |
+ |
|
1525 |
+if test "$enable_clamdtop" != "no"; then |
|
1526 |
+ |
|
1527 |
+AC_LIB_FIND([ncurses], [ncurses/ncurses.h], |
|
1528 |
+ AC_LANG_PROGRAM([#include <ncurses/ncurses.h>], |
|
1529 |
+ [initscr(); KEY_RESIZE;]), |
|
1530 |
+ [CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES"; |
|
1531 |
+ CURSES_INCLUDE="<ncurses/ncurses.h>"], |
|
1532 |
+ []) |
|
1533 |
+ |
|
1534 |
+if test "X$HAVE_LIBNCURSES" != "Xyes"; then |
|
1535 |
+ HAVE_LIBNCURSES= |
|
1536 |
+ AC_LIB_FIND([ncurses], [ncurses.h], |
|
1537 |
+ AC_LANG_PROGRAM([#include <ncurses.h>], |
|
1538 |
+ [initscr(); KEY_RESIZE;]), |
|
1539 |
+ [CURSES_CPPFLAGS="$INCNCURSES"; CURSES_LIBS="$LTLIBNCURSES"; |
|
1540 |
+ CURSES_INCLUDE="<ncurses.h>"], |
|
1541 |
+ []) |
|
1542 |
+fi |
|
1543 |
+ |
|
1544 |
+if test "X$HAVE_LIBNCURSES" != "Xyes"; then |
|
1545 |
+ AC_LIB_FIND([pdcurses],[curses.h], |
|
1546 |
+ AC_LANG_PROGRAM([#include <curses.h>], |
|
1547 |
+ [initscr(); KEY_RESIZE;]), |
|
1548 |
+ [CURSES_CPPFLAGS="$INCPDCURSES"; |
|
1549 |
+ CURSES_LIBS="$LTLIBPDCURSES"; |
|
1550 |
+ CURSES_INCLUDE="<curses.h>"], |
|
1551 |
+ [AC_MSG_WARN([****** not building clamdtop: ncurses not found])]) |
|
1552 |
+fi |
|
1553 |
+ |
|
1554 |
+if test "x$CURSES_LIBS" = "x" -a "$enable_clamdtop" = "yes"; then |
|
1555 |
+ AC_MSG_ERROR([ |
|
1556 |
+ |
|
1557 |
+ERROR! Clamdtop was configured, but not found. You need to install libncurses5-dev. |
|
1558 |
+]) |
|
1559 |
+fi |
|
1560 |
+ |
|
1561 |
+fi |
|
1562 |
+ |
|
1563 |
+AC_DEFINE_UNQUOTED([CURSES_INCLUDE], $CURSES_INCLUDE, [curses header location]) |
|
1564 |
+AC_SUBST([CURSES_CPPFLAGS]) |
|
1565 |
+AC_SUBST([CURSES_LIBS]) |
|
1566 |
+AM_CONDITIONAL([HAVE_CURSES], |
|
1567 |
+ [test "X$HAVE_LIBNCURSES" = "Xyes" || test "X$HAVE_LIBPDCURSES" = "Xyes"]) |
|
1568 |
+ |
|
1520 | 1569 |
AC_OUTPUT([ |
1521 | 1570 |
libclamav/Makefile |
1522 | 1571 |
libclamav/lzma/Makefile |
... | ... |
@@ -1532,6 +1581,7 @@ clamconf/Makefile |
1532 | 1532 |
etc/Makefile |
1533 | 1533 |
test/Makefile |
1534 | 1534 |
unit_tests/Makefile |
1535 |
+clamdtop/Makefile |
|
1535 | 1536 |
Makefile |
1536 | 1537 |
clamav-config |
1537 | 1538 |
libclamav.pc |
... | ... |
@@ -1544,6 +1594,7 @@ docs/man/clamscan.1 |
1544 | 1544 |
docs/man/freshclam.1 |
1545 | 1545 |
docs/man/freshclam.conf.5 |
1546 | 1546 |
docs/man/sigtool.1 |
1547 |
+docs/man/clamdtop.1 |
|
1547 | 1548 |
]) |
1548 | 1549 |
|
1549 | 1550 |
# Yep, downgrading the compiler avoids the bug too: |
1550 | 1551 |
deleted file mode 100644 |
... | ... |
@@ -1,16 +0,0 @@ |
1 |
-CFLAGS=-g -Wall -W -Wshadow -Wformat=2 |
|
2 |
-CC=gcc |
|
3 |
-OBJS=clamdtop.o |
|
4 |
-CPPFLAGS=-D_FORTIFY_SOURCE=2 |
|
5 |
-ifeq ($(MSYSTEM),MINGW32) |
|
6 |
-LIBS=-lpdcurses -lws2_32 |
|
7 |
-else |
|
8 |
-LIBS=-lncurses |
|
9 |
-endif |
|
10 |
- |
|
11 |
-clamdtop: $(OBJS) Makefile |
|
12 |
- $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LIBS) |
|
13 |
- |
|
14 |
-clean: |
|
15 |
- rm -f clamdtop $(OBJS) |
|
16 |
- |
17 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,8 +0,0 @@ |
1 |
-parse pool states, and show those that are != VALID |
|
2 |
-highlight problems in version/dbversion/dbtime (old db version, old dbtime, |
|
3 |
-different db versions). |
|
4 |
-write a manpage |
|
5 |
-consider writing a GUI using Tk 8.5 (version 8.5 has much nicer widgets than 8.4) |
|
6 |
-integrate into toplevel clamav, and build if ncurses is available (optional) |
|
7 |
-figure out minimum version of ncurses required, I used 5.5 during development. |
|
8 |
-explain why queued items are high during multiscan. |
9 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,1211 +0,0 @@ |
1 |
-/* |
|
2 |
- * ClamdTOP version 0.1 |
|
3 |
- * |
|
4 |
- * Copyright (C) 2008 Sourcefire, Inc. |
|
5 |
- * |
|
6 |
- * Authors: Török Edvin |
|
7 |
- * |
|
8 |
- * This program is free software; you can redistribute it and/or modify |
|
9 |
- * it under the terms of the GNU General Public License version 2 as |
|
10 |
- * published by the Free Software Foundation. |
|
11 |
- * |
|
12 |
- * This program is distributed in the hope that it will be useful, |
|
13 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
- * GNU General Public License for more details. |
|
16 |
- * |
|
17 |
- * You should have received a copy of the GNU General Public License |
|
18 |
- * along with this program; if not, write to the Free Software |
|
19 |
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
- * MA 02110-1301, USA. |
|
21 |
- */ |
|
22 |
-#define _GNU_SOURCE |
|
23 |
-#define __EXTENSIONS |
|
24 |
-#define GCC_PRINTF |
|
25 |
-#define GCC_SCANF |
|
26 |
-#include <unistd.h> |
|
27 |
-#include <stdio.h> |
|
28 |
-#include <stdlib.h> |
|
29 |
-#include <string.h> |
|
30 |
-#include <stdint.h> |
|
31 |
-#include <sys/types.h> |
|
32 |
-#include <curses.h> |
|
33 |
-#include <time.h> |
|
34 |
-#include <ctype.h> |
|
35 |
-#include <signal.h> |
|
36 |
-#ifdef _WIN32 |
|
37 |
-#include <windows.h> |
|
38 |
-#include <winsock2.h> |
|
39 |
-/* this is not correct, perhaps winsock errors are not mapped on errno */ |
|
40 |
-#define herror perror |
|
41 |
-#else |
|
42 |
-#include <netdb.h> |
|
43 |
-#include <arpa/inet.h> |
|
44 |
-#include <netinet/in.h> |
|
45 |
-#include <sys/socket.h> |
|
46 |
-#include <sys/un.h> |
|
47 |
-#endif |
|
48 |
-#include <sys/time.h> |
|
49 |
-#include <assert.h> |
|
50 |
-#include <errno.h> |
|
51 |
- |
|
52 |
-/* Types, prototypes and globals*/ |
|
53 |
-typedef struct connection { |
|
54 |
- int sd; |
|
55 |
- const char *remote; |
|
56 |
- int tcp; |
|
57 |
- struct timeval tv_conn; |
|
58 |
- char *version; |
|
59 |
- int line; |
|
60 |
-} conn_t; |
|
61 |
- |
|
62 |
-struct global_stats { |
|
63 |
- struct task *tasks; |
|
64 |
- ssize_t n; |
|
65 |
- struct stats *all_stats; |
|
66 |
- size_t num_clamd; |
|
67 |
- conn_t *conn; |
|
68 |
-}; |
|
69 |
- |
|
70 |
-struct stats { |
|
71 |
- const char *remote; |
|
72 |
- char *engine_version; |
|
73 |
- char *db_version; |
|
74 |
- struct tm db_time; |
|
75 |
- const char *version; |
|
76 |
- int stats_unsupp; |
|
77 |
- uint8_t conn_hr, conn_min, conn_sec; |
|
78 |
- /* threads - primary */ |
|
79 |
- unsigned prim_live, prim_idle, prim_max; |
|
80 |
- /* threads - sum */ |
|
81 |
- unsigned live, idle, max; |
|
82 |
- /* queue */ |
|
83 |
- unsigned biggest_queue, current_q; |
|
84 |
- double mem;/* in megabytes */ |
|
85 |
- unsigned long lheapu, lmmapu, ltotalu, ltotalf, lreleasable, lpoolu, lpoolt; |
|
86 |
- unsigned pools_cnt; |
|
87 |
-}; |
|
88 |
- |
|
89 |
-static void cleanup(void); |
|
90 |
-static int send_string_noreconn(conn_t *conn, const char *cmd); |
|
91 |
-static void send_string(conn_t *conn, const char *cmd); |
|
92 |
-static void read_version(conn_t *conn); |
|
93 |
- |
|
94 |
-enum exit_reason { |
|
95 |
- FAIL_INITIAL_CONN=1, |
|
96 |
- OUT_OF_MEMORY, |
|
97 |
- RECONNECT_FAIL, |
|
98 |
- SIGINT_REASON |
|
99 |
-}; |
|
100 |
- |
|
101 |
-static void exit_program(enum exit_reason reason, const char *func, unsigned line); |
|
102 |
-#define EXIT_PROGRAM(r) exit_program(r, __PRETTY_FUNCTION__, __LINE__); |
|
103 |
-#define OOM_CHECK(p) do { if (!p) EXIT_PROGRAM(OUT_OF_MEMORY); } while (0) |
|
104 |
- |
|
105 |
- |
|
106 |
-static struct global_stats global; |
|
107 |
-static int curses_inited = 1; |
|
108 |
-static int maxystats=0; |
|
109 |
-static int detail_selected = -1; |
|
110 |
- |
|
111 |
-static int detail_exists() |
|
112 |
-{ |
|
113 |
- return global.num_clamd != 1; |
|
114 |
-} |
|
115 |
- |
|
116 |
-static int detail_is_selected(int idx) |
|
117 |
-{ |
|
118 |
- if (!detail_exists()) { |
|
119 |
- assert(idx == 0); |
|
120 |
- return 1; |
|
121 |
- } |
|
122 |
- return idx == detail_selected; |
|
123 |
-} |
|
124 |
- |
|
125 |
- |
|
126 |
-/* ---------------------- NCurses routines -----------------*/ |
|
127 |
-enum colors { |
|
128 |
- header_color=1, |
|
129 |
- version_color, |
|
130 |
- error_color, |
|
131 |
- value_color, |
|
132 |
- descr_color, |
|
133 |
- selected_color, |
|
134 |
- queue_header_color, |
|
135 |
- activ_color, |
|
136 |
- dim_color, |
|
137 |
- red_color, |
|
138 |
-}; |
|
139 |
- |
|
140 |
-#define UPDATE_INTERVAL 2 |
|
141 |
-#define MIN_INTERVAL 1 |
|
142 |
- |
|
143 |
-/* the default color of the terminal in ncurses */ |
|
144 |
-#define DEFAULT_COLOR -1 |
|
145 |
- |
|
146 |
-#define VALUE_ATTR A_BOLD | COLOR_PAIR(value_color) |
|
147 |
-#define DESCR_ATTR COLOR_PAIR(descr_color) |
|
148 |
-#define ERROR_ATTR A_BOLD | COLOR_PAIR(error_color) |
|
149 |
- |
|
150 |
-static WINDOW *header_window = NULL; |
|
151 |
-static WINDOW *stats_head_window = NULL; |
|
152 |
-static WINDOW *stats_window = NULL; |
|
153 |
-static WINDOW *status_bar_window = NULL; |
|
154 |
-static WINDOW *mem_window = NULL; |
|
155 |
- |
|
156 |
-static const char *status_bar_keys[10]; |
|
157 |
-static unsigned maxy=0, maxx=0; |
|
158 |
-static char *queue_header = NULL; |
|
159 |
-static char *clamd_header = NULL; |
|
160 |
- |
|
161 |
-#define CMDHEAD " COMMAND QUEUEDSINCE FILE" |
|
162 |
-#define CMDHEAD2 " # COMMAND QUEUEDSINCE FILE" |
|
163 |
- |
|
164 |
-/* |
|
165 |
- * CLAMD - which local/remote clamd this is |
|
166 |
- * CONNTIM - since when we are connected (TODO: zeroed at reconnect) |
|
167 |
- * QUEUE - no of items in queue (total) |
|
168 |
- * MAXQUEUE - max no of items in queue observed |
|
169 |
- * LIVETHR - sum of live threads |
|
170 |
- * IDLETHR - sum of idle threads |
|
171 |
- */ |
|
172 |
-#define SUMHEAD "NO CONNTIME LIV IDL QUEUE MAXQ MEM HOST ENGINE DBVER DBTIME" |
|
173 |
- |
|
174 |
-static void resize(void) |
|
175 |
-{ |
|
176 |
- char *p; |
|
177 |
- unsigned new_maxy, new_maxx; |
|
178 |
- getmaxyx(stdscr, new_maxy, new_maxx); |
|
179 |
- if(new_maxy == maxy && new_maxx == maxx) |
|
180 |
- return; |
|
181 |
- maxx = new_maxx; |
|
182 |
- maxy = new_maxy; |
|
183 |
- free(queue_header); |
|
184 |
- free(clamd_header); |
|
185 |
- queue_header = malloc(maxx + 1); |
|
186 |
- OOM_CHECK(queue_header); |
|
187 |
- clamd_header = malloc(maxx + 1); |
|
188 |
- OOM_CHECK(clamd_header); |
|
189 |
- assert(clamd_header && queue_header); |
|
190 |
- strncpy(queue_header, global.num_clamd>1 ? CMDHEAD2 : CMDHEAD, maxx); |
|
191 |
- strncpy(clamd_header, SUMHEAD, maxx); |
|
192 |
- queue_header[maxx] = '\0'; |
|
193 |
- clamd_header[maxx] = '\0'; |
|
194 |
- p = queue_header + strlen(queue_header); |
|
195 |
- while(p < queue_header+maxx) |
|
196 |
- *p++ = ' '; |
|
197 |
- p = clamd_header + strlen(clamd_header); |
|
198 |
- while(p < clamd_header+maxx) |
|
199 |
- *p++ = ' '; |
|
200 |
-} |
|
201 |
- |
|
202 |
-static void rm_windows(void) |
|
203 |
-{ |
|
204 |
- if(header_window) { |
|
205 |
- delwin(header_window); |
|
206 |
- header_window = NULL; |
|
207 |
- } |
|
208 |
- if(mem_window) { |
|
209 |
- delwin(mem_window); |
|
210 |
- mem_window = NULL; |
|
211 |
- } |
|
212 |
- if(stats_window) { |
|
213 |
- delwin(stats_window); |
|
214 |
- stats_window = NULL; |
|
215 |
- } |
|
216 |
- if(stats_head_window) { |
|
217 |
- delwin(stats_head_window); |
|
218 |
- stats_head_window = NULL; |
|
219 |
- } |
|
220 |
- if(status_bar_window) { |
|
221 |
- delwin(status_bar_window); |
|
222 |
- status_bar_window = NULL; |
|
223 |
- } |
|
224 |
-} |
|
225 |
- |
|
226 |
- |
|
227 |
-static void init_windows(int num_clamd) |
|
228 |
-{ |
|
229 |
- resize(); |
|
230 |
- |
|
231 |
- rm_windows(); |
|
232 |
- /* non-overlapping windows */ |
|
233 |
- header_window = subwin(stdscr, 1, maxx, 0, 0); |
|
234 |
- stats_head_window = subwin(stdscr, num_clamd+1, maxx, 1, 0); |
|
235 |
- maxystats = maxy-num_clamd-3; |
|
236 |
- stats_window = subwin(stdscr, maxystats, maxx, num_clamd+2, 0); |
|
237 |
- status_bar_window = subwin(stdscr, 1, maxx, maxy-1, 0); |
|
238 |
- /* memwindow overlaps, used only in details mode */ |
|
239 |
- mem_window = derwin(stats_window, 6, 41, 1, maxx-41); |
|
240 |
- touchwin(stdscr); |
|
241 |
- werase(stdscr); |
|
242 |
- refresh(); |
|
243 |
- memset(status_bar_keys, 0, sizeof(status_bar_keys)); |
|
244 |
- status_bar_keys[0] = "F1 - help"; |
|
245 |
- status_bar_keys[1] = "Q - quit"; |
|
246 |
- status_bar_keys[2] = "R - reset maximums"; |
|
247 |
- if (num_clamd > 1) { |
|
248 |
- status_bar_keys[3] = "^ - previous clamd"; |
|
249 |
- status_bar_keys[4] = "v - next clamd"; |
|
250 |
- } |
|
251 |
-} |
|
252 |
- |
|
253 |
-static void init_ncurses(int num_clamd) |
|
254 |
-{ |
|
255 |
- initscr(); |
|
256 |
- curses_inited = 1; |
|
257 |
- |
|
258 |
- start_color(); |
|
259 |
- keypad(stdscr, TRUE); /* enable keyboard mapping */ |
|
260 |
- nonl(); /* tell curses not to do NL->CR/NL on output */ |
|
261 |
- halfdelay(UPDATE_INTERVAL*10); /* timeout of 2s when waiting for input*/ |
|
262 |
- noecho(); /* dont echo input */ |
|
263 |
- curs_set(0); /* turn off cursor */ |
|
264 |
- use_default_colors(); |
|
265 |
- |
|
266 |
- init_pair(header_color, COLOR_BLACK, COLOR_WHITE); |
|
267 |
- init_pair(version_color, DEFAULT_COLOR, DEFAULT_COLOR); |
|
268 |
- init_pair(error_color, COLOR_WHITE, COLOR_RED); |
|
269 |
- init_pair(value_color, COLOR_GREEN, DEFAULT_COLOR); |
|
270 |
- init_pair(descr_color, COLOR_CYAN, DEFAULT_COLOR); |
|
271 |
- init_pair(selected_color, COLOR_BLACK, COLOR_CYAN); |
|
272 |
- init_pair(queue_header_color, COLOR_BLACK, COLOR_GREEN); |
|
273 |
- init_pair(activ_color, COLOR_MAGENTA, DEFAULT_COLOR); |
|
274 |
- init_pair(dim_color, COLOR_GREEN, DEFAULT_COLOR); |
|
275 |
- init_pair(red_color, COLOR_RED, DEFAULT_COLOR); |
|
276 |
- |
|
277 |
- init_windows(num_clamd); |
|
278 |
-} |
|
279 |
- |
|
280 |
-static void win_start(WINDOW *win, enum colors col) |
|
281 |
-{ |
|
282 |
- wattrset(win, COLOR_PAIR(col)); |
|
283 |
- wbkgd(win, COLOR_PAIR(col)); |
|
284 |
- werase(win); |
|
285 |
-} |
|
286 |
- |
|
287 |
- |
|
288 |
-static void print_colored(WINDOW *win, const char *p) |
|
289 |
-{ |
|
290 |
- while(*p) { |
|
291 |
- wattron(win, DESCR_ATTR); |
|
292 |
- while(*p && !isdigit(*p)) |
|
293 |
- waddch(win, *p++); |
|
294 |
- wattroff(win, DESCR_ATTR); |
|
295 |
- wattron(win, VALUE_ATTR); |
|
296 |
- while(*p && isdigit(*p)) |
|
297 |
- waddch(win, *p++); |
|
298 |
- wattroff(win, VALUE_ATTR); |
|
299 |
- } |
|
300 |
-} |
|
301 |
- |
|
302 |
-static void header(void) |
|
303 |
-{ |
|
304 |
- size_t i, x=0; |
|
305 |
- time_t t; |
|
306 |
- |
|
307 |
- |
|
308 |
- win_start(header_window, header_color); |
|
309 |
- mvwprintw(header_window, 0, 0, " ClamdTOP version 0.1 "); |
|
310 |
- time(&t); |
|
311 |
- wprintw(header_window, "%s", ctime(&t)); |
|
312 |
- wrefresh(header_window); |
|
313 |
- |
|
314 |
-/* win_start(version_window, version_color); |
|
315 |
- mvwprintw(version_window, 0, 0, "Connected to: "); |
|
316 |
- print_colored(version_window, clamd_version ? clamd_version : "Unknown"); |
|
317 |
- wrefresh(version_window);*/ |
|
318 |
- |
|
319 |
- werase(status_bar_window); |
|
320 |
- for(i=0;i<sizeof(status_bar_keys)/sizeof(status_bar_keys[0]);i++) { |
|
321 |
- const char *s = status_bar_keys[i]; |
|
322 |
- if(!s) |
|
323 |
- continue; |
|
324 |
- wattron(status_bar_window, A_REVERSE); |
|
325 |
- if (s[0] == '^') { |
|
326 |
- mvwaddch(status_bar_window, 0, x, ACS_UARROW); |
|
327 |
- s++; |
|
328 |
- x++; |
|
329 |
- } else if (s[0] == 'v') { |
|
330 |
- mvwaddch(status_bar_window, 0, x, ACS_DARROW); |
|
331 |
- s++; |
|
332 |
- x++; |
|
333 |
- } |
|
334 |
- mvwprintw(status_bar_window, 0, x, "%s",s); |
|
335 |
- wattroff(status_bar_window, A_REVERSE); |
|
336 |
- x += strlen(status_bar_keys[i]) + 1; |
|
337 |
- } |
|
338 |
- wrefresh(status_bar_window); |
|
339 |
-} |
|
340 |
- |
|
341 |
-static void show_bar(WINDOW *win, size_t i, unsigned live, unsigned idle, |
|
342 |
- unsigned max, int blink) |
|
343 |
-{ |
|
344 |
- int y,x; |
|
345 |
- unsigned len = 39; |
|
346 |
- unsigned start = 1; |
|
347 |
- unsigned activ = max ? ((live-idle)*(len - start - 2) + (max/2)) / max : 0; |
|
348 |
- unsigned dim = max ? idle*(len - start - 2) / max : 0; |
|
349 |
- unsigned rem = len - activ - dim - start-2; |
|
350 |
- |
|
351 |
- assert(activ + 2 < len && activ+dim + 2 < len && activ+dim+rem + 2 < len && "Invalid values"); |
|
352 |
- mvwaddch(win, i, start, '[' | A_BOLD); |
|
353 |
- wattron(win, A_BOLD | COLOR_PAIR(activ_color)); |
|
354 |
- for(i=0;i<activ;i++) |
|
355 |
- waddch(win, '|'); |
|
356 |
- wattroff(win, A_BOLD | COLOR_PAIR(activ_color)); |
|
357 |
- wattron(win, A_DIM | COLOR_PAIR(dim_color)); |
|
358 |
- for(i=0;i<dim;i++) |
|
359 |
- waddch(win, '|'); |
|
360 |
- wattroff(win, A_DIM | COLOR_PAIR(dim_color)); |
|
361 |
- for(i=0;i<rem;i++) |
|
362 |
- waddch(win, ' '); |
|
363 |
- waddch(win, ']' | A_BOLD); |
|
364 |
- if(blink) { |
|
365 |
- getyx(win, y, x); |
|
366 |
- mvwaddch(win, y, x-2, '>' | A_BLINK | COLOR_PAIR(red_color)); |
|
367 |
- move(y, x); |
|
368 |
- } |
|
369 |
-} |
|
370 |
- |
|
371 |
-/* --------------------- Error handling ---------------------*/ |
|
372 |
-static int normal_exit = 0; |
|
373 |
-static const char *exit_reason = NULL; |
|
374 |
-static const char *exit_func = NULL; |
|
375 |
-static unsigned exit_line = 0; |
|
376 |
- |
|
377 |
-static void cleanup(void) |
|
378 |
-{ |
|
379 |
- unsigned i; |
|
380 |
- if (curses_inited) { |
|
381 |
- if (status_bar_window) { |
|
382 |
- werase(status_bar_window); |
|
383 |
- wrefresh(status_bar_window); |
|
384 |
- } |
|
385 |
- rm_windows(); |
|
386 |
- endwin(); |
|
387 |
- } |
|
388 |
- curses_inited = 0; |
|
389 |
- for (i=0;i<global.num_clamd;i++) { |
|
390 |
- if (global.conn[i].sd && global.conn[i].sd != -1) { |
|
391 |
- send_string_noreconn(&global.conn[i], "nEND\n"); |
|
392 |
- close(global.conn[i].sd); |
|
393 |
- } |
|
394 |
- free(global.conn[i].version); |
|
395 |
- } |
|
396 |
- free(global.all_stats); |
|
397 |
- free(global.conn); |
|
398 |
- free(queue_header); |
|
399 |
- free(clamd_header); |
|
400 |
- if(!normal_exit) { |
|
401 |
- fprintf(stderr, "Abnormal program termination"); |
|
402 |
- if (exit_reason) fprintf(stderr, ": %s",exit_reason); |
|
403 |
- if (exit_func) fprintf(stderr, " in %s", exit_func); |
|
404 |
- if (exit_line) fprintf(stderr, " at line %u", exit_line); |
|
405 |
- fputc('\n',stderr); |
|
406 |
- } |
|
407 |
-} |
|
408 |
- |
|
409 |
-#ifdef __GNUC__ |
|
410 |
-#define __noreturn __attribute__((noreturn)) |
|
411 |
-#else |
|
412 |
-#define __noreturn |
|
413 |
-#endif |
|
414 |
- |
|
415 |
-static void __noreturn exit_program(enum exit_reason reason, const char *func, unsigned line) |
|
416 |
-{ |
|
417 |
- switch(reason) { |
|
418 |
- case FAIL_INITIAL_CONN: |
|
419 |
- exit_reason = "Unable to connect to all clamds"; |
|
420 |
- break; |
|
421 |
- case OUT_OF_MEMORY: |
|
422 |
- exit_reason = "Out of memory"; |
|
423 |
- break; |
|
424 |
- case RECONNECT_FAIL: |
|
425 |
- exit_reason = "Failed to reconnect to clamd after connection was lost"; |
|
426 |
- break; |
|
427 |
- case SIGINT_REASON: |
|
428 |
- exit_reason = "User interrupt"; |
|
429 |
- break; |
|
430 |
- default: |
|
431 |
- exit_reason = "Unknown"; |
|
432 |
- break; |
|
433 |
- } |
|
434 |
- exit_func = func; |
|
435 |
- exit_line = line; |
|
436 |
- exit(reason); |
|
437 |
-} |
|
438 |
- |
|
439 |
-struct task { |
|
440 |
- char *line; |
|
441 |
- double tim; |
|
442 |
- int clamd_no; |
|
443 |
-}; |
|
444 |
- |
|
445 |
-static int tasks_compare(const void *a, const void *b) |
|
446 |
-{ |
|
447 |
- const struct task *ta = a; |
|
448 |
- const struct task *tb = b; |
|
449 |
- if(ta->tim < tb->tim) |
|
450 |
- return 1; |
|
451 |
- if(ta->tim > tb->tim) |
|
452 |
- return -1; |
|
453 |
- return 0; |
|
454 |
-} |
|
455 |
- |
|
456 |
-/* ----------- Socket routines ----------------------- */ |
|
457 |
-static void print_con_info(conn_t *conn, const char *fmt, ...) |
|
458 |
-{ |
|
459 |
- va_list ap; |
|
460 |
- va_start(ap, fmt); |
|
461 |
- if (stats_head_window) { |
|
462 |
- char *buf = malloc(maxx); |
|
463 |
- memset(buf, ' ', maxx); |
|
464 |
- OOM_CHECK(buf); |
|
465 |
- vsnprintf(buf, maxx-1, fmt, ap); |
|
466 |
- buf[strlen(buf)] = ' '; |
|
467 |
- buf[maxx-1] = '\0'; |
|
468 |
- wattron(stats_head_window, ERROR_ATTR); |
|
469 |
- mvwprintw(stats_head_window, conn->line, 0, "%s", buf); |
|
470 |
- wattroff(stats_head_window, ERROR_ATTR); |
|
471 |
- wrefresh(stats_head_window); |
|
472 |
- free(buf); |
|
473 |
- } else |
|
474 |
- vfprintf(stdout, fmt, ap); |
|
475 |
- va_end(ap); |
|
476 |
-} |
|
477 |
- |
|
478 |
- |
|
479 |
-static int make_connection(const char *soname, conn_t *conn) |
|
480 |
-{ |
|
481 |
- int s; |
|
482 |
- struct timeval tv; |
|
483 |
- conn->tcp = 0; |
|
484 |
-#ifdef _WIN32 |
|
485 |
- { |
|
486 |
-#else |
|
487 |
- if(access(soname, F_OK) == 0) { |
|
488 |
- struct sockaddr_un addr; |
|
489 |
- s = socket(AF_UNIX, SOCK_STREAM, 0); |
|
490 |
- if(s < 0) { |
|
491 |
- perror("socket"); |
|
492 |
- return -1; |
|
493 |
- } |
|
494 |
- memset(&addr, 0, sizeof(addr)); |
|
495 |
- addr.sun_family = AF_UNIX; |
|
496 |
- strncpy(addr.sun_path, soname, sizeof(addr.sun_path)); |
|
497 |
- print_con_info(conn, "Connecting to: %s\n", soname); |
|
498 |
- if (connect(s, (struct sockaddr *)&addr, sizeof(addr))) { |
|
499 |
- perror("connect"); |
|
500 |
- return -1; |
|
501 |
- } |
|
502 |
- } else { |
|
503 |
-#endif |
|
504 |
- struct sockaddr_in server; |
|
505 |
- struct hostent *hp; |
|
506 |
- unsigned port = 0; |
|
507 |
- char *name, *pt = strdup(soname); |
|
508 |
- const char *host = pt; |
|
509 |
- conn->tcp=1; |
|
510 |
- name = strchr(pt, ':'); |
|
511 |
- if(name) { |
|
512 |
- *name++ = '\0'; |
|
513 |
- port = atoi(name); |
|
514 |
- } |
|
515 |
- if(!port) |
|
516 |
- port = 3310; |
|
517 |
- print_con_info(conn, "Looking up: %s\n", host); |
|
518 |
- if((hp = gethostbyname(host)) == NULL) { |
|
519 |
- herror("Cannot find host"); |
|
520 |
- return -1; |
|
521 |
- } |
|
522 |
- free(pt); |
|
523 |
- s = socket(AF_INET, SOCK_STREAM, 0); |
|
524 |
- if(s < 0) { |
|
525 |
- perror("socket"); |
|
526 |
- return -1; |
|
527 |
- } |
|
528 |
- server.sin_family = AF_INET; |
|
529 |
- server.sin_port = htons(port); |
|
530 |
- server.sin_addr.s_addr = ((struct in_addr*)(hp->h_addr))->s_addr; |
|
531 |
- print_con_info(conn, "Connecting to: %s:%u\n", inet_ntoa(server.sin_addr), port); |
|
532 |
- if (connect(s, (struct sockaddr *)&server, sizeof(server))) { |
|
533 |
- perror("connect"); |
|
534 |
- return -1; |
|
535 |
- } |
|
536 |
- } |
|
537 |
- conn->remote = soname; |
|
538 |
- conn->sd = s; |
|
539 |
- gettimeofday(&conn->tv_conn, NULL); |
|
540 |
- tv.tv_sec = 4; |
|
541 |
- tv.tv_usec = 0; |
|
542 |
- setsockopt(conn->sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)); |
|
543 |
- send_string(conn, "nIDSESSION\nnVERSION\n"); |
|
544 |
- free(conn->version); |
|
545 |
- conn->version = NULL; |
|
546 |
- read_version(conn); |
|
547 |
- return 0; |
|
548 |
-} |
|
549 |
- |
|
550 |
-static void reconnect(conn_t *conn); |
|
551 |
- |
|
552 |
-static int send_string_noreconn(conn_t *conn, const char *cmd) |
|
553 |
-{ |
|
554 |
- assert(cmd); |
|
555 |
- assert(conn && conn->sd > 0); |
|
556 |
- return send(conn->sd, cmd, strlen(cmd), 0); |
|
557 |
-} |
|
558 |
- |
|
559 |
-static void send_string(conn_t *conn, const char *cmd) |
|
560 |
-{ |
|
561 |
- while(send_string_noreconn(conn, cmd) == -1) { |
|
562 |
- reconnect(conn); |
|
563 |
- } |
|
564 |
-} |
|
565 |
- |
|
566 |
-static int tries = 0; |
|
567 |
-static void reconnect(conn_t *conn) |
|
568 |
-{ |
|
569 |
- if(++tries > 3) { |
|
570 |
- EXIT_PROGRAM(RECONNECT_FAIL); |
|
571 |
- } |
|
572 |
- if (make_connection(conn->remote, conn) < 0) { |
|
573 |
- print_con_info(conn, "Unable to reconnect to %s: %s", conn->remote, strerror(errno)); |
|
574 |
- EXIT_PROGRAM(RECONNECT_FAIL); |
|
575 |
- } |
|
576 |
- tries = 0; |
|
577 |
-} |
|
578 |
- |
|
579 |
-static int recv_line(conn_t *conn, char *buf, size_t len) |
|
580 |
-{ |
|
581 |
- assert(len > 0); |
|
582 |
- assert(conn); |
|
583 |
- assert(buf); |
|
584 |
- |
|
585 |
- len--; |
|
586 |
- if (!len || conn->sd == -1) |
|
587 |
- return 0; |
|
588 |
- assert(conn->sd > 0); |
|
589 |
- while (len > 0) { |
|
590 |
- ssize_t nread = recv(conn->sd, buf, len, MSG_PEEK); |
|
591 |
- if (nread <= 0) { |
|
592 |
- print_con_info(conn, "%s: %s", conn->remote, strerror(errno)); |
|
593 |
- /* it could be a timeout, be nice and send an END */ |
|
594 |
- send_string_noreconn(conn, "nEND\n"); |
|
595 |
- close(conn->sd); |
|
596 |
- conn->sd = -1; |
|
597 |
- return 0; |
|
598 |
- } else { |
|
599 |
- char *p = memchr(buf, '\n', nread); |
|
600 |
- if (p) { |
|
601 |
- len = p - buf + 1; |
|
602 |
- } else |
|
603 |
- len = nread; |
|
604 |
- assert(len > 0); |
|
605 |
- assert(len <= (size_t)nread); |
|
606 |
- nread = recv(conn->sd, buf, len, 0); |
|
607 |
- if (nread == -1) |
|
608 |
- reconnect(conn); |
|
609 |
- else { |
|
610 |
- assert(nread >0 && (size_t)nread == len); |
|
611 |
- buf += nread; |
|
612 |
- } |
|
613 |
- if (p) |
|
614 |
- break; |
|
615 |
- } |
|
616 |
- } |
|
617 |
- *buf = '\0'; |
|
618 |
- return 1; |
|
619 |
-} |
|
620 |
- |
|
621 |
-static void output_queue(size_t line, ssize_t max) |
|
622 |
-{ |
|
623 |
- ssize_t i, j; |
|
624 |
- struct task *tasks = global.tasks; |
|
625 |
- struct task *filtered_tasks = calloc(global.n, sizeof(*filtered_tasks)); |
|
626 |
- OOM_CHECK(filtered_tasks); |
|
627 |
- for (i=0,j=0;i<global.n;i++) { |
|
628 |
- if (detail_selected == -1 || detail_is_selected(tasks[i].clamd_no-1)) { |
|
629 |
- filtered_tasks[j++] = tasks[i]; |
|
630 |
- } |
|
631 |
- } |
|
632 |
- |
|
633 |
- wattron(stats_window, COLOR_PAIR(queue_header_color)); |
|
634 |
- mvwprintw(stats_window, line++, 0, "%s", queue_header); |
|
635 |
- wattroff(stats_window, COLOR_PAIR(queue_header_color)); |
|
636 |
- if (max >= j) |
|
637 |
- max = j; |
|
638 |
- else |
|
639 |
- --max; |
|
640 |
- if (max < 0) max = 0; |
|
641 |
- for(i=0;i<max;i++) { |
|
642 |
- assert(tasks); |
|
643 |
- char *cmde = strchr(filtered_tasks[i].line, ' '); |
|
644 |
- if(cmde) { |
|
645 |
- char cmd[16]; |
|
646 |
- const char *filstart = strchr(cmde + 1, ' '); |
|
647 |
- strncpy(cmd, filtered_tasks[i].line, sizeof(cmd)-1); |
|
648 |
- cmd[15]='\0'; |
|
649 |
- if (filtered_tasks[i].line+15 > cmde) |
|
650 |
- cmd[cmde - filtered_tasks[i].line] = '\0'; |
|
651 |
- if(filstart) { |
|
652 |
- ++filstart; |
|
653 |
- if (detail_selected == -1 && global.num_clamd > 1) |
|
654 |
- mvwprintw(stats_window, line + i, 0, "%2u %s", filtered_tasks[i].clamd_no, cmd + 1); |
|
655 |
- else |
|
656 |
- mvwprintw(stats_window, line + i, 0, " %s", cmd + 1); |
|
657 |
- mvwprintw(stats_window, line + i, 15, "%10.03fs", filtered_tasks[i].tim); |
|
658 |
- mvwprintw(stats_window, line + i, 30, "%s",filstart); |
|
659 |
- } |
|
660 |
- } |
|
661 |
- } |
|
662 |
- if (max < j) { |
|
663 |
- /* in summary mode we can only show a max amount of tasks */ |
|
664 |
- wattron(stats_window, A_DIM | COLOR_PAIR(header_color)); |
|
665 |
- mvwprintw(stats_window, line+i, 0, "*** %u more task(s) not shown ***", (unsigned)(j - max)); |
|
666 |
- wattroff(stats_window, A_DIM | COLOR_PAIR(header_color)); |
|
667 |
- } |
|
668 |
- free(filtered_tasks); |
|
669 |
-} |
|
670 |
- |
|
671 |
-/* ---------------------- stats parsing routines ------------------- */ |
|
672 |
- |
|
673 |
- |
|
674 |
-static void parse_queue(conn_t *conn, char* buf, size_t len, unsigned idx) |
|
675 |
-{ |
|
676 |
- do { |
|
677 |
- double tim; |
|
678 |
- const char *t = strchr(buf, ' '); |
|
679 |
- if(!t) |
|
680 |
- continue; |
|
681 |
- if(sscanf(t,"%lf", &tim) != 1) |
|
682 |
- continue; |
|
683 |
- ++global.n; |
|
684 |
- global.tasks = realloc(global.tasks, sizeof(*global.tasks)*global.n); |
|
685 |
- OOM_CHECK(global.tasks); |
|
686 |
- global.tasks[global.n-1].line = strdup(buf); |
|
687 |
- OOM_CHECK(global.tasks[global.n-1].line); |
|
688 |
- global.tasks[global.n-1].tim = tim; |
|
689 |
- global.tasks[global.n-1].clamd_no = idx + 1; |
|
690 |
- } while (recv_line(conn, buf, len) && buf[0] == '\t' && strcmp("END\n", buf) != 0); |
|
691 |
-} |
|
692 |
- |
|
693 |
-static unsigned biggest_mem = 0; |
|
694 |
- |
|
695 |
-static void output_memstats(struct stats *stats) |
|
696 |
-{ |
|
697 |
- char buf[128]; |
|
698 |
- unsigned long totalmem; |
|
699 |
- int blink = 0; |
|
700 |
- |
|
701 |
- werase(mem_window); |
|
702 |
- if (stats->mem != -1) { |
|
703 |
- box(mem_window, 0, 0); |
|
704 |
- |
|
705 |
- snprintf(buf, sizeof(buf),"heap %4luM mmap %4luM unused %3luM", |
|
706 |
- stats->lheapu/1024, stats->lmmapu/1024, stats->lreleasable/1024); |
|
707 |
- mvwprintw(mem_window, 1, 1, "Mem: "); |
|
708 |
- print_colored(mem_window, buf); |
|
709 |
- |
|
710 |
- mvwprintw(mem_window, 2, 1, "Libc: "); |
|
711 |
- snprintf(buf, sizeof(buf),"used %4luM free %4luM total %4luM", |
|
712 |
- stats->ltotalu/1024, stats->ltotalf/1024, (stats->ltotalu+stats->ltotalf)/1024); |
|
713 |
- print_colored(mem_window, buf); |
|
714 |
- |
|
715 |
- mvwprintw(mem_window, 3, 1, "Pool: "); |
|
716 |
- snprintf(buf, sizeof(buf), "count %u used %4luM total %4luM", |
|
717 |
- stats->pools_cnt, stats->lpoolu/1024, stats->lpoolt/1024); |
|
718 |
- print_colored(mem_window, buf); |
|
719 |
- |
|
720 |
- totalmem = stats->lheapu + stats->lmmapu + stats->lpoolt; |
|
721 |
- if(totalmem > biggest_mem) { |
|
722 |
- biggest_mem = totalmem; |
|
723 |
- blink = 1; |
|
724 |
- } |
|
725 |
- show_bar(mem_window, 4, totalmem, stats->lmmapu + stats->lreleasable + stats->lpoolt - stats->lpoolu, |
|
726 |
- biggest_mem, blink); |
|
727 |
- } |
|
728 |
- wrefresh(mem_window); |
|
729 |
-} |
|
730 |
- |
|
731 |
-static void parse_memstats(const char *line, struct stats *stats) |
|
732 |
-{ |
|
733 |
- double heapu, mmapu, totalu, totalf, releasable, pools_used, pools_total; |
|
734 |
- |
|
735 |
- if(sscanf(line, " heap %lfM mmap %lfM used %lfM free %lfM releasable %lfM pools %u pools_used %lfM pools_total %lfM", |
|
736 |
- &heapu, &mmapu, &totalu, &totalf, &releasable, &stats->pools_cnt, &pools_used, &pools_total) != 8) |
|
737 |
- return; |
|
738 |
- stats->lheapu = heapu*1000; |
|
739 |
- stats->lmmapu = mmapu*1000; |
|
740 |
- stats->ltotalu = totalu*1000; |
|
741 |
- stats->ltotalf = totalf*1000; |
|
742 |
- stats->lreleasable = releasable*1000; |
|
743 |
- stats->lpoolu = pools_used*1000; |
|
744 |
- stats->lpoolt = pools_total*1000; |
|
745 |
- stats->mem = heapu + mmapu + pools_total; |
|
746 |
- if (stats->mem == 0) stats->mem = -1; |
|
747 |
-} |
|
748 |
- |
|
749 |
-static int output_stats(struct stats *stats, unsigned idx) |
|
750 |
-{ |
|
751 |
- char buf[128]; |
|
752 |
- char timbuf[15]; |
|
753 |
- int blink = 0; |
|
754 |
- size_t i= 0; |
|
755 |
- char mem[6]; |
|
756 |
- WINDOW *win = stats_head_window; |
|
757 |
- int sel = detail_is_selected(idx); |
|
758 |
- char *line = malloc(maxx+1); |
|
759 |
- |
|
760 |
- OOM_CHECK(line); |
|
761 |
- |
|
762 |
- if (stats->mem == -1 || stats->stats_unsupp) |
|
763 |
- strncpy(mem, "N/A", sizeof(mem)); |
|
764 |
- else { |
|
765 |
- char c; |
|
766 |
- double s; |
|
767 |
- if (stats->mem > 999.0) { |
|
768 |
- c = 'G'; |
|
769 |
- s = stats->mem / 1024.0; |
|
770 |
- } else { |
|
771 |
- c = 'M'; |
|
772 |
- s = stats->mem; |
|
773 |
- } |
|
774 |
- snprintf(mem, sizeof(mem), "%7.3f", s); |
|
775 |
- i = 4; |
|
776 |
- if (mem[i-1] == '.') i--; |
|
777 |
- mem[i++] = c; |
|
778 |
- mem[i] = '\0'; |
|
779 |
- } |
|
780 |
- i = idx+1; |
|
781 |
- |
|
782 |
- if (!stats->db_time.tm_year) |
|
783 |
- strncpy(timbuf,"N/A",sizeof(timbuf)); |
|
784 |
- else |
|
785 |
- snprintf(timbuf, sizeof(timbuf), "%04u-%02u-%02u %02uh", |
|
786 |
- 1900 + stats->db_time.tm_year, |
|
787 |
- stats->db_time.tm_mon, |
|
788 |
- stats->db_time.tm_mday, |
|
789 |
- stats->db_time.tm_hour); |
|
790 |
- |
|
791 |
- memset(line, ' ', maxx+1); |
|
792 |
- if (!stats->stats_unsupp) { |
|
793 |
- snprintf(line, maxx-1, "%2u %02u:%02u:%02u %3u %3u %5u %5u %5s %-14s %-6s %5s %s", idx+1, stats->conn_hr, stats->conn_min, stats->conn_sec, |
|
794 |
- stats->live, stats->idle, |
|
795 |
- stats->current_q, stats->biggest_queue, |
|
796 |
- mem, |
|
797 |
- stats->remote, stats->engine_version, stats->db_version, timbuf); |
|
798 |
- } else { |
|
799 |
- snprintf(line, maxx-1, "%2u %02u:%02u:%02u N/A N/A N/A N/A N/A %-14s %-6s %5s %s", idx+1, stats->conn_hr, stats->conn_min, stats->conn_sec, |
|
800 |
- stats->remote, stats->engine_version, stats->db_version, timbuf); |
|
801 |
- } |
|
802 |
- line[maxx] = '\0'; |
|
803 |
- line[strlen(line)] = ' '; |
|
804 |
- if (sel) { |
|
805 |
- wattron(win, COLOR_PAIR(selected_color)); |
|
806 |
- } |
|
807 |
- mvwprintw(win, i, 0, "%s", line); |
|
808 |
- if (sel) { |
|
809 |
- wattroff(win, COLOR_PAIR(selected_color)); |
|
810 |
- } |
|
811 |
- win = stats_window; |
|
812 |
- i = 0; |
|
813 |
- if (sel && !stats->stats_unsupp) { |
|
814 |
- memset(line, ' ', maxx+1); |
|
815 |
- snprintf(line, maxx-1, "Details for Clamd version: %s", stats->version); |
|
816 |
- line[maxx] = '\0'; |
|
817 |
- line[strlen(line)]= ' '; |
|
818 |
- wattron(win, COLOR_PAIR(queue_header_color)); |
|
819 |
- mvwprintw(win, i++, 0, "%s", line); |
|
820 |
- wattroff(win, COLOR_PAIR(queue_header_color)); |
|
821 |
- mvwprintw(win, i++, 0, "Primary threads: "); |
|
822 |
- snprintf(buf, sizeof(buf), "live %3u idle %3u max %3u", stats->prim_live, stats->prim_idle, stats->prim_max); |
|
823 |
- print_colored(win, buf); |
|
824 |
- show_bar(win, i++, stats->prim_live, stats->prim_idle, stats->prim_max, 0); |
|
825 |
- |
|
826 |
- mvwprintw(win, i++, 0, "Multiscan pool : "); |
|
827 |
- snprintf(buf, sizeof(buf), "live %3u idle %3u max %3u", stats->live, stats->idle, stats->max); |
|
828 |
- print_colored(win, buf); |
|
829 |
- show_bar(win, i++, stats->live, stats->idle, stats->max, 0); |
|
830 |
- |
|
831 |
- blink = 0; |
|
832 |
- if(stats->current_q > stats->biggest_queue) { |
|
833 |
- stats->biggest_queue = stats->current_q; |
|
834 |
- blink = 1; |
|
835 |
- } |
|
836 |
- mvwprintw(win, i++, 0, "Queue:"); |
|
837 |
- snprintf(buf, sizeof(buf), "%6u items %6u max", stats->current_q, stats->biggest_queue); |
|
838 |
- print_colored(win, buf); |
|
839 |
- show_bar(win, i++, stats->current_q, 0, stats->biggest_queue, blink); |
|
840 |
- werase(mem_window); |
|
841 |
- output_memstats(stats); |
|
842 |
- } |
|
843 |
- free(line); |
|
844 |
- return i; |
|
845 |
-} |
|
846 |
- |
|
847 |
-static void output_all(void) |
|
848 |
-{ |
|
849 |
- unsigned i, stats_line=0; |
|
850 |
- werase(stats_head_window); |
|
851 |
- werase(stats_window); |
|
852 |
- wattron(stats_head_window, COLOR_PAIR(queue_header_color)); |
|
853 |
- mvwprintw(stats_head_window, 0, 0, "%s", clamd_header); |
|
854 |
- wattroff(stats_head_window, COLOR_PAIR(queue_header_color)); |
|
855 |
- for (i=0;i<global.num_clamd;i++) { |
|
856 |
- unsigned j = output_stats(&global.all_stats[i], i); |
|
857 |
- if (j > stats_line) |
|
858 |
- stats_line = j; |
|
859 |
- } |
|
860 |
- output_queue(stats_line, maxystats - stats_line-1); |
|
861 |
- wrefresh(stats_head_window); |
|
862 |
- wrefresh(stats_window); |
|
863 |
- if (detail_exists()) { |
|
864 |
- /* overlaps, must be done at the end */ |
|
865 |
- wrefresh(mem_window); |
|
866 |
- } |
|
867 |
-} |
|
868 |
- |
|
869 |
-static void parse_stats(conn_t *conn, struct stats *stats, unsigned idx) |
|
870 |
-{ |
|
871 |
- char buf[1024]; |
|
872 |
- size_t j; |
|
873 |
- struct timeval tv; |
|
874 |
- unsigned conn_dt; |
|
875 |
- int primary = 0; |
|
876 |
- const char *pstart, *p, *vstart; |
|
877 |
- |
|
878 |
- if (conn->tcp) |
|
879 |
- stats->remote = conn->remote; |
|
880 |
- else |
|
881 |
- stats->remote = "local"; |
|
882 |
- |
|
883 |
- if (!conn->version) { |
|
884 |
- stats->engine_version = "???"; |
|
885 |
- return; |
|
886 |
- } |
|
887 |
- p = pstart = vstart = strchr(conn->version, ' '); |
|
888 |
- if (!vstart) { |
|
889 |
- stats->engine_version = "???"; |
|
890 |
- return; |
|
891 |
- } |
|
892 |
- /* find digit in version */ |
|
893 |
- while (*p && !isdigit(*p)) |
|
894 |
- p++; |
|
895 |
- /* rewind to first space or dash */ |
|
896 |
- while (p > pstart && *p && *p != ' ' && *p != '-') |
|
897 |
- p--; |
|
898 |
- if (*p) p++; |
|
899 |
- /* keep only base version, and cut -exp, and -gittags */ |
|
900 |
- pstart = p; |
|
901 |
- while (*p && *p != '-' && *p != '/') |
|
902 |
- p++; |
|
903 |
- |
|
904 |
- stats->engine_version = malloc(p - pstart+1); |
|
905 |
- OOM_CHECK(stats->engine_version); |
|
906 |
- |
|
907 |
- memcpy(stats->engine_version, pstart, p-pstart); |
|
908 |
- stats->engine_version[p-pstart] = '\0'; |
|
909 |
- |
|
910 |
- pstart = strchr(p, '/'); |
|
911 |
- if (!pstart) |
|
912 |
- stats->db_version = strdup("????"); |
|
913 |
- else { |
|
914 |
- pstart++; |
|
915 |
- p = strchr(pstart, '/'); |
|
916 |
- if (!p) |
|
917 |
- p = pstart + strlen(pstart); |
|
918 |
- stats->db_version = malloc(p - pstart + 1); |
|
919 |
- OOM_CHECK(stats->db_version); |
|
920 |
- memcpy(stats->db_version, pstart, p-pstart); |
|
921 |
- stats->db_version[p-pstart] = '\0'; |
|
922 |
- if(*p) p++; |
|
923 |
- if (!*p || !strptime(p,"%a %b %d %H:%M:%S %Y", &stats->db_time)) { |
|
924 |
- memset(&stats->db_time, 0, sizeof(stats->db_time)); |
|
925 |
- } |
|
926 |
- } |
|
927 |
- if (maxx > 61 && strlen(stats->db_version) > (maxx-61)) { |
|
928 |
- stats->db_version[maxx-61] = '\0'; |
|
929 |
- } |
|
930 |
- |
|
931 |
- stats->version = vstart; /* for details view */ |
|
932 |
- gettimeofday(&tv, NULL); |
|
933 |
- tv.tv_sec -= conn->tv_conn.tv_sec; |
|
934 |
- tv.tv_usec -= conn->tv_conn.tv_usec; |
|
935 |
- conn_dt = tv.tv_sec + tv.tv_usec/1e6; |
|
936 |
- |
|
937 |
- stats->live = stats->idle = stats->max = 0; |
|
938 |
- stats->conn_hr = conn_dt/3600; |
|
939 |
- stats->conn_min = (conn_dt/60)%60; |
|
940 |
- stats->conn_sec = conn_dt%60; |
|
941 |
- stats->current_q = 0; |
|
942 |
- |
|
943 |
- while(recv_line(conn, buf, sizeof(buf)) && strcmp("END\n",buf) != 0) { |
|
944 |
- char *val = strchr(buf, ':'); |
|
945 |
- |
|
946 |
- if(buf[0] == '\t') { |
|
947 |
- parse_queue(conn, buf, sizeof(buf), idx); |
|
948 |
- continue; |
|
949 |
- } else if(val) |
|
950 |
- *val++ = '\0'; |
|
951 |
- if(!strcmp("MEMSTATS", buf)) { |
|
952 |
- parse_memstats(val, stats); |
|
953 |
- continue; |
|
954 |
- } |
|
955 |
- if(!strncmp("UNKNOWN COMMAND", buf, 15)) { |
|
956 |
- stats->stats_unsupp = 1; |
|
957 |
- break; |
|
958 |
- } |
|
959 |
- for(j=1;j<strlen(buf);j++) |
|
960 |
- buf[j] = tolower(buf[j]); |
|
961 |
- /* mvwprintw(win, i, 0, "%s", buf); |
|
962 |
- if(!val) { |
|
963 |
- i++; |
|
964 |
- continue; |
|
965 |
- } |
|
966 |
- waddch(win, ':'); |
|
967 |
- print_colored(win, val); |
|
968 |
- i++;*/ |
|
969 |
- if(!strncmp("State",buf,5)) { |
|
970 |
- if(strstr(val, "PRIMARY")) { |
|
971 |
- /* primary thread pool */ |
|
972 |
- primary = 1; |
|
973 |
- } else { |
|
974 |
- /* multiscan pool */ |
|
975 |
- primary = 0; |
|
976 |
- } |
|
977 |
- } |
|
978 |
- if(!strcmp("Threads",buf)) { |
|
979 |
- unsigned live, idle, max; |
|
980 |
- if(sscanf(val, " live %u idle %u max %u", &live, &idle, &max) != 3) |
|
981 |
- continue; |
|
982 |
- if (primary) { |
|
983 |
- stats->prim_live = live; |
|
984 |
- stats->prim_idle = idle; |
|
985 |
- assert(!stats->prim_max && "There can be only one primary pool!"); |
|
986 |
- stats->prim_max = max; |
|
987 |
- } else { |
|
988 |
- stats->live += live; |
|
989 |
- stats->idle += idle; |
|
990 |
- stats->max += max; |
|
991 |
- } |
|
992 |
- } else if (!strcmp("Queue",buf)) { |
|
993 |
- unsigned len; |
|
994 |
- if(sscanf(val, "%u", &len) != 1) |
|
995 |
- continue; |
|
996 |
- stats->current_q += len; |
|
997 |
- } |
|
998 |
- } |
|
999 |
-} |
|
1000 |
- |
|
1001 |
-static void read_version(conn_t *conn) |
|
1002 |
-{ |
|
1003 |
- char buf[1024]; |
|
1004 |
- if(recv_line(conn, buf, sizeof(buf))) { |
|
1005 |
- unsigned i; |
|
1006 |
- conn->version = strdup(buf); |
|
1007 |
- OOM_CHECK(conn->version); |
|
1008 |
- for (i=0;i<strlen(conn->version);i++) |
|
1009 |
- if (conn->version[i] == '\n') |
|
1010 |
- conn->version[i] = ' '; |
|
1011 |
- } else { |
|
1012 |
- reconnect(conn); |
|
1013 |
- } |
|
1014 |
-} |
|
1015 |
- |
|
1016 |
-static void sigint(int a) |
|
1017 |
-{ |
|
1018 |
- EXIT_PROGRAM(SIGINT_REASON); |
|
1019 |
-} |
|
1020 |
- |
|
1021 |
-/* -------------------------- Initialization ---------------- */ |
|
1022 |
-static void setup_connections(int argc, char *argv[]) |
|
1023 |
-{ |
|
1024 |
- unsigned i; |
|
1025 |
-#ifdef _WIN32 |
|
1026 |
- WSADATA wsaData; |
|
1027 |
- if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR) { |
|
1028 |
- fprintf(stderr, "Error at WSAStartup(): %d\n", WSAGetLastError()); |
|
1029 |
- EXIT_PROGRAM(FAIL_INITIAL_CONN); |
|
1030 |
- } |
|
1031 |
-#endif |
|
1032 |
- |
|
1033 |
- /* clamdtop v0.1 */ |
|
1034 |
- puts( " __ ____"); |
|
1035 |
- puts(" _____/ /___ _____ ___ ____/ / /_____ ____ ___ ___"); |
|
1036 |
- puts(" / ___/ / __ `/ __ `__ \\/ __ / __/ __ \\/ __ \\ _ __/ _ \\ < /"); |
|
1037 |
- puts("/ /__/ / /_/ / / / / / / /_/ / /_/ /_/ / /_/ / | |/ / // / / /"); |
|
1038 |
- puts("\\___/_/\\__,_/_/ /_/ /_/\\__,_/\\__/\\____/ .___/ |___/\\___(_)_/"); |
|
1039 |
- puts(" /_/ "); |
|
1040 |
- memset(&global, 0, sizeof(global)); |
|
1041 |
- if (argc == 1) { |
|
1042 |
- global.num_clamd = 1; |
|
1043 |
-#ifdef _WIN32 |
|
1044 |
- argv[1] = "localhost:3310"; |
|
1045 |
-#else |
|
1046 |
- argv[1] = "/tmp/clamd.socket"; |
|
1047 |
-#endif |
|
1048 |
- } else |
|
1049 |
- global.num_clamd = argc-1; |
|
1050 |
- global.all_stats = calloc(global.num_clamd, sizeof(*global.all_stats)); |
|
1051 |
- OOM_CHECK(global.all_stats); |
|
1052 |
- global.conn = calloc(global.num_clamd, sizeof(*global.conn)); |
|
1053 |
- OOM_CHECK(global.conn); |
|
1054 |
- for (i=0;i<global.num_clamd;i++) { |
|
1055 |
- global.conn[i].line = i+1; |
|
1056 |
- if (make_connection(argv[i+1], &global.conn[i]) < 0) { |
|
1057 |
- EXIT_PROGRAM(FAIL_INITIAL_CONN); |
|
1058 |
- } |
|
1059 |
- |
|
1060 |
- } |
|
1061 |
-#ifndef _WIN32 |
|
1062 |
- signal(SIGPIPE, SIG_IGN); |
|
1063 |
- signal(SIGINT, sigint); |
|
1064 |
-#endif |
|
1065 |
-} |
|
1066 |
- |
|
1067 |
-static void free_global_stats(void) |
|
1068 |
-{ |
|
1069 |
- unsigned i; |
|
1070 |
- for (i=0;i<(unsigned)global.n;i++) { |
|
1071 |
- free(global.tasks[i].line); |
|
1072 |
- } |
|
1073 |
- for (i=0;i<global.num_clamd;i++) { |
|
1074 |
- free(global.all_stats[i].engine_version); |
|
1075 |
- free(global.all_stats[i].db_version); |
|
1076 |
- } |
|
1077 |
- free(global.tasks); |
|
1078 |
- global.tasks = NULL; |
|
1079 |
- global.n=0; |
|
1080 |
-} |
|
1081 |
- |
|
1082 |
-static int help_line; |
|
1083 |
-static void explain(const char *abbrev, const char *msg) |
|
1084 |
-{ |
|
1085 |
- wattron(stdscr, A_BOLD); |
|
1086 |
- mvwprintw(stdscr, help_line++, 0, "%-15s", abbrev); |
|
1087 |
- wattroff(stdscr, A_BOLD); |
|
1088 |
- wprintw(stdscr," %s", msg); |
|
1089 |
-} |
|
1090 |
- |
|
1091 |
-static int show_help(void) |
|
1092 |
-{ |
|
1093 |
- int ch; |
|
1094 |
- werase(stdscr); |
|
1095 |
- help_line = 0; |
|
1096 |
- |
|
1097 |
- explain("NO","Unique clamd number"); |
|
1098 |
- explain("CONNTIME", "How long it is connected"); |
|
1099 |
- explain("LIV", "Total number of live threads"); |
|
1100 |
- explain("IDL", "Total number of idle threads"); |
|
1101 |
- explain("QUEUE", "Number of items in queue"); |
|
1102 |
- explain("MAXQ","Maximum number of items observed in queue"); |
|
1103 |
- explain("MEM", "Total memory usage (if available)"); |
|
1104 |
- explain("HOST", "Which clamd, local means unix socket"); |
|
1105 |
- explain("ENGINE", "Engine version"); |
|
1106 |
- explain("DBVER", "Database version"); |
|
1107 |
- explain("DBTIME", "Database publish time"); |
|
1108 |
- explain("Primary threads", "Threadpool used to receive commands"); |
|
1109 |
- explain("Multiscan pool","Threadpool used for multiscan"); |
|
1110 |
- explain("live","Executing commands, or scanning"); |
|
1111 |
- explain("idle","Waiting for commands, will exit after idle_timeout"); |
|
1112 |
- explain("max", "Maximum number of threads configured for this pool"); |
|
1113 |
- explain("Queue","Tasks queued for processing, but not yet picked up by a thread"); |
|
1114 |
- explain("COMMAND","Command this thread is executing"); |
|
1115 |
- explain("QUEUEDSINCE","How long this task is executing"); |
|
1116 |
- explain("FILE","Which file it is processing (if applicable)"); |
|
1117 |
- explain("Mem","Memory usage reported by libc"); |
|
1118 |
- explain("Libc","Used/free memory reported by libc"); |
|
1119 |
- explain("Pool","Memory usage reported by libclamav's pool"); |
|
1120 |
- |
|
1121 |
- wrefresh(stdscr); |
|
1122 |
- werase(status_bar_window); |
|
1123 |
- wattron(status_bar_window, A_REVERSE); |
|
1124 |
- mvwprintw(status_bar_window, 0, 0, "Press any key to exit help"); |
|
1125 |
- wattroff(status_bar_window, A_REVERSE); |
|
1126 |
- wrefresh(status_bar_window); |
|
1127 |
- /* getch() times out after a few seconds */ |
|
1128 |
- do { |
|
1129 |
- ch = getch(); |
|
1130 |
- /* we do need to exit on resize, because the text scroll out of |
|
1131 |
- * view */ |
|
1132 |
- } while (ch == -1 /*|| ch == KEY_RESIZE*/); |
|
1133 |
- return ch == KEY_RESIZE ? KEY_RESIZE : -1; |
|
1134 |
-} |
|
1135 |
- |
|
1136 |
-int main(int argc, char *argv[]) |
|
1137 |
-{ |
|
1138 |
- int ch = 0; |
|
1139 |
- struct timeval tv_last, tv; |
|
1140 |
- unsigned i; |
|
1141 |
- |
|
1142 |
- atexit(cleanup); |
|
1143 |
- setup_connections(argc, argv); |
|
1144 |
- |
|
1145 |
- init_ncurses(global.num_clamd); |
|
1146 |
- |
|
1147 |
- memset(&tv_last, 0, sizeof(tv_last)); |
|
1148 |
- do { |
|
1149 |
- if (ch == KEY_F(1)) { |
|
1150 |
- ch = show_help(); |
|
1151 |
- } |
|
1152 |
- switch(ch) { |
|
1153 |
- case KEY_RESIZE: |
|
1154 |
- resize(); |
|
1155 |
- endwin(); |
|
1156 |
- refresh(); |
|
1157 |
- init_windows(global.num_clamd); |
|
1158 |
- break; |
|
1159 |
- case 'R': |
|
1160 |
- for (i=0;i<global.num_clamd;i++) |
|
1161 |
- global.all_stats[i].biggest_queue = 1; |
|
1162 |
- biggest_mem = 0; |
|
1163 |
- break; |
|
1164 |
- case KEY_UP: |
|
1165 |
- if (global.num_clamd > 1) { |
|
1166 |
- if (detail_selected == -1) |
|
1167 |
- detail_selected = global.num_clamd-1; |
|
1168 |
- else |
|
1169 |
- --detail_selected; |
|
1170 |
- } |
|
1171 |
- break; |
|
1172 |
- case KEY_DOWN: |
|
1173 |
- if (global.num_clamd > 1) { |
|
1174 |
- if (detail_selected == -1) |
|
1175 |
- detail_selected = 0; |
|
1176 |
- else { |
|
1177 |
- if((unsigned)++detail_selected >= global.num_clamd) |
|
1178 |
- detail_selected = -1; |
|
1179 |
- } |
|
1180 |
- } |
|
1181 |
- break; |
|
1182 |
- } |
|
1183 |
- gettimeofday(&tv, NULL); |
|
1184 |
- header(); |
|
1185 |
- if(tv.tv_sec - tv_last.tv_sec >= MIN_INTERVAL) { |
|
1186 |
- free_global_stats(); |
|
1187 |
- for(i=0;i<global.num_clamd;i++) { |
|
1188 |
- unsigned biggest_q; |
|
1189 |
- struct stats *stats = &global.all_stats[i]; |
|
1190 |
- if (global.conn[i].sd != -1) |
|
1191 |
- send_string(&global.conn[i], "nSTATS\n"); |
|
1192 |
- biggest_q = stats->biggest_queue; |
|
1193 |
- memset(stats, 0, sizeof(*stats)); |
|
1194 |
- stats->biggest_queue = biggest_q; |
|
1195 |
- parse_stats(&global.conn[i], stats, i); |
|
1196 |
- } |
|
1197 |
- if (global.tasks) |
|
1198 |
- qsort(global.tasks, global.n, sizeof(*global.tasks), tasks_compare); |
|
1199 |
- tv_last = tv; |
|
1200 |
- } |
|
1201 |
- /* always show, so that screen resizes take effect instantly*/ |
|
1202 |
- output_all(); |
|
1203 |
- for(i=0;i<global.num_clamd;i++) { |
|
1204 |
- if (global.conn[i].sd == -1) |
|
1205 |
- reconnect(&global.conn[i]); |
|
1206 |
- } |
|
1207 |
- } while(toupper(ch = getch()) != 'Q'); |
|
1208 |
- free_global_stats(); |
|
1209 |
- normal_exit = 1; |
|
1210 |
- return 0; |
|
1211 |
-} |
... | ... |
@@ -17,4 +17,4 @@ |
17 | 17 |
# MA 02110-1301, USA. |
18 | 18 |
|
19 | 19 |
EXTRA_DIST = html $(top_srcdir)/docs/man/*.in clamdoc.pdf clamdoc.tex clamav-mirror-howto.pdf clamav-mirror-howto.tex phishsigs_howto.tex phishsigs_howto.pdf signatures.pdf signatures.tex clam.eps |
20 |
-man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamd.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5 man/clamconf.1 |
|
20 |
+man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamd.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5 man/clamconf.1 man/clamdtop.1 |
... | ... |
@@ -96,6 +96,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
96 | 96 |
CLAMD_LIBS = @CLAMD_LIBS@ |
97 | 97 |
CPP = @CPP@ |
98 | 98 |
CPPFLAGS = @CPPFLAGS@ |
99 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
100 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
99 | 101 |
CYGPATH_W = @CYGPATH_W@ |
100 | 102 |
DBDIR = @DBDIR@ |
101 | 103 |
DEFS = @DEFS@ |
... | ... |
@@ -229,7 +231,7 @@ target_vendor = @target_vendor@ |
229 | 229 |
top_builddir = @top_builddir@ |
230 | 230 |
top_srcdir = @top_srcdir@ |
231 | 231 |
EXTRA_DIST = html $(top_srcdir)/docs/man/*.in clamdoc.pdf clamdoc.tex clamav-mirror-howto.pdf clamav-mirror-howto.tex phishsigs_howto.tex phishsigs_howto.pdf signatures.pdf signatures.tex clam.eps |
232 |
-man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamd.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5 man/clamconf.1 |
|
232 |
+man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamd.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5 man/clamconf.1 man/clamdtop.1 |
|
233 | 233 |
all: all-am |
234 | 234 |
|
235 | 235 |
.SUFFIXES: |
236 | 236 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,191 @@ |
0 |
+.TH "Clamdtop" "1" "February 22, 2009" "ClamAV @VERSION@" "Clam AntiVirus" |
|
1 |
+.SH "NAME" |
|
2 |
+.LP |
|
3 |
+clamdtop \- monitor the Clam AntiVirus Daemon |
|
4 |
+.SH "SYNOPSIS" |
|
5 |
+.LP |
|
6 |
+clamdtop [options] [clamdspec ...] |
|
7 |
+.SH "DESCRIPTION" |
|
8 |
+.LP |
|
9 |
+clamdtop is a tool to monitor one or multiple clamd(s). |
|
10 |
+It has a (color) ncurses interface, that shows the jobs in clamd's queue, memory usage, and information about the loaded signature database. |
|
11 |
+You can specify on the command-line to which clamd(s) it should connect to. By |
|
12 |
+default it will attempt to connect to the local clamd as defined in clamd.conf. |
|
13 |
+ |
|
14 |
+.SH "OPTIONS" |
|
15 |
+.LP |
|
16 |
+ |
|
17 |
+.TP |
|
18 |
+\fB\-h, \-\-help\fR |
|
19 |
+Display help information and exit. |
|
20 |
+.TP |
|
21 |
+\fB\-V, \-\-version\fR |
|
22 |
+Print version number and exit. |
|
23 |
+\fB\-\-config\-file=FILE\fR |
|
24 |
+Read clamd settings from FILE, to determine how to connect to it. |
|
25 |
+.TP |
|
26 |
+\fBclamdspec\fR |
|
27 |
+Specifies the clamd to connect to: either a path to the local (unix domain) socket of clamd, |
|
28 |
+or an IP address and an port number (that defaults to 3310) to connect to a |
|
29 |
+local or remote clamd using TCP/IP. |
|
30 |
+ |
|
31 |
+.SH "OVERVIEW" |
|
32 |
+.SS KEYS: |
|
33 |
+.TP |
|
34 |
+\fBF1\fR |
|
35 |
+ |
|
36 |
+Displays a short helpscreen, describing the meaning of various elements on the |
|
37 |
+display. |
|
38 |
+.TP |
|
39 |
+\fBQ\fR |
|
40 |
+ |
|
41 |
+Quits clamdtop |
|
42 |
+.TP |
|
43 |
+\fBR\fR |
|
44 |
+ |
|
45 |
+Resets the maximum values. |
|
46 |
+.TP |
|
47 |
+\fBup arrow, down arrow\fR |
|
48 |
+ |
|
49 |
+If you are monitoring multiple clamds then clamdtop will show an overview screen by default. You can use the \fBup arrow\fR and \fB down arrow\fR keys to cycle through each clamd individually, and the overview screen. |
|
50 |
+A blue bar will highlight the clamd that is currently shown in detail. On the overview screen none of the clamds is selected (hence no blue bar), and you can see the items from the queue of all clamds. |
|
51 |
+ |
|
52 |
+.SS The top bar |
|
53 |
+Shows the version of clamdtop and the current time. Clamdtop updates the display once every 2 seconds. |
|
54 |
+ |
|
55 |
+.SS The list of clamds |
|
56 |
+ |
|
57 |
+Shows the clamds that clamdtop is connected to, and statistics about them. |
|
58 |
+ |
|
59 |
+.TP |
|
60 |
+\fBNO\fR |
|
61 |
+Unique clamd number |
|
62 |
+.TP |
|
63 |
+\fBCONNTIME\fR |
|
64 |
+How long clamdtop has been connected (reset upon a reconnect) |
|
65 |
+.TP |
|
66 |
+\fBLIV\fR |
|
67 |
+Total number of live threads |
|
68 |
+.TP |
|
69 |
+\fBIDL\fR |
|
70 |
+Total number of idle threads |
|
71 |
+.TP |
|
72 |
+\fBQUEUE\fR |
|
73 |
+Number of items in queue |
|
74 |
+.TP |
|
75 |
+\fBMAXQ\fR |
|
76 |
+Maximum number of items observed in the queue |
|
77 |
+.TP |
|
78 |
+\fBMEM\fR |
|
79 |
+Total memory usage (if available) |
|
80 |
+.TP |
|
81 |
+\fBHOST\fR |
|
82 |
+Which clamd, local means unix socket |
|
83 |
+.TP |
|
84 |
+\fBENGINE\fR |
|
85 |
+Engine version |
|
86 |
+.TP |
|
87 |
+\fBDBVER\fR |
|
88 |
+Database version |
|
89 |
+.TP |
|
90 |
+\fBDBTIME\fR |
|
91 |
+Database publish time |
|
92 |
+.SS Clamd detailed view |
|
93 |
+.TP |
|
94 |
+Primary threads \fBlive\fR |
|
95 |
+The number of threads that are executing commands or scanning. |
|
96 |
+.TP |
|
97 |
+Primary threads \fBidle\fR |
|
98 |
+The number of threads that are idle, waiting for commands. They will exit after IdleTimeout (30 seconds). |
|
99 |
+.TP |
|
100 |
+Primary threads \fBmax\fR |
|
101 |
+The maximum number of threads configured. |
|
102 |
+.TP |
|
103 |
+Queue \fbitems\fR |
|
104 |
+The number of items (scanjobs) in clamd's queue that are waiting for a free thread to be processed. |
|
105 |
+.TP |
|
106 |
+Queue \fbmax\fR |
|
107 |
+The maximum number of items observed in clamd's queue. |
|
108 |
+.SS The memory usage view |
|
109 |
+If available, it will show details on clamd's memory usage: |
|
110 |
+.TP |
|
111 |
+\fBMem heap\fR |
|
112 |
+The amount of memory used by libc from the heap in MegaBytes. |
|
113 |
+.TP |
|
114 |
+\fBMem mmap\fR |
|
115 |
+The amount of memory used by libc from mmap-allocated memory in MegaBytes. |
|
116 |
+.TP |
|
117 |
+\fBMem unused\fR |
|
118 |
+The amount of memory that can be reclaimed by libc. |
|
119 |
+.TP |
|
120 |
+\fBLibc used\fR |
|
121 |
+The amount of useful memory allocated by libc. |
|
122 |
+.TP |
|
123 |
+\fBLibc free\fR |
|
124 |
+The amount of memory allocated by libc, that can't be freed due to fragmentation. |
|
125 |
+.TP |
|
126 |
+\fBLibc total\fR |
|
127 |
+The amount of memory allocated by libc from the system in total. |
|
128 |
+.TP |
|
129 |
+\fBPool count\fR |
|
130 |
+The number of mmap regions allocated by clamd' memory pool allocator (for the signature database). |
|
131 |
+.TP |
|
132 |
+\fBPool used\fR |
|
133 |
+The amount of memory used by clamd's memory pool allocator (for the signature database). |
|
134 |
+.TP |
|
135 |
+\fBTotal\fR |
|
136 |
+The total amount of memory allocated by clamd's memory pool allocator. |
|
137 |
+.SS The clamd job queue |
|
138 |
+.TP |
|
139 |
+\fBCOMMAND\fR |
|
140 |
+Kind of command being executed, STATS is clamdtop, SCAN/CONTSCAN/FILDES/MULTISCAN is scan of a file/directory, MULTISCANFILE is scan of one item by a MULTISCAN job. |
|
141 |
+.TP |
|
142 |
+\fBQUEUEDSINCE\fR |
|
143 |
+The time since the command got queued, until now. |
|
144 |
+.TP |
|
145 |
+\fBFILE\fR |
|
146 |
+The name of the file being processed (if applicable). |
|
147 |
+.SH "EXAMPLES" |
|
148 |
+.LP |
|
149 |
+.TP |
|
150 |
+(1) To connect to the clamd configured in the default clamd.conf: |
|
151 |
+ |
|
152 |
+\fBclamdtop\fR |
|
153 |
+.TP |
|
154 |
+(2) To connect to the clamd configured in another clamd.conf: |
|
155 |
+ |
|
156 |
+\fBclamdtop --config-file=/path/to/clamd.conf |
|
157 |
+ |
|
158 |
+.TP |
|
159 |
+(3) To connect to a clamd running on another machine (192.168.0.3) on the LAN: |
|
160 |
+ |
|
161 |
+\fBclamdtop 192.168.0.3\fR |
|
162 |
+ |
|
163 |
+.TP |
|
164 |
+(4) To connect to a clamd running on another machine (192.168.0.3) on a non-default port (3410): |
|
165 |
+ |
|
166 |
+\fBclamdtop 192.168.0.3:3410\fR |
|
167 |
+.TP |
|
168 |
+(5) To monitor the local clamd and 2 other remote clamds over TCP/IP: |
|
169 |
+ |
|
170 |
+\fBclamdtop localhost 192.168.0.3 192.168.0.4 |
|
171 |
+.SH "NOTES" |
|
172 |
+.LP |
|
173 |
+clamdtop uses colors if the terminal is capable of colors. |
|
174 |
+If you know your terminal is capable of colors, yet you aren't seeing any, then check |
|
175 |
+that your \fBTERM\fR environment variable is set correctly. |
|
176 |
+For example try setting it to TERM=xterm-color if you are in an xterm-like |
|
177 |
+environment. |
|
178 |
+.SH "RETURN CODES" |
|
179 |
+.LP |
|
180 |
+0 : Normal terminator |
|
181 |
+.TP |
|
182 |
+>0: Error occured. |
|
183 |
+.SH "CREDITS" |
|
184 |
+Please check the full documentation for credits. |
|
185 |
+.SH "AUTHOR" |
|
186 |
+.LP |
|
187 |
+Török Edvin <edwin@clamav.net> |
|
188 |
+.SH "SEE ALSO" |
|
189 |
+.LP |
|
190 |
+clamd(8), clamd.conf(5) |
... | ... |
@@ -116,6 +116,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
116 | 116 |
CLAMD_LIBS = @CLAMD_LIBS@ |
117 | 117 |
CPP = @CPP@ |
118 | 118 |
CPPFLAGS = @CPPFLAGS@ |
119 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
120 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
119 | 121 |
CYGPATH_W = @CYGPATH_W@ |
120 | 122 |
DBDIR = @DBDIR@ |
121 | 123 |
DEFS = @DEFS@ -DCL_NOTHREADS |
... | ... |
@@ -214,6 +214,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
214 | 214 |
CLAMD_LIBS = @CLAMD_LIBS@ |
215 | 215 |
CPP = @CPP@ |
216 | 216 |
CPPFLAGS = @CPPFLAGS@ |
217 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
218 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
217 | 219 |
CYGPATH_W = @CYGPATH_W@ |
218 | 220 |
DBDIR = @DBDIR@ |
219 | 221 |
DEFS = @DEFS@ |
... | ... |
@@ -109,6 +109,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
109 | 109 |
CLAMD_LIBS = @CLAMD_LIBS@ |
110 | 110 |
CPP = @CPP@ |
111 | 111 |
CPPFLAGS = @CPPFLAGS@ |
112 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
113 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
112 | 114 |
CYGPATH_W = @CYGPATH_W@ |
113 | 115 |
DBDIR = @DBDIR@ |
114 | 116 |
DEFS = @DEFS@ |
... | ... |
@@ -173,6 +173,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
173 | 173 |
CLAMD_LIBS = @CLAMD_LIBS@ |
174 | 174 |
CPP = @CPP@ |
175 | 175 |
CPPFLAGS = @CPPFLAGS@ |
176 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
177 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
176 | 178 |
CYGPATH_W = @CYGPATH_W@ |
177 | 179 |
DBDIR = @DBDIR@ |
178 | 180 |
DEFS = @DEFS@ |
... | ... |
@@ -710,7 +710,6 @@ AC_DEFUN([AC_LIB_FIND], |
710 | 710 |
m4_if($#,5,,[m4_fatal([$0: invalid number of arguments: $#])]) |
711 | 711 |
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
712 | 712 |
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
713 |
- AC_CACHE_CHECK([how to compile and link with $1],[ac_cv_findlib_[]NAME[]_libs],[ |
|
714 | 713 |
save_CPPFLAGS="$CPPFLAGS" |
715 | 714 |
save_LIBS="$LIBS" |
716 | 715 |
AC_LIB_LINKFLAGS_BODY([$1]) |
... | ... |
@@ -730,7 +729,6 @@ AC_DEFUN([AC_LIB_FIND], |
730 | 730 |
]) |
731 | 731 |
CPPFLAGS="$save_CPPFLAGS" |
732 | 732 |
LIBS="$save_LIBS" |
733 |
- ]) |
|
734 | 733 |
AS_IF([test "X$ac_cv_findlib_[]NAME[]_libs" = "X"],[ |
735 | 734 |
AC_MSG_NOTICE([unable to compile/link with $1]) |
736 | 735 |
HAVE_LIB[]NAME=no |
... | ... |
@@ -60,11 +60,11 @@ const struct clam_option clam_options[] = { |
60 | 60 |
/* name, longopt, sopt, argtype, regex, num, str, mul, owner, description, suggested */ |
61 | 61 |
|
62 | 62 |
/* cmdline only */ |
63 |
- { NULL, "help", 'h', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF, "", "" }, |
|
64 |
- { NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamd.conf", FLAG_REQUIRED, OPT_CLAMD | OPT_CLAMDSCAN, "", "" }, |
|
63 |
+ { NULL, "help", 'h', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF | OPT_CLAMDTOP, "", "" }, |
|
64 |
+ { NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamd.conf", FLAG_REQUIRED, OPT_CLAMD | OPT_CLAMDSCAN | OPT_CLAMDTOP, "", "" }, |
|
65 | 65 |
{ NULL, "config-file", 0, TYPE_STRING, NULL, 0, CONFDIR"/freshclam.conf", FLAG_REQUIRED, OPT_FRESHCLAM, "", "" }, |
66 | 66 |
{ NULL, "config-file", 'c', TYPE_STRING, NULL, 0, CONFDIR"/clamav-milter.conf", FLAG_REQUIRED, OPT_MILTER, "", "" }, |
67 |
- { NULL, "version", 'V', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF, "", "" }, |
|
67 |
+ { NULL, "version", 'V', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL | OPT_MILTER | OPT_CLAMCONF | OPT_CLAMDTOP, "", "" }, |
|
68 | 68 |
{ NULL, "debug", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_SIGTOOL, "", "" }, |
69 | 69 |
{ NULL, "verbose", 'v', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" }, |
70 | 70 |
{ NULL, "quiet", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" }, |
... | ... |
@@ -29,7 +29,8 @@ |
29 | 29 |
#define OPT_CLAMDSCAN 16 |
30 | 30 |
#define OPT_SIGTOOL 32 |
31 | 31 |
#define OPT_CLAMCONF 64 |
32 |
-#define OPT_DEPRECATED 128 |
|
32 |
+#define OPT_CLAMDTOP 128 |
|
33 |
+#define OPT_DEPRECATED 256 |
|
33 | 34 |
|
34 | 35 |
#define TYPE_STRING 1 /* quoted/regular string */ |
35 | 36 |
#define TYPE_NUMBER 2 /* raw number */ |
... | ... |
@@ -113,6 +113,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
113 | 113 |
CLAMD_LIBS = @CLAMD_LIBS@ |
114 | 114 |
CPP = @CPP@ |
115 | 115 |
CPPFLAGS = @CPPFLAGS@ |
116 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
117 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
116 | 118 |
CYGPATH_W = @CYGPATH_W@ |
117 | 119 |
DBDIR = @DBDIR@ |
118 | 120 |
DEFS = @DEFS@ -DCL_NOTHREADS |
... | ... |
@@ -116,6 +116,8 @@ CLAMAV_MILTER_LIBS = @CLAMAV_MILTER_LIBS@ |
116 | 116 |
CLAMD_LIBS = @CLAMD_LIBS@ |
117 | 117 |
CPP = @CPP@ |
118 | 118 |
CPPFLAGS = @CPPFLAGS@ |
119 |
+CURSES_CPPFLAGS = @CURSES_CPPFLAGS@ |
|
120 |
+CURSES_LIBS = @CURSES_LIBS@ |
|
119 | 121 |
CYGPATH_W = @CYGPATH_W@ |
120 | 122 |
DBDIR = @DBDIR@ |
121 | 123 |
DEFS = @DEFS@ |