It should work fine, but I got this error : bash-2.05b$ make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 444: Colon expected *** 1 errors during make ***
Here in the Makefile & freshclam.c files
Hope you understand it
Niber
Tomasz Kojm wrote:
On Thu, 20 Nov 2003 16:03:02 +0100 "G. Jullien" <[EMAIL PROTECTED]> wrote:
Hi,
How can install ClamAV on Windows (workstation). Cygwin is already installed.
google.com -> ClamAV 0.65 cygwin:
bNamed.net - Install ClamAV on Win32
... ifndef C_CYGWIN; Start cygwin and type $ cd /home/user/clamav-0.65
$ ./configure ?disable-clamav $ make $ make install; This should ... www.bnamed.net/en/ XMailFilterClamAV.asp?tiucsib=6xfpi13dltqq
Best regards, Tomasz Kojm
# Makefile.in generated by automake 1.6.1 from Makefile.am. # Makefile. Generated from Makefile.in by configure.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
MAKE=make
#
# Copyright (C) 2002 Tomasz Kojm <[EMAIL PROTECTED]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
SHELL = /bin/bash
srcdir = .
top_srcdir = .
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
mandir = ${prefix}/man
includedir = ${prefix}/include
oldincludedir = /usr/include
pkgdatadir = $(datadir)/clamav
pkglibdir = $(libdir)/clamav
pkgincludedir = $(includedir)/clamav
top_builddir = .
ACLOCAL = ${SHELL} /home/GUILLA~1/ClamAV/missing --run aclocal-1.6
AUTOCONF = ${SHELL} /home/GUILLA~1/ClamAV/missing --run autoconf
AUTOMAKE = ${SHELL} /home/GUILLA~1/ClamAV/missing --run automake-1.6
AUTOHEADER = ${SHELL} /home/GUILLA~1/ClamAV/missing --run autoheader
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
INSTALL_SCRIPT = ${INSTALL}
INSTALL_HEADER = $(INSTALL_DATA)
transform = s,x,x,
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias =
build_triplet = i686-pc-cygwin
host_alias =
host_triplet = i686-pc-cygwin
target_alias =
target_triplet = i686-pc-cygwin
EXEEXT = .exe
OBJEXT = o
PATH_SEPARATOR = :
AMTAR = ${SHELL} /home/GUILLA~1/ClamAV/missing --run tar
AS = @AS@
AWK = gawk
CC = gcc
CFGDIR = /usr/local/etc
CLAMAVGROUP =
CLAMAVUSER =
CLAMD_LIBS =
DBDIR = /usr/local/share/clamav
DEPDIR = .deps
DLLTOOL = @DLLTOOL@
ECHO = echo
FRESHCLAM_LIBS =
GETENT =
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
LIBCLAMAV_LIBS = -lz -lbz2 -lgmp -lpthread
LIBCLAMAV_VERSION = 1:3:0
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LN_S = ln -s
OBJDUMP = @OBJDUMP@
PACKAGE = clamav
RANLIB = ranlib
STRIP = strip
TH_SAFE = -thread-safe
VERSION = 0.65
am__include = #
am__quote =
install_sh = /home/GUILLA~1/ClamAV/install-sh
SUBDIRS = libclamav clamscan clamd clamdscan freshclam sigtool database docs etc
clamav-milter
EXTRA_DIST = FAQ contrib test examples BUGS
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
DIST_SOURCES =
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
uninstall-info-recursive all-recursive install-data-recursive \
install-exec-recursive installdirs-recursive install-recursive \
uninstall-recursive check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS TODO acinclude.m4 aclocal.m4 config.guess \
config.sub configure configure.in depcomp install-sh ltmain.sh \
missing mkinstalldirs
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.in acinclude.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ETAGS = etags
ETAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@for file in $(DISTFILES); do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
find $$dc_install_base -type f -print ; \
exit 1; } >&2 ) \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f config.status config.cache config.log
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive dist dist-all \
dist-gzip distcheck distclean distclean-generic \
distclean-libtool distclean-recursive distclean-tags \
distcleancheck distdir dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
tags tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:/*
* Copyright (C) 2002, 2003 Tomasz Kojm <[EMAIL PROTECTED]>
* Damien Curtain <[EMAIL PROTECTED]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* TODO: Handle SIGALRM more gently */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include "options.h"
#include "shared.h"
#include "others.h"
#include "manager.h"
#include "defaults.h"
#include "freshclam.h"
#define TIMEOUT 1200
void freshclam(struct optstruct *opt)
{
int ret;
struct passwd *user;
char *newdir;
#ifndef C_CYGWIN
char *unpuser;
if(optc(opt, 'u'))
unpuser = getargc(opt, 'u');
else
unpuser = UNPUSER;
/* freshclam shouldn't work with root priviledges */
if(!getuid()) {
if((user = getpwnam(unpuser)) == NULL) {
mprintf("@Can't get information about user %s.\n", unpuser);
exit(60); /* this is critical problem, so we just exit here */
}
setgroups(1, &user->pw_gid);
setgid(user->pw_gid);
setuid(user->pw_uid);
}
#endif
/* initialize some important variables */
if(optl(opt, "debug"))
cl_debug();
mprintf_disabled = 0;
if(optc(opt, 'v')) mprintf_verbose = 1;
else mprintf_verbose = 0;
if(optl(opt, "quiet")) mprintf_quiet = 1;
else mprintf_quiet = 0;
if(optl(opt, "stdout")) mprintf_stdout = 1;
else mprintf_stdout = 0;
if(optc(opt, 'V')) {
mprintf("freshclam / ClamAV version "VERSION"\n");
mexit(0);
}
if(optc(opt, 'h')) {
free_opt(opt);
help();
}
/* initialize logger */
if(optl(opt, "log-verbose")) logverbose = 1;
else logverbose = 0;
if(optc(opt, 'l')) {
logfile = getargc(opt, 'l');
if(logg("--------------------------------------\n")) {
mprintf("!Problem with internal logger.\n");
mexit(1);
}
} else
logfile = NULL;
/* change current working directory */
if(optl(opt, "datadir"))
newdir = getargl(opt, "datadir");
else
newdir = VIRUSDBDIR;
if(chdir(newdir)) {
mprintf("Can't change dir to %s\n", newdir);
exit(50);
} else
mprintf("*Current working dir is %s\n", newdir);
if(optc(opt, 'd')) {
int bigsleep, checks;
if(!optc(opt, 'c')) {
mprintf("@Daemon mode requires -c (--checks) option.\n");
mexit(40);
}
checks = atoi(getargc(opt, 'c'));
if(checks <= 0 || checks > 50) {
mprintf("@Wrong number of checks\n");
mexit(41);
}
bigsleep = 24*3600 / checks;
daemonize();
while(1) {
ret = download(opt);
if(optl(opt, "on-error-execute"))
if(ret > 1)
system(getargl(opt, "on-error-execute"));
logg("\n--------------------------------------\n");
sleep(bigsleep);
}
} else
ret = download(opt);
if(optl(opt, "on-error-execute"))
if(ret > 1)
system(getargl(opt, "on-error-execute"));
mexit(ret);
}
void d_timeout(int sig)
{
mprintf("@Maximal time (%d seconds) reached.\n", TIMEOUT);
exit(1);
}
int download(struct optstruct *opt)
{
int ret = 0;
mirrors *m = NULL, *h = NULL;
int mirror_used = 0;
struct sigaction sigalrm;
sigalrm.sa_handler = d_timeout;
sigaction(SIGALRM, &sigalrm, NULL);
/*
* There's an error in __nss_hostname_digits_dots () from /lib/libc.so.6
* which gets triggered here for some reason.....
* Calling fflush is a temp workaround
*/
fflush(NULL);
h = m = parse_mirrorcfg(opt);
while(m != NULL)
{
alarm(TIMEOUT);
ret = downloadmanager(opt, m->mirror);
alarm(0);
if(ret == 0)
{
if(mirror_used)
{
logg("Database updated from mirror %s.\n", m->mirror);
mprintf("Database updated from mirror %s.\n", m->mirror);
}
FREE_MIRROR(h);
return ret;
}
/* Only continue if there is an error connecting to the host */
if((ret != 52) && (ret != 54))
{
FREE_MIRROR(h);
return ret;
}
mprintf("Waiting 10 seconds...\n");
sleep(10);
mirror_used++;
m = m->next;
}
FREE_MIRROR(h);
return ret;
}
mirrors* parse_mirrorcfg(struct optstruct *opt)
{
mirrors *head = NULL, *curr = NULL, *prev = NULL;
char *datadir = NULL, *mirrorcfg = NULL;
FILE *fd = NULL;
char buf[BUFSIZ];
int hosts_found = 0;
if(optl(opt, "datadir"))
{
datadir = getargl(opt, "datadir");
}
else
{
datadir = DATADIR;
}
if((mirrorcfg = malloc(sizeof(char) * (strlen(datadir) + strlen(MIRROR_CFG) + 1)))
== NULL)
{
fprintf(stderr, "ERROR: Can't allocate sufficient memory\n");
mexit(1);
}
strcpy(mirrorcfg, datadir);
strcat(mirrorcfg, MIRROR_CFG);
if((fd = fopen(mirrorcfg, "r")) == NULL)
{
fprintf(stderr, "ERROR: Can't open mirror configuration file %s !\n",
mirrorcfg);
free(mirrorcfg);
mexit(1);
}
while(fgets(buf, BUFSIZ, fd))
{
if(buf[0] == '#')
continue;
if(strlen(buf) > 1)
{
if((curr = malloc(sizeof(struct _mirrors))) == NULL)
{
fprintf(stderr, "ERROR: Can't allocate sufficient memory\n");
free(mirrorcfg);
FREE_MIRROR(head);
return NULL;
}
curr->mirror = NULL;
curr->next = NULL;
if(head == NULL)
head = curr;
if(prev != NULL)
prev->next = curr;
if((curr->mirror = malloc(sizeof(char) * (strlen(buf) +1))) == NULL)
{
fprintf(stderr, "ERROR: Can't allocate sufficient memory\n");
free(mirrorcfg);
FREE_MIRROR(head);
return NULL;
}
chomp(buf);
strcpy(curr->mirror, buf);
prev = curr;
hosts_found++;
}
}
if(fclose(fd) != 0)
{
fprintf(stderr, "ERROR: Can't close fd !\n");
}
if(hosts_found == 0)
{
fprintf(stderr, "ERROR: No hosts defined in %s !\n", mirrorcfg);
FREE_MIRROR(head);
free(mirrorcfg);
mexit(1);
}
free(mirrorcfg);
return head;
}
void daemonize(void)
{
int i;
for(i = 0; i < 3; i++)
close(i);
umask(0);
if(fork())
exit(0);
setsid();
mprintf_disabled = 1;
}
void help(void)
{
mprintf_stdout = 1;
mprintf("\n");
mprintf(" Clam AntiVirus: freshclam "VERSION"\n");
mprintf(" (c) 2002, 2003 Tomasz Kojm <[EMAIL PROTECTED]>\n\n");
mprintf(" --help -h show help\n");
mprintf(" --version -V print version number and
exit\n");
mprintf(" --verbose -v be verbose\n");
mprintf(" --debug enable debug messages\n");
mprintf(" --quiet be quiet, output only error
messages\n");
mprintf(" --stdout write to stdout instead of
stderr\n");
mprintf(" (this help is always written to
stdout)\n");
mprintf("\n");
mprintf(" --user=USER -u USER run as USER\n");
mprintf(" --daemon -d run in daemon mode\n");
mprintf(" --checks=#n -c #n #n checks by day, 1 <= n <=
50\n");
mprintf(" --datadir=DIRECTORY download new database in
DIRECTORY\n");
mprintf(" --log=FILE -l FILE save download report in FILE\n");
mprintf(" --log-verbose save additional informations\n");
mprintf(" --http-proxy=hostname[:port] use proxy server hostname\n");
mprintf(" --proxy-user=username:passwd use username/password for proxy
auth\n");
#ifdef BUILD_CLAMD
mprintf(" --daemon-notify[=/path/clamav.conf] send RELOAD command to clamd\n");
#endif
mprintf(" --on-update-execute=COMMAND execute COMMAND after successful
update\n");
mprintf(" --on-error-execute=COMMAND execute COMMAND if errors
occured\n");
mprintf("\n");
exit(0);
}
