Initial Ccheckin of prozilla 2.0.4

This commit is contained in:
Mario Fetka
2010-08-31 03:50:41 +02:00
commit 093662fc48
226 changed files with 131185 additions and 0 deletions

8
src/.cvsignore Normal file
View File

@@ -0,0 +1,8 @@
Makefile
autom4te.cache
config.h
config.log
config.status
stamp-h1
*.tar.gz
.tm_project.cache

16
src/Makefile.am Normal file
View File

@@ -0,0 +1,16 @@
#------------------------------------------------------------------------------
# Process this file with automake to produce Makefile.in.
#------------------------------------------------------------------------------
bin_PROGRAMS = proz
AM_CPPFLAGS = @CPPFLAGS@ -fno-inline -DLOCALEDIR=\"$(datadir)/locale\"
proz_SOURCES = main.cpp misc.cpp download_win.cpp init.cpp prefs.cpp ftpsearch_win.cpp interface.c
INCLUDES = -I. -I.. -I../libprozilla/src -I../intl -I@includedir@
AM_CFLAGS = @CFLAGS@ -D_REENTRANT -W -Wall -ggdb
AM_CFLAGS += -DGLOBAL_CONF_FILE="\"@sysconfdir@/prozilla.conf\"" -DLOCALEDIR=\"$(datadir)/locale\"
#AM_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
AM_LDFLAGS = @LDFLAGS@
LDADD = ../libprozilla/src/libprozilla.la -L@libdir@
LIBS = @LIBS@ $(THREAD_LIBS)

530
src/Makefile.in Normal file
View File

@@ -0,0 +1,530 @@
# Makefile.in generated by automake 1.7.9 from Makefile.am.
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# 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.
@SET_MAKE@
#------------------------------------------------------------------------------
# Process this file with automake to produce Makefile.in.
#------------------------------------------------------------------------------
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CEFLAGS = @CEFLAGS@
CFLAGS = @CFLAGS@
CPFLAGS = @CPFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DATADIRNAME = @DATADIRNAME@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GENCAT = @GENCAT@
GLIBC21 = @GLIBC21@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
INSTOBJEXT = @INSTOBJEXT@
INTLBISON = @INTLBISON@
INTLLIBS = @INTLLIBS@
INTLOBJS = @INTLOBJS@
INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@
LDEFLAGS = @LDEFLAGS@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@ $(THREAD_LIBS)
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
THREAD_LIBS = @THREAD_LIBS@
UNAME = @UNAME@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
bin_PROGRAMS = proz
AM_CPPFLAGS = @CPPFLAGS@ -fno-inline -DLOCALEDIR=\"$(datadir)/locale\"
proz_SOURCES = main.cpp misc.cpp download_win.cpp init.cpp prefs.cpp ftpsearch_win.cpp interface.c
INCLUDES = -I. -I.. -I../libprozilla/src -I../intl -I@includedir@
AM_CFLAGS = @CFLAGS@ -D_REENTRANT -W -Wall -ggdb -DGLOBAL_CONF_FILE="\"@sysconfdir@/prozilla.conf\"" -DLOCALEDIR=\"$(datadir)/locale\"
#AM_CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
AM_LDFLAGS = @LDFLAGS@
LDADD = ../libprozilla/src/libprozilla.la -L@libdir@
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
bin_PROGRAMS = proz$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_proz_OBJECTS = main.$(OBJEXT) misc.$(OBJEXT) download_win.$(OBJEXT) \
init.$(OBJEXT) prefs.$(OBJEXT) ftpsearch_win.$(OBJEXT) \
interface.$(OBJEXT)
proz_OBJECTS = $(am_proz_OBJECTS)
proz_LDADD = $(LDADD)
proz_DEPENDENCIES = ../libprozilla/src/libprozilla.la
proz_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/download_win.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ftpsearch_win.Po ./$(DEPDIR)/init.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/interface.Po ./$(DEPDIR)/main.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/misc.Po ./$(DEPDIR)/prefs.Po
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
$(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(proz_SOURCES)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(proz_SOURCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .cpp .lo .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu src/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
rm -f $(DESTDIR)$(bindir)/$$f; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
proz$(EXEEXT): $(proz_OBJECTS) $(proz_DEPENDENCIES)
@rm -f proz$(EXEEXT)
$(CXXLINK) $(proz_LDFLAGS) $(proz_OBJECTS) $(proz_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/download_win.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftpsearch_win.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prefs.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
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: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
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
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
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 "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
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
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_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 $(CONFIG_CLEAN_FILES)
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-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am
# 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:

726
src/download_win.cpp Normal file
View File

@@ -0,0 +1,726 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <errno.h>
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include "main.h"
#include "download_win.h"
#include "interface.h"
void
DL_Window::cleanup (boolean erase_dlparts)
{
/*handle cleanup */
if (status == DL_DOWNLOADING)
{
proz_download_stop_downloads (download);
if (erase_dlparts == TRUE)
{
proz_download_delete_target (download);
proz_log_delete_logfile (download);
}
}
else if (status == DL_GETTING_INFO)
{
/*terminate info thread */
pthread_cancel (info_thread);
pthread_join (info_thread, NULL);
}
else if (status == DL_JOINING)
{
/*terminate joining thread */
proz_download_cancel_joining_thread (download);
pthread_join (download->join_thread, NULL);
}
else if (status == DL_FTPSEARCHING)
{
ftpsearch_win->cleanup ();
}
status = DL_ABORTED;
}
DL_Window::~DL_Window ()
{
proz_connection_free_connection (connection, true);
delete (ftpsearch_win);
}
DL_Window::DL_Window (urlinfo * url_data)
{
// key = 0;
got_info = FALSE;
got_dl = FALSE;
status = DL_IDLING;
memcpy (&u, url_data, sizeof (u));
memset (&update_time, 0, sizeof (struct timeval));
num_connections = rt.num_connections;
ftpsearch_win = new FTPS_Window ();
do_ftpsearch = FALSE;
using_ftpsearch = FALSE;
}
void
DL_Window::my_cb ()
{
if (status == DL_GETTING_INFO)
{
handle_info_thread ();
return;
}
// if ((got_info == TRUE && status == DL_IDLING && got_dl == FALSE)
if ((status == DL_RESTARTING && got_info == TRUE)
|| status == DL_DLPRESTART)
{
do_download ();
}
if (status == DL_DOWNLOADING)
{
handle_download_thread ();
return;
}
if (status == DL_JOINING)
{
handle_joining_thread ();
return;
}
if (status == DL_FATALERR)
{
handle_dl_fatal_error ();
return;
}
if (status == DL_PAUSED)
{
//TODO what to do when paused
return;
}
if (status == DL_FTPSEARCHING)
{
handle_ftpsearch ();
return;
}
}
void
DL_Window::dl_start (int num_connections, boolean ftpsearch)
{
do_ftpsearch = ftpsearch;
connection = proz_connection_init (&u, &getinfo_mutex);
proz_connection_set_msg_proc (connection, ms, this);
PrintMessage("Creating the thread that gets info about file..\n");
proz_get_url_info_loop (connection, &info_thread);
status = DL_GETTING_INFO;
}
void
DL_Window::do_download ()
{
logfile lf;
status = DL_DLPRESTART;
//setup the download
download = proz_download_init (&connection->u);
proz_debug("proz_download_init complete");
handle_prev_download ();
if(status==DL_FATALERR)
{
return;
}
if(download->resume_mode ==TRUE)
{
if (proz_log_read_logfile(&lf, download, FALSE) != 1)
{
PrintMessage
("A error occured while processing the logfile! Assuming default number of connections");
}
// validate the info returned
//TODO check whether files size is the same and if not prompt the user what to do.
if (lf.num_connections != num_connections)
{
PrintMessage
("The previous download used a different number of connections than the default! so I will use the previous number of threads");
num_connections = lf.num_connections;
assert(num_connections > 0);
// cleanup(FALSE);
}
}
if (rt.display_mode == DISP_CURSES)
erase();
start_download ();
}
void
DL_Window::handle_prev_download ()
{
int ret = 0;
/* we will check and see if 1. previous partial download exists and
2. if the file to be downloaded already exists in the local
directory
*/
//Check and see if the file is already downloaded..
//check the --no-getch flag
if (rt.dont_prompt != TRUE)
{
int target_exists=proz_download_target_exist(download);
if(target_exists)
{
ret=askUserOverwrite(connection);
if(ret=='O')
{
//just continue, it will anyway be overwritten by the download routines.
}
if(ret=='A')
{
status = DL_FATALERR;
return;
}
}
}
/*Check for a prior download */
int previous_dl = proz_download_prev_download_exists (download);
if (previous_dl == 1)
{
download->resume_mode = TRUE;
//connection supports resume
if (connection->resume_support)
{
//check the --no-getch flag
if (rt.dont_prompt == TRUE)
{
//see if the user had a preference, resume or overwrite
if (rt.resume_mode == TRUE)
download->resume_mode = TRUE;
else
if (rt.force_mode == TRUE)
download->resume_mode = FALSE;
}
else
{
//ask the user (curses or terminal)
ret = askUserResume(connection, true);
if (ret == 'R')
download->resume_mode = TRUE;
else
download->resume_mode = FALSE;
}
}
else
{//resume NOT supported
// --no-getch and no force-mode means fatal error!!!
if (rt.dont_prompt == TRUE && rt.force_mode == FALSE)
{
status = DL_FATALERR;
handle_dl_fatal_error ();
return;
}
//force overwrite
if (rt.dont_prompt == TRUE && rt.force_mode == TRUE)
download->resume_mode = FALSE;
else
{
//Ask the user
ret = askUserResume(connection, false);
if (ret == 'O')
download->resume_mode = FALSE;
else
{ //Abort
status = DL_FATALERR;
handle_dl_fatal_error ();
return;
}
}
}
}
}
void
DL_Window::start_download ()
{
int ret = 0;
proz_debug("start_download");
if (using_ftpsearch != TRUE)
ret = num_connections =
proz_download_setup_connections_no_ftpsearch
(download, connection, num_connections);
else
ret = proz_download_setup_connections_ftpsearch (download,
connection,
ftpsearch_win->
request,
num_connections);
if (ret == -1)
{
PrintMessage("Write Error: There may not be enough free space or a disk write failed when attempting to create output file\n");
status = DL_ABORTED;
return;
}
/*Display resume status */
if (download->resume_support)
{
PrintMessage("RESUME supported\n\n");
}
else
{
PrintMessage("RESUME NOT supported\n");
}
gettimeofday (&update_time, NULL);
proz_download_start_downloads (download, download->resume_mode);
status = DL_DOWNLOADING;
return;
}
void
DL_Window::handle_info_thread ()
{
bool getting_info = proz_connection_running (connection);
if (getting_info == FALSE)
{
pthread_join (info_thread, NULL);
if (connection->err == HOK || connection->err == FTPOK)
{
got_info = TRUE;
if (connection->main_file_size != -1)
{
PrintMessage("File Size = %lld Kb\n\n",
connection->main_file_size / 1024);
}
else
PrintMessage("File Size is UNKOWN\n\n");
//Added ftpsearch only is size > min size
if ((connection->main_file_size != -1
&& do_ftpsearch == TRUE) && (connection->main_file_size / 1024 >= rt.min_search_size))
{
status = DL_FTPSEARCHING;
if (rt.ftpsearch_server_id == 0)
{
ftpsearch_win->
fetch_mirror_info
(&connection->u,
connection->main_file_size,
"http://www.filesearching.com/cgi-bin/s",
FILESEARCH_RU,
rt.ftps_mirror_req_n);
}
else if (rt.ftpsearch_server_id == 1)
{
ftpsearch_win->
fetch_mirror_info
(&connection->u,
connection->main_file_size,
"http://ftpsearch.elmundo.es:8000/ftpsearch",
LYCOS, rt.ftps_mirror_req_n);
}
}
else
{
if (connection->main_file_size / 1024 >= rt.min_search_size && (do_ftpsearch == TRUE))
PrintMessage("File size is less than the minimum, skipping ftpsearch");
do_download ();
}
}
else
{
if (connection->err == FTPNSFOD
|| connection->err == HTTPNSFOD)
{
PrintMessage("The URL %s doesnt exist!\n",
connection->u.url);
got_dl = FALSE;
got_info = FALSE;
status = DL_FATALERR;
}
else
{
PrintMessage("An error occurred: %s \n",
proz_strerror(connection->err));
got_dl = FALSE;
got_info = FALSE;
status = DL_FATALERR;
}
}
}
}
void
DL_Window::handle_ftpsearch ()
{
uerr_t err;
err = ftpsearch_win->callback ();
if (err == MASSPINGDONE)
{
if (ftpsearch_win->request->num_mirrors == 0)
{
using_ftpsearch = FALSE;
PrintMessage("No suitable mirrors were found, downloading from original server\n");
do_download ();
return;
}
using_ftpsearch = TRUE;
do_download ();
return;
}
if (err == FTPSFAIL)
{
using_ftpsearch = FALSE;
do_download ();
return;
}
// if(ftpsearch_win->exit_ftpsearch_button_pressed==TRUE)
if (using_ftpsearch == TRUE)
{
if (ftpsearch_win->got_mirror_info == TRUE)
{
using_ftpsearch = TRUE;
}
else
{
using_ftpsearch = FALSE;
}
do_download ();
}
}
void
DL_Window::handle_download_thread ()
{
uerr_t err;
struct timeval cur_time;
struct timeval diff_time;
err = proz_download_handle_threads (download);
gettimeofday (&cur_time, NULL);
proz_timeval_subtract (&diff_time, &cur_time, &update_time);
if ((((diff_time.tv_sec * 1000) + (diff_time.tv_usec / 1000)) > 200)
|| err == DLDONE)
{
print_status (download, rt.quiet_mode);
if (download->main_file_size != -1)
{
}
/*The time of the current screen */
gettimeofday (&update_time, NULL);
}
if (err == DLDONE)
{
PrintMessage("Got DL succesfully, now renaming file\n");
got_dl = TRUE;
PrintMessage ("Renaming file %s .....\n",
download->u.file);
status = DL_JOINING;
proz_download_join_downloads (download);
joining_thread_running = TRUE;
}
if (err == CANTRESUME)
{
/*We can only use one connections and we cant resume */
num_connections = 1;
connection->resume_support = FALSE;
got_dl = FALSE;
status = DL_RESTARTING;
}
if (err == DLLOCALFATAL)
{
PrintMessage ("One connection of the download %s encountered a unrecoverable local error, usually lack of free space, or a write to bad medium, or a problem with permissions,so please fix this and retry\n",
connection->u.url);
got_dl = FALSE;
status = DL_FATALERR;
}
if (err == DLREMOTEFATAL)
{
PrintMessage (_
("A connection(s) of the download %s encountered a unrecoverable remote error, usually the file not being present in the remote server, therefore the download had to be aborted!\n"),
connection->u.url);
got_dl = FALSE;
status = DL_FATALERR;
}
}
void
DL_Window::handle_joining_thread ()
{
boolean bDone = false;
uerr_t building_status = proz_download_get_join_status (download);
if (building_status == JOINERR)
{
if (joining_thread_running == TRUE)
{
proz_download_wait_till_end_joining_thread (download);
joining_thread_running = FALSE;
}
}
if (building_status == JOINDONE)
{
if (joining_thread_running == TRUE)
{
proz_download_wait_till_end_joining_thread (download);
joining_thread_running = FALSE;
bDone = true;
}
/*has the user pressed OK at the end of the download */
if (bDone == true)
{
PrintMessage("All Done.\n");
//curses_query_user_input("Press any key to exit.");
proz_download_delete_dl_file (download);
proz_download_free_download (download, 0);
status = DL_IDLING;
}
status = DL_DONE;
}
}
void
DL_Window::handle_dl_fatal_error ()
{
status = DL_FATALERR;
cleanup (FALSE);
return;
}
void
DL_Window::print_status (download_t * download, int quiet_mode)
{
if (rt.display_mode == DISP_CURSES)
DisplayCursesInfo(download);
else
{
if (quiet_mode == FALSE)
{
for (int i = 0; i < download->num_connections; i++)
{
fprintf (stdout,
"%2.2d %-30.30s %15.15s %10Ld\n",
i + 1, download->pconnections[i]->u.host,
proz_connection_get_status_string (download->
pconnections
[i]),
proz_connection_get_total_bytes_got
(download->pconnections[i]));
}
fprintf (stdout, "Total Bytes received %Ld Kb\n",
proz_download_get_total_bytes_got (download) / 1024);
fprintf (stdout, "Average Speed = %.3f Kb/sec\n",
proz_download_get_average_speed (download) / 1024);
}
int secs_left;
char timeLeft[30];
if ((secs_left =
proz_download_get_est_time_left (download)) != -1)
{
if (secs_left < 60)
snprintf (timeLeft, sizeof(timeLeft), "00:%.2d", secs_left);
else if (secs_left < 3600)
snprintf (timeLeft, sizeof(timeLeft), "00:%.2d:%.2d",
secs_left / 60, secs_left % 60);
else
snprintf (timeLeft, sizeof(timeLeft), "%.2d:%.2d:00",
secs_left / 3600,
(secs_left % 3600) / 60);
}
else
sprintf (timeLeft, "??:??:??");
off_t totalDownloaded = 0;
off_t totalFile = 0;
long aveSpeed = 0;
totalFile = download->main_file_size / 1024;
totalDownloaded =
proz_download_get_total_bytes_got (download) /
1024;
aveSpeed = (long)(proz_download_get_average_speed (download) / 1024);
//WGET looks like this:
//xx% [=======> ] nnn,nnn,nnn XXXX.XXK/s ETA hh:mm:ss
fprintf (stdout, " %.2lf%% %lldKb/%lldkb %0.3fKb/s ETA %s \r",
((float)totalDownloaded) / ((float)totalFile / 100),
totalDownloaded, totalFile, (float)aveSpeed, timeLeft);
fflush (stdout);
}
}
int DL_Window::askUserResume(connection_t *connection, boolean resumeSupported)
{
int ret = 0;
const char msg[] = "Previous download of %s exists, would you like to (R)esume it or (O)verwrite it?";
const char msg2[] = "Previous download of %s exists, would you like to (A)bort it or (O)verwrite it?";
do {
if (rt.display_mode == DISP_CURSES)
ret = curses_query_user_input((resumeSupported == TRUE)?msg:msg2,connection->u.file);
else
{
fprintf(stdout,"\n");
fprintf(stdout,(resumeSupported == TRUE)?msg:msg2,connection->u.file);
ret = getc(stdin);
ret = islower(ret) ? toupper(ret) : ret;
}
switch(ret)
{
case 'O':
break;
case 'A':
if (resumeSupported == TRUE)
ret=0;
break;
case 'R':
if (resumeSupported == FALSE)
ret=0;
break;
default:
ret=0;
break;
}
} while (ret == 0);
return ret;
}
int DL_Window::askUserOverwrite(connection_t *connectionb)
{
int ret = 0;
const char msg[] = "File %s already exists, would you like to (A)bort it or (O)verwrite it?";
do {
if (rt.display_mode == DISP_CURSES)
ret = curses_query_user_input(msg,connection->u.file);
else
{
fprintf(stdout,"\n");
fprintf(stdout,msg,connection->u.file);
ret = getc(stdin);
ret = islower(ret) ? toupper(ret) : ret;
}
switch(ret)
{
case 'O':
break;
case 'A':
break;
default:
ret=0;
break;
}
} while (ret == 0);
return ret;
}

731
src/download_win.cpp~ Normal file
View File

@@ -0,0 +1,731 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <errno.h>
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include "main.h"
#include "download_win.h"
#include "interface.h"
void
DL_Window::cleanup (boolean erase_dlparts)
{
/*handle cleanup */
if (status == DL_DOWNLOADING)
{
proz_download_stop_downloads (download);
if (erase_dlparts == TRUE)
{
proz_download_delete_target (download);
proz_log_delete_logfile (download);
}
}
else if (status == DL_GETTING_INFO)
{
/*terminate info thread */
pthread_cancel (info_thread);
pthread_join (info_thread, NULL);
}
else if (status == DL_JOINING)
{
/*terminate joining thread */
proz_download_cancel_joining_thread (download);
pthread_join (download->join_thread, NULL);
}
else if (status == DL_FTPSEARCHING)
{
ftpsearch_win->cleanup ();
}
status = DL_ABORTED;
}
DL_Window::~DL_Window ()
{
proz_connection_free_connection (connection, true);
delete (ftpsearch_win);
}
DL_Window::DL_Window (urlinfo * url_data)
{
// key = 0;
got_info = FALSE;
got_dl = FALSE;
status = DL_IDLING;
memcpy (&u, url_data, sizeof (u));
memset (&update_time, 0, sizeof (struct timeval));
num_connections = rt.num_connections;
ftpsearch_win = new FTPS_Window ();
do_ftpsearch = FALSE;
using_ftpsearch = FALSE;
}
void
DL_Window::my_cb ()
{
if (status == DL_GETTING_INFO)
{
handle_info_thread ();
return;
}
// if ((got_info == TRUE && status == DL_IDLING && got_dl == FALSE)
if ((status == DL_RESTARTING && got_info == TRUE)
|| status == DL_DLPRESTART)
{
do_download ();
}
if (status == DL_DOWNLOADING)
{
handle_download_thread ();
return;
}
if (status == DL_JOINING)
{
handle_joining_thread ();
return;
}
if (status == DL_FATALERR)
{
handle_dl_fatal_error ();
return;
}
if (status == DL_PAUSED)
{
//TODO what to do when paused
return;
}
if (status == DL_FTPSEARCHING)
{
handle_ftpsearch ();
return;
}
}
void
DL_Window::dl_start (int num_connections, boolean ftpsearch)
{
do_ftpsearch = ftpsearch;
connection = proz_connection_init (&u, &getinfo_mutex);
proz_connection_set_msg_proc (connection, ms, this);
PrintMessage("Creating the thread that gets info about file..\n");
proz_get_url_info_loop (connection, &info_thread);
status = DL_GETTING_INFO;
}
void
DL_Window::do_download ()
{
logfile lf;
status = DL_DLPRESTART;
//setup the download
download = proz_download_init (&connection->u);
proz_debug("proz_download_init complete");
handle_prev_download ();
if(status==DL_FATALERR)
{
return;
}
if(download->resume_mode ==TRUE)
{
if (proz_log_read_logfile(&lf, download, FALSE) != 1)
{
PrintMessage
("A error occured while processing the logfile! Assuming default number of connections");
}
// validate the info returned
//TODO check whether files size is the same and if not prompt the user what to do.
if (lf.num_connections != num_connections)
{
PrintMessage
("The previous download used a different number of connections than the default! so I will use the previous number of threads");
num_connections = lf.num_connections;
assert(num_connections > 0);
// cleanup(FALSE);
}
}
if (rt.display_mode == DISP_CURSES)
erase();
start_download ();
}
void
DL_Window::handle_prev_download ()
{
int ret = 0;
/* we will check and see if 1. previous partial download exists and
2. if the file to be downloaded already exists in the local
directory
*/
//Check and see if the file is already downloaded..
//check the --no-getch flag
if (rt.dont_prompt != TRUE)
{
int target_exists=proz_download_target_exist(download);
if(target_exists)
{
ret=askUserOverwrite(connection);
if(ret=='O')
{
//just continue, it will anyway be overwritten by the download routines.
}
if(ret=='A')
{
status = DL_FATALERR;
return;
}
}
}
/*Check for a prior download */
int previous_dl = proz_download_prev_download_exists (download);
if (previous_dl == 1)
{
download->resume_mode = TRUE;
//connection supports resume
if (connection->resume_support)
{
//check the --no-getch flag
if (rt.dont_prompt == TRUE)
{
//see if the user had a preference, resume or overwrite
if (rt.resume_mode == TRUE)
download->resume_mode = TRUE;
else
if (rt.force_mode == TRUE)
download->resume_mode = FALSE;
}
else
{
//ask the user (curses or terminal)
ret = askUserResume(connection, true);
if (ret == 'R')
download->resume_mode = TRUE;
else
download->resume_mode = FALSE;
}
}
else
{//resume NOT supported
// --no-getch and no force-mode means fatal error!!!
if (rt.dont_prompt == TRUE && rt.force_mode == FALSE)
{
status = DL_FATALERR;
handle_dl_fatal_error ();
return;
}
//force overwrite
if (rt.dont_prompt == TRUE && rt.force_mode == TRUE)
download->resume_mode = FALSE;
else
{
//Ask the user
ret = askUserResume(connection, false);
if (ret == 'O')
download->resume_mode = FALSE;
else
{ //Abort
status = DL_FATALERR;
handle_dl_fatal_error ();
return;
}
}
}
}
}
void
DL_Window::start_download ()
{
int ret = 0;
proz_debug("start_download");
if (using_ftpsearch != TRUE)
ret = num_connections =
proz_download_setup_connections_no_ftpsearch
(download, connection, num_connections);
else
ret = proz_download_setup_connections_ftpsearch (download,
connection,
ftpsearch_win->
request,
num_connections);
if (ret == -1)
{
PrintMessage("Write Error: There may not be enough free space or a disk write failed when attempting to create output file\n");
status = DL_ABORTED;
return;
}
/*Display resume status */
if (download->resume_support)
{
PrintMessage("RESUME supported\n\n");
}
else
{
PrintMessage("RESUME NOT supported\n");
}
gettimeofday (&update_time, NULL);
proz_download_start_downloads (download, download->resume_mode);
status = DL_DOWNLOADING;
return;
}
void
DL_Window::handle_info_thread ()
{
bool getting_info = proz_connection_running (connection);
if (getting_info == FALSE)
{
pthread_join (info_thread, NULL);
if (connection->err == HOK || connection->err == FTPOK)
{
got_info = TRUE;
if (connection->main_file_size != -1)
{
PrintMessage("File Size = %lld Kb\n\n",
connection->main_file_size / 1024);
}
else
PrintMessage("File Size is UNKOWN\n\n");
//Added ftpsearch only is size > min size
if ((connection->main_file_size != -1
&& do_ftpsearch == TRUE) && (connection->main_file_size / 1024 >= rt.min_search_size))
{
status = DL_FTPSEARCHING;
if (rt.ftpsearch_server_id == 0)
{
ftpsearch_win->
fetch_mirror_info
(&connection->u,
connection->main_file_size,
"http://www.filesearching.com/cgi-bin/s",
FILESEARCH_RU,
rt.ftps_mirror_req_n);
}
else if (rt.ftpsearch_server_id == 1)
{
ftpsearch_win->
fetch_mirror_info
(&connection->u,
connection->main_file_size,
"http://ftpsearch.elmundo.es:8000/ftpsearch",
LYCOS, rt.ftps_mirror_req_n);
}
}
else
{
if (connection->main_file_size / 1024 >= rt.min_search_size && (do_ftpsearch == TRUE))
PrintMessage("File size is less than the minimum, skipping ftpsearch");
do_download ();
}
}
else
{
if (connection->err == FTPNSFOD
|| connection->err == HTTPNSFOD)
{
PrintMessage("The URL %s doesnt exist!\n",
connection->u.url);
got_dl = FALSE;
got_info = FALSE;
status = DL_FATALERR;
}
else
{
PrintMessage("An error occurred: %s \n",
proz_strerror(connection->err));
got_dl = FALSE;
got_info = FALSE;
status = DL_FATALERR;
}
}
}
}
void
DL_Window::handle_ftpsearch ()
{
uerr_t err;
err = ftpsearch_win->callback ();
if (err == MASSPINGDONE)
{
if (ftpsearch_win->request->num_mirrors == 0)
{
using_ftpsearch = FALSE;
PrintMessage("No suitable mirrors were found, downloading from original server\n");
do_download ();
return;
}
using_ftpsearch = TRUE;
do_download ();
return;
}
if (err == FTPSFAIL)
{
using_ftpsearch = FALSE;
do_download ();
return;
}
// if(ftpsearch_win->exit_ftpsearch_button_pressed==TRUE)
if (using_ftpsearch == TRUE)
{
if (ftpsearch_win->got_mirror_info == TRUE)
{
using_ftpsearch = TRUE;
}
else
{
using_ftpsearch = FALSE;
}
do_download ();
}
}
void
DL_Window::handle_download_thread ()
{
uerr_t err;
struct timeval cur_time;
struct timeval diff_time;
err = proz_download_handle_threads (download);
gettimeofday (&cur_time, NULL);
proz_timeval_subtract (&diff_time, &cur_time, &update_time);
if ((((diff_time.tv_sec * 1000) + (diff_time.tv_usec / 1000)) > 200)
|| err == DLDONE)
{
print_status (download, rt.quiet_mode);
if (download->main_file_size != -1)
{
}
/*The time of the current screen */
gettimeofday (&update_time, NULL);
}
if (err == DLDONE)
{
PrintMessage("Got DL succesfully, now renaming file\n");
/* if (rt.display_mode == DISP_STDOUT)
print_status (download, FALSE);
else
DisplayCursesInfo(download);
*/
got_dl = TRUE;
PrintMessage ("Renaming file %s .....\n",
download->u.file);
status = DL_JOINING;
proz_download_join_downloads (download);
joining_thread_running = TRUE;
}
if (err == CANTRESUME)
{
/*We can only use one connections and we cant resume */
num_connections = 1;
connection->resume_support = FALSE;
got_dl = FALSE;
status = DL_RESTARTING;
}
if (err == DLLOCALFATAL)
{
PrintMessage ("One connection of the download %s encountered a unrecoverable local error, usually lack of free space, or a write to bad medium, or a problem with permissions,so please fix this and retry\n",
connection->u.url);
got_dl = FALSE;
status = DL_FATALERR;
}
if (err == DLREMOTEFATAL)
{
PrintMessage (_
("A connection(s) of the download %s encountered a unrecoverable remote error, usually the file not being present in the remote server, therefore the download had to be aborted!\n"),
connection->u.url);
got_dl = FALSE;
status = DL_FATALERR;
}
}
void
DL_Window::handle_joining_thread ()
{
boolean bDone = false;
uerr_t building_status = proz_download_get_join_status (download);
if (building_status == JOINERR)
{
if (joining_thread_running == TRUE)
{
proz_download_wait_till_end_joining_thread (download);
joining_thread_running = FALSE;
}
}
if (building_status == JOINDONE)
{
if (joining_thread_running == TRUE)
{
proz_download_wait_till_end_joining_thread (download);
joining_thread_running = FALSE;
bDone = true;
}
/*has the user pressed OK at the end of the download */
if (bDone == true)
{
PrintMessage("All Done.\n");
//curses_query_user_input("Press any key to exit.");
proz_download_delete_dl_file (download);
proz_download_free_download (download, 0);
status = DL_IDLING;
}
status = DL_DONE;
}
}
void
DL_Window::handle_dl_fatal_error ()
{
status = DL_FATALERR;
cleanup (FALSE);
return;
}
void
DL_Window::print_status (download_t * download, int quiet_mode)
{
if (rt.display_mode == DISP_CURSES)
DisplayCursesInfo(download);
else
{
if (quiet_mode == FALSE)
{
for (int i = 0; i < download->num_connections; i++)
{
fprintf (stdout,
"%2.2d %-30.30s %15.15s %10Ld\n",
i + 1, download->pconnections[i]->u.host,
proz_connection_get_status_string (download->
pconnections
[i]),
proz_connection_get_total_bytes_got
(download->pconnections[i]));
}
fprintf (stdout, "Total Bytes received %Ld Kb\n",
proz_download_get_total_bytes_got (download) / 1024);
fprintf (stdout, "Average Speed = %.3f Kb/sec\n",
proz_download_get_average_speed (download) / 1024);
}
int secs_left;
char timeLeft[30];
if ((secs_left =
proz_download_get_est_time_left (download)) != -1)
{
if (secs_left < 60)
snprintf (timeLeft, sizeof(timeLeft), "00:%.2d", secs_left);
else if (secs_left < 3600)
snprintf (timeLeft, sizeof(timeLeft), "00:%.2d:%.2d",
secs_left / 60, secs_left % 60);
else
snprintf (timeLeft, sizeof(timeLeft), "%.2d:%.2d:00",
secs_left / 3600,
(secs_left % 3600) / 60);
}
else
sprintf (timeLeft, "??:??:??");
off_t totalDownloaded = 0;
off_t totalFile = 0;
long aveSpeed = 0;
totalFile = download->main_file_size / 1024;
totalDownloaded =
proz_download_get_total_bytes_got (download) /
1024;
aveSpeed = (long)(proz_download_get_average_speed (download) / 1024);
//WGET looks like this:
//xx% [=======> ] nnn,nnn,nnn XXXX.XXK/s ETA hh:mm:ss
fprintf (stdout, " %.2lf%% %lldKb/%lldkb %0.3fKb/s ETA %s \r",
((float)totalDownloaded) / ((float)totalFile / 100),
totalDownloaded, totalFile, (float)aveSpeed, timeLeft);
fflush (stdout);
}
}
int DL_Window::askUserResume(connection_t *connection, boolean resumeSupported)
{
int ret = 0;
const char msg[] = "Previous download of %s exists, would you like to (R)esume it or (O)verwrite it?";
const char msg2[] = "Previous download of %s exists, would you like to (A)bort it or (O)verwrite it?";
do {
if (rt.display_mode == DISP_CURSES)
ret = curses_query_user_input((resumeSupported == TRUE)?msg:msg2,connection->u.file);
else
{
fprintf(stdout,"\n");
fprintf(stdout,(resumeSupported == TRUE)?msg:msg2,connection->u.file);
ret = getc(stdin);
ret = islower(ret) ? toupper(ret) : ret;
}
switch(ret)
{
case 'O':
break;
case 'A':
if (resumeSupported == TRUE)
ret=0;
break;
case 'R':
if (resumeSupported == FALSE)
ret=0;
break;
default:
ret=0;
break;
}
} while (ret == 0);
return ret;
}
int DL_Window::askUserOverwrite(connection_t *connectionb)
{
int ret = 0;
const char msg[] = "File %s already exists, would you like to (A)bort it or (O)verwrite it?";
do {
if (rt.display_mode == DISP_CURSES)
ret = curses_query_user_input(msg,connection->u.file);
else
{
fprintf(stdout,"\n");
fprintf(stdout,msg,connection->u.file);
ret = getc(stdin);
ret = islower(ret) ? toupper(ret) : ret;
}
switch(ret)
{
case 'O':
break;
case 'A':
break;
default:
ret=0;
break;
}
} while (ret == 0);
return ret;
}

82
src/download_win.h Normal file
View File

@@ -0,0 +1,82 @@
#ifndef DOWNLOAD_WIN_H
#define DOWNLOAD_WIN_H
#include <config.h>
#include <ctype.h>
#include "prozilla.h"
#include "ftpsearch_win.h"
void ms(const char *msg, void *cb_data);
typedef enum {
DL_IDLING,
DL_GETTING_INFO,
DL_FTPSEARCHING,
DL_DLPRESTART,
DL_DOWNLOADING,
DL_JOINING,
DL_RESTARTING,
DL_PAUSED,
DL_ABORTED,
DL_FATALERR,
DL_DONE
} dlwin_status_t;
//The running dialog type
typedef enum {
DLG_GENERIC,
DLG_URLNSFOD,
DLG_TARGETERASE,
DLG_JOININING,
DLG_PREVRESUME,
DLG_ABORT,
DLG_UNKNOWNERR,
} dlg_class;
class DL_Window {
public:
DL_Window(urlinfo * url_data);
~DL_Window();
void dl_start(int num_connections, boolean ftpsearch);
void my_cb();
void handle_info_thread();
void handle_ftpsearch();
void handle_download_thread();
void start_download();
void handle_joining_thread();
void handle_dl_fatal_error();
void cleanup(boolean erase_dlparts);
void DL_Window::print_status(download_t * download, int quiet_mode);
connection_t *connection;
download_t *download;
urlinfo u;
boolean got_info;
boolean got_dl;
dlwin_status_t status;
pthread_t info_thread;
pthread_mutex_t getinfo_mutex;
int num_connections;
/*The time elapsed since the last update */
struct timeval update_time;
private:
void do_download();
void handle_prev_download();
boolean joining_thread_running;
boolean do_ftpsearch;
boolean using_ftpsearch;
FTPS_Window *ftpsearch_win;
int askUserResume(connection_t *connection, boolean resumeSupported);
int askUserOverwrite(connection_t *connection);
};
#endif

11
src/ftps_win.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef ftps_win_h
#define ftps_win_h
#include "prozilla.h"
/*
class ftps_gui {
public:
ftps_gui();
};
*/
#endif

203
src/ftpsearch_win.cpp Normal file
View File

@@ -0,0 +1,203 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#if HAVE_CONFIG_H
# include <config.h>
#endif
//#include <malloc.h>
//#include <alloca.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include "main.h"
#include "ftpsearch_win.h"
#include "interface.h"
FTPS_Window::FTPS_Window ()
{
memset (&request, 0, sizeof (request));
request_running = FALSE;
ping_running = FALSE;
got_mirror_info = FALSE;
}
void
FTPS_Window::fetch_mirror_info (urlinfo * u, off_t file_size,
char *ftps_loc,
ftpsearch_server_type_t server_type,
int num_req_mirrors)
{
assert (u->file);
request = proz_ftps_request_init (u, file_size, ftps_loc,
server_type, num_req_mirrors);
PrintMessage("Attempting to get %d mirrors from %s\n\n",num_req_mirrors, ftps_loc);
//proz_connection_set_msg_proc (request->connection,
// ftps_win_message_proc, this);
proz_get_complete_mirror_list (request);
request_running = TRUE;
}
//void
//ftps_win_message_proc (const char *msg, void *cb_data)
//{
//
//}
uerr_t
FTPS_Window::callback ()
{
if (request_running == TRUE)
{
if (proz_request_info_running (request) == FALSE)
{
pthread_join (request->info_thread, NULL);
if (request->err != MIRINFOK)
{
request_running = FALSE;
got_mirror_info = FALSE;
return FTPSFAIL;
}
else
{
print_status(request, rt.quiet_mode);
}
request_running = FALSE;
got_mirror_info = TRUE;
request->max_simul_pings = rt.max_simul_pings;
request->ping_timeout.tv_sec = rt.max_ping_wait;
request->ping_timeout.tv_usec = 0;
//Launch the pinging thread
PrintMessage("Got mirror info, %d server(s) found\n", request->num_mirrors);
proz_mass_ping (request);
ping_running = TRUE;
return MASSPINGINPROGRESS;
}
return FTPSINPROGRESS;
}
if (ping_running == TRUE)
{
print_status(request, rt.quiet_mode);
if (proz_request_mass_ping_running (request) == FALSE)
{
ping_done = TRUE;
ping_running = FALSE;
proz_sort_mirror_list (request->mirrors,
request->num_mirrors);
// We have a seprate func to display this
print_status(request, FALSE);
return MASSPINGDONE;
}
return MASSPINGINPROGRESS;
}
return MASSPINGINPROGRESS;
}
void
FTPS_Window::cleanup ()
{
if (request_running == TRUE)
{
proz_cancel_mirror_list_request (request);
return;
}
if (ping_running == TRUE)
{
proz_cancel_mass_ping (request);
return;
}
}
void
cb_exit_ftpsearch (void *data)
{
FTPS_Window *window = (FTPS_Window *) data;
window->exit_ftpsearch_button_pressed = TRUE;
if (window->request_running == TRUE)
{
proz_cancel_mirror_list_request (window->request);
}
if (window->ping_running == TRUE)
{
proz_cancel_mass_ping (window->request);
}
}
void FTPS_Window::print_status(ftps_request_t *request, int quiet_mode)
{
if (quiet_mode == FALSE || rt.display_mode == DISP_CURSES)
{
for (int i = 0; i < request->num_mirrors; i++)
{
pthread_mutex_lock (&request->access_mutex);
ftp_mirror_stat_t status = request->mirrors[i].status;
pthread_mutex_unlock (&request->access_mutex);
switch (status)
{
case UNTESTED:
DisplayInfo(i+1,1, "%-30.30s %s\n",
request->mirrors[i].server_name,
"NOT TESTED");
break;
case RESPONSEOK:
DisplayInfo(i+1,1, "%-30.30s %dms\n",
request->mirrors[i].server_name,
request->mirrors[i].milli_secs);
break;
case NORESPONSE:
case ERROR:
DisplayInfo(i+1,1, "%-30.30s %s\n",
request->mirrors[i].server_name,
"NO REPONSE");
break;
default:
DisplayInfo(i+1,1, "%-30.30s %s\n",
request->mirrors[i].server_name,
"Unkown condition!!");
break;
}
}
if (rt.display_mode == DISP_STDOUT)
fprintf(stdout,"\n");
}
}

55
src/ftpsearch_win.h Normal file
View File

@@ -0,0 +1,55 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#ifndef FTPSEARCH_WIN_H
#define FTPSEARCH_WIN_H
#include <config.h>
#include "prozilla.h"
//#include "ftps_win.h"
//void ftps_win_message_proc (const char *msg, void *cb_data);
class FTPS_Window {
public:
FTPS_Window();
void fetch_mirror_info(urlinfo *u, off_t file_size, char *ftps_loc,
ftpsearch_server_type_t server_type,
int num_req_mirrors);
void cleanup();
uerr_t callback();
void ping_list();
void print_status(ftps_request_t * request, int quiet_mode);
ftps_request_t *request;
boolean request_running;
boolean ping_running;
boolean got_mirror_info;
boolean ping_done;
boolean exit_ftpsearch_button_pressed;
private:
};
#endif

3496
src/images/BigProZilla01.xpm Normal file

File diff suppressed because it is too large Load Diff

225
src/images/Pz12.xpm Normal file
View File

@@ -0,0 +1,225 @@
/* XPM */
static char * Pz12_xpm[] = {
"48 48 174 2",
" c None",
". c #D6D6CE",
"+ c #6B6B6B",
"@ c #292929",
"# c #212121",
"$ c #181818",
"% c #393939",
"& c #313131",
"* c #424242",
"= c #636363",
"- c #4A4A4A",
"; c #525252",
"> c #5A5A5A",
", c #737373",
"' c #848484",
") c #8C8C8C",
"! c #8C8C84",
"~ c #C6C6C6",
"{ c #000000",
"] c #7B7B7B",
"^ c #8C948C",
"/ c #182118",
"( c #94948C",
"_ c #9C9C9C",
": c #A5A5A5",
"< c #949494",
"[ c #4A4242",
"} c #5A5252",
"| c #6B6363",
"1 c #423131",
"2 c #6B3921",
"3 c #9C7B63",
"4 c #8C7363",
"5 c #634239",
"6 c #4A3129",
"7 c #B5B5B5",
"8 c #6B5A52",
"9 c #945A4A",
"0 c #A5735A",
"a c #BD9C84",
"b c #BDA584",
"c c #947B73",
"d c #C6BDBD",
"e c #5A3931",
"f c #5A4242",
"g c #423939",
"h c #6B4A42",
"i c #BD7B5A",
"j c #BD9C7B",
"k c #BDA58C",
"l c #7B6B5A",
"m c #7B6352",
"n c #9C8C7B",
"o c #948473",
"p c #4A2118",
"q c #635242",
"r c #392929",
"s c #9C6342",
"t c #CEA584",
"u c #AD947B",
"v c #6B5242",
"w c #291810",
"x c #423121",
"y c #846B52",
"z c #6B5239",
"A c #290000",
"B c #524A42",
"C c #735A42",
"D c #523929",
"E c #5A4239",
"F c #7B634A",
"G c #CEA58C",
"H c #C69473",
"I c #734221",
"J c #391000",
"K c #393129",
"L c #7B5A52",
"M c #7B5242",
"N c #8C6352",
"O c #846352",
"P c #A5846B",
"Q c #DEAD9C",
"R c #C68C7B",
"S c #A56352",
"T c #8C5239",
"U c #524239",
"V c #84635A",
"W c #946B5A",
"X c #845242",
"Y c #734A39",
"Z c #292921",
"` c #312929",
" . c #ADADAD",
".. c #B5B5AD",
"+. c #C6CECE",
"@. c #CEDEDE",
"#. c #BDC6C6",
"$. c #ADB5B5",
"%. c #C6C6BD",
"&. c #CECEC6",
"*. c #D6DED6",
"=. c #A5ADA5",
"-. c #BDCECE",
";. c #DEF7F7",
">. c #9CA59C",
",. c #BDBDB5",
"'. c #DEDECE",
"). c #DEDED6",
"!. c #C6CEC6",
"~. c #D6E7DE",
"{. c #BDCEC6",
"]. c #D6EFEF",
"^. c #C6D6D6",
"/. c #BDBDBD",
"(. c #D6D6C6",
"_. c #E7E7CE",
":. c #E7E7D6",
"<. c #E7EFDE",
"[. c #E7E7DE",
"}. c #D6DECE",
"|. c #CED6CE",
"1. c #BDC6B5",
"2. c #C6DEDE",
"3. c #ADBDB5",
"4. c #9CADA5",
"5. c #E7EFD6",
"6. c #EFEFE7",
"7. c #E7EFE7",
"8. c #ADADA5",
"9. c #D6F7F7",
"0. c #CEE7E7",
"a. c #DEEFD6",
"b. c #EFF7E7",
"c. c #A5ADAD",
"d. c #B5BDBD",
"e. c #DEE7D6",
"f. c #E7F7DE",
"g. c #E7F7E7",
"h. c #F7F7E7",
"i. c #B5BDB5",
"j. c #DEEFE7",
"k. c #DEE7DE",
"l. c #DEEFDE",
"m. c #EFEFDE",
"n. c #D6D6D6",
"o. c #CECECE",
"p. c #BDC6BD",
"q. c #D6E7D6",
"r. c #E7E7E7",
"s. c #DEDEDE",
"t. c #CED6D6",
"u. c #949C94",
"v. c #CEDECE",
"w. c #EFEFEF",
"x. c #C6D6CE",
"y. c #F7F7EF",
"z. c #F7F7F7",
"A. c #F7526B",
"B. c #F74263",
"C. c #EFFFE7",
"D. c #F75263",
"E. c #FFFFF7",
"F. c #F7FFF7",
"G. c #DEEFEF",
"H. c #F7FFEF",
"I. c #F74A63",
"J. c #EFF7EF",
"K. c #FFFFEF",
"L. c #E7F7F7",
"M. c #D6E7E7",
"N. c #DEF7EF",
"O. c #EFFFF7",
"P. c #9C9C94",
"Q. c #73736B",
" . + @ # $ $ $ @ % $ @ & & # % * * = % - ; > * % ; > , + + ' ) ) ! ",
" ~ % $ $ $ { { $ & % $ $ @ * # * % & - & - & ; & & * $ ; * > , ] ) ' ^ ",
" ~ / { $ $ $ { { $ $ - $ & % * % * % & * & ; - & % & - + % * > - + , ] ) ( ",
" ~ { { { $ @ { $ $ $ $ * $ $ * & & - > - * & * & > % - - > - @ * = % = + ' ) ",
"~ $ { { $ $ $ $ { # % # @ @ % - % % % * - & - > > = $ & - * = @ % > > % ; , _ : ",
"$ { { { $ $ $ $ $ # & & # # & > % - * - * ; % * * ; ; * > - % % ; ; * @ * + ) ) ",
"$ $ $ { { $ & @ $ $ & $ @ % * % % - * > ; % % ; - ; # * % % @ $ $ $ % + , , ) ' ~ ",
"$ $ $ $ $ $ # $ # @ * $ & $ ; - - % - % ; * % ; - , & & * * = ; + , ] ' < ' < ] ' < ",
"{ $ $ { $ # $ $ $ @ * $ @ & = & * & - % - % - > @ > @ * + + , [ } | > ; = + < ' ) = , ) ",
"$ $ $ $ $ @ $ { $ - @ $ & @ - - & @ @ $ $ $ $ * % > & = ' > 1 2 3 4 5 6 1 % - ' ' ' , - , 7 ",
"$ $ { { # $ & $ $ # @ @ & & % - @ & & - > @ $ - @ ; & ; 8 9 0 a b 4 c d e f g = ' ) ) ] , ] = ) ",
"$ @ $ $ @ & * @ @ $ # @ * * % % % @ % & & & % ; $ = % % h i j k l m n o p e q r ] ) ) ' ) ) ' + ",
"& & $ $ @ * @ & @ & & % * - - * * & > > * % - = - , % [ 6 s t u 4 v w x v y z A B > ) ] ) ' ] ] ",
"& @ { { & $ $ $ & % % * & ; ; > > - - = - - - = * * * ; @ 1 9 3 C D E F 3 G H I J K % * = > ] ",
"% # $ { @ @ $ & & * $ $ % - ; - - - = + ; - - = > , ; + = & 1 L M N O P Q R S T 8 U % @ * + ",
"@ $ $ $ @ # # @ & @ * @ % - = > * ; ; - ; - - > * - * = ; & @ $ & E V W N X Y Z % > * ; , ] + ",
"$ $ $ $ @ # & $ & @ - * = ; - ; * ; = - - % > + & - * ; = - * % @ $ $ & @ ` @ @ > @ * * - + > > ",
"$ $ $ $ & @ & # $ # & % % > - ; % > - + % - = = % + * > ; - > - - - % @ * * * % ; > * > + = > > ",
"$ $ $ $ % $ @ % $ % @ @ @ & @ > & - > + * % > + - > - + = ; > - > ; > * > + - > + ; = - + = ; = ",
"$ { # $ $ % # # $ $ # @ * * - - ; > + = > > = - * > & ; = % ; - = % = % * - * ; = * > * ; - & * ",
"@ $ @ & % @ > & & @ @ - * * - % % % - + ; ; + , + ; > = = > = = , > + = , - % > = = ; * , = * @ ",
"$ $ $ $ @ # % # $ @ # $ - > = ; & & ; ] ' ' < ) ] ) ] < ) ] ' , ' = ; * + = - > > % ; ; ; = % * ",
"& % & @ & & * $ $ & @ % @ > ; * & ; = , ] ' _ ._ _ : : : _ _ ) ) ' ] ] + = - = = * - * = = % - ",
"& $ & @ & & @ & @ @ @ # - > > > & ; + ] ' ( _ : ..+.~ +.@.#. .$.7 : _ : : ) ' > + - ; > ; = > + ",
"& % $ & @ $ * # $ $ % @ % > * * = - ] ' _ _ : ..%.&.. . *.7 =.-.;.-.>. .$.: .< ' = * = % % - ; ",
"$ @ # % % & @ & { @ @ * % - - ; > = + < ...,.%.&.'.).).*.&.%.!.~.=.( {.].^./.7 7 _ < _ ] = , - ",
"{ $ $ @ & * & # $ $ % * * * * = - = , < +.~ (.'.'._.:.:.<.[.).}.|.1.=.#.2.3.4.: +./. . .' > = + ",
"{ & & % & % & $ & * # * ; % - > ; = ] < #.!.&.'._._._.5.<.6.7.<.[.}.1.8.( ! ! 4.9.0.#./.7 _ ' , ",
"$ @ @ & % % @ $ & # * ; % > - ; ; - + ) : 7 %.(.:.:._.a.<.7.b.b.6.[.}.%...>.( 4.9.].c.>.+.d.7 < ",
"$ - * & * * $ @ @ # @ - % % * , = % > ] _ 7 %.|.e.:.5.a.a.f.g.b.h.6.[.. ~ i. .$.-._ ! c.9.0.+.: ",
"@ % * & * - $ @ & & - - = * @ * * - > + ) .!.j.*.k.<.l.l.l.f.f.b.b.m.[.n.o.~ p.,...: $.].c.: 7 ",
"% % # & @ % $ # $ $ & & & @ & = % * ; ] ] < : p.|.*.e.k.q.l.l.<.<.g.b.6.r.s.*.n.. o.o.t./.u.u.0.",
"- - @ % * - $ $ @ $ & > & & % ; % ; > = ] ] _ 7 1.*.*.|.v.q.e.a.<.f.b.b.w.w.r.r.r.[.s.s.s.|.~ ",
"& * $ # @ % # $ # & * % % & * % # * * = ] ' ' 7 ^.;.x.p.!.|.q.a.f.g.b.b.y.z.z.z.z.w.w.w.r.s.n.j.",
"- - A.A.A.A.A.& # # # @ % # - = @ ; & - = + ] ) 7 ].{...i.B.B.a.f.B.B.b.C.B.B.z.z.z.z.z.w.r.n.&.",
"% % A.A.A.A.D.D.& - - & * * ; - - = > > = + ) ) _ +.d.=...B.B.e.<.B.B.g.b.B.B.E.E.F.z.z.z.w.r.n.",
"& @ A.A.& - D.D.D.& * @ & - - & ; * % - * - , ] ) : c.>.{.j.*.e.<.B.B.g.f.B.B.F.E.E.E.z.z.z.w.r.",
"; % A.A.- - * D.D.@ - @ % % > % @ = = * % ; ] ' ] _ /.0.;.G.&.e.<.B.B.g.f.B.B.H.F.E.E.E.E.z.z.w.",
"* & A.A.* - A.D.D.$ % D.D.D.% ; D.D.I.* % % I.B.B.B.B.7 ].B.B.).[.B.B.g.g.B.B.J.H.B.B.B.B.B.E.z.",
"* * A.A.A.A.D.D.; & D.D.D.* - D.D.I.I.I.> * I.B.B.B.B.: d.B.B.&.).B.B.b.b.B.B.b.y.B.B.B.B.B.E.E.",
"% & A.A.A.A.D.> > - D.D.$ - D.D.D.* I.I.I.- - % B.B.B.' .B.B.*.r.B.B.6.J.B.B.b.b.h.y.K.B.B.K.K.",
"@ @ A.A.- - ; ; ; > D.D.$ @ D.D.& & - I.I.> + > B.B.+ ] ' B.B.G.L.B.B.6.w.B.B.b.b.B.B.B.B.B.K.K.",
"% % A.A.& * ; > > = D.D.& $ D.D.& * % I.I.; = I.B.- + ' ] B.B.~ M.B.B.[.6.B.B.y.B.B.b.b.B.B.h.h.",
"$ $ A.A.% @ % ; - = D.D.- > D.D.D.& I.I.I.* I.I.B.% ; = + B.B._ $.B.B.k.r.B.B.z.B.B.b.b.B.B.m.h.",
"> & A.A.* = > = , ; D.D.; > > D.D.D.I.I.@ - I.B.B.B.B.+ ] B.B.< : B.B.N.O.B.B.w.B.B.B.B.B.B.m.m.",
"$ $ A.A.$ # > - = % D.D.; * @ & D.I.I.s._ # I.B.B.B.B.+ = B.B.] ' B.B.t.L.B.B.w.z.B.B.B.B.B.m.m.",
"% % % - % % > * + + * > > = % % , , ] ! # $ * - * - ; , ] ] ] : ~ ~ |.&.n.r.w.y.z.z.y.y.h.m.",
"* % * - @ - ; > % ; ; - = * & ; = ' P. Q.$ - = > - * ; , , ] _ ./.~ ~ o.[.6.w.y.z.z.z.y.m."};

308
src/images/Pzdlwin.xpm Normal file
View File

@@ -0,0 +1,308 @@
/* XPM */
static char * Pzdlwin_xpm[] = {
"48 48 257 2",
" c None",
". c #000000",
"+ c #101010",
"@ c #181818",
"# c #212121",
"$ c #290000",
"% c #292118",
"& c #292121",
"* c #292929",
"= c #312929",
"- c #313129",
"; c #313131",
"> c #391000",
", c #392929",
"' c #393931",
") c #393939",
"! c #422110",
"~ c #423121",
"{ c #423131",
"] c #423939",
"^ c #424239",
"/ c #424242",
"( c #4A3129",
"_ c #4A3929",
": c #4A4A42",
"< c #4A4A4A",
"[ c #524231",
"} c #524239",
"| c #524242",
"1 c #524A42",
"2 c #52524A",
"3 c #525252",
"4 c #5A3931",
"5 c #5A4239",
"6 c #5A5A5A",
"7 c #635242",
"8 c #63635A",
"9 c #6B5242",
"0 c #6B5A52",
"a c #734221",
"b c #734239",
"c c #8C4A39",
"d c #845239",
"e c #7B5242",
"f c #7B634A",
"g c #846352",
"h c #84635A",
"i c #84735A",
"j c #906756",
"k c #635A63",
"l c #636363",
"m c #6B6363",
"n c #6B6B63",
"o c #736363",
"p c #9C7B63",
"q c #6B636B",
"r c #6B6B6B",
"s c #73736B",
"t c #8C6B6B",
"u c #736B73",
"v c #737373",
"w c #7B7B73",
"x c #8C7B73",
"y c #948473",
"z c #7B737B",
"A c #52738C",
"B c #527394",
"C c #5A7394",
"D c #5A7B94",
"E c #637394",
"F c #637B94",
"G c #637B9C",
"H c #67849C",
"I c #738C9C",
"J c #739494",
"K c #7B7B7B",
"L c #7B8C9C",
"M c #847B84",
"N c #84847B",
"O c #848484",
"P c #848C84",
"Q c #84948C",
"R c #849494",
"S c #8C848C",
"T c #8C8C84",
"U c #8C8C8C",
"V c #8C948C",
"W c #8C9494",
"X c #94847B",
"Y c #948C8C",
"Z c #948C94",
"` c #94948C",
" . c #949494",
".. c #949C94",
"+. c #9C8C84",
"@. c #9C9494",
"#. c #9C9C94",
"$. c #738CA5",
"%. c #73A5A5",
"&. c #7B949C",
"*. c #7B94A5",
"=. c #7BA5A5",
"-. c #7BA5AD",
";. c #8494A5",
">. c #8494AD",
",. c #849CA5",
"'. c #94989C",
"). c #84A5AD",
"!. c #84ADAD",
"~. c #94A5A5",
"{. c #9C949C",
"]. c #9C9C9C",
"^. c #9CA59C",
"/. c #739CBD",
"(. c #739CC6",
"_. c #7B9CBD",
":. c #84ADB5",
"<. c #94ADAD",
"[. c #8CA9B9",
"}. c #8CB5B5",
"|. c #94B1BD",
"1. c #7B9CC6",
"2. c #7FA5C6",
"3. c #8CA5C6",
"4. c #8CADC6",
"5. c #90ADCA",
"6. c #90B3E6",
"7. c #6FADFF",
"8. c #87B5F5",
"9. c #B58168",
"0. c #F79C41",
"a. c #F7A529",
"b. c #F99457",
"c. c #FF904E",
"d. c #FF9452",
"e. c #FF8C5A",
"f. c #FF995D",
"g. c #EFAD18",
"h. c #F1A736",
"i. c #F7A54A",
"j. c #F9A560",
"k. c #E2AD73",
"l. c #F3AB6D",
"m. c #F7AD73",
"n. c #F6D275",
"o. c #A59C8C",
"p. c #A2A49F",
"q. c #D2A990",
"r. c #D3AF9C",
"s. c #E7AD7B",
"t. c #E4AF86",
"u. c #DEAF96",
"v. c #DEBD9C",
"w. c #EFAD7B",
"x. c #EFB57F",
"y. c #EBB98C",
"z. c #E7BA96",
"A. c #F7D086",
"B. c #E9C899",
"C. c #FFE67F",
"D. c #F3E094",
"E. c #A59CA5",
"F. c #A5A5A5",
"G. c #ADA5A5",
"H. c #ADA5AD",
"I. c #A5ADA5",
"J. c #ADADA5",
"K. c #A5ADAD",
"L. c #ADADAD",
"M. c #A5B5A5",
"N. c #A5B5AD",
"O. c #9CB5B5",
"P. c #A0B9B9",
"Q. c #ADB5AD",
"R. c #ADB5B5",
"S. c #ADBDB5",
"T. c #B5ADB5",
"U. c #B5B5AD",
"V. c #B5B5B5",
"W. c #BDADB9",
"X. c #BDB5BD",
"Y. c #B5BDB5",
"Z. c #B9C1B1",
"`. c #BDBDB5",
" + c #BDBDBD",
".+ c #CBAFAA",
"++ c #C6B5B5",
"@+ c #D0B7AF",
"#+ c #D8BBA9",
"$+ c #BDC6BD",
"%+ c #D8CAAF",
"&+ c #E4D0A7",
"*+ c #E1DBAD",
"=+ c #9CB5C6",
"-+ c #9CBDC8",
";+ c #B2AFCB",
">+ c #ADC1CA",
",+ c #A5ADD6",
"'+ c #9FB2E1",
")+ c #A5C1E7",
"!+ c #AFBDDA",
"~+ c #BDB9C6",
"{+ c #C6BDBD",
"]+ c #C6BDC6",
"^+ c #BDC6C6",
"/+ c #BDBDCE",
"(+ c #BDC6CE",
"_+ c #B5C6D6",
":+ c #B5C6DE",
"<+ c #9CCED6",
"[+ c #9CD6DE",
"}+ c #A5D6DE",
"|+ c #A5D6E7",
"1+ c #A5DEDE",
"2+ c #A5DEE7",
"3+ c #ADCEDE",
"4+ c #ADDEDE",
"5+ c #B5CECE",
"6+ c #BDCECE",
"7+ c #B5CED6",
"8+ c #B5D6D6",
"9+ c #ADDEE7",
"0+ c #BDCED6",
"a+ c #B5CEDE",
"b+ c #B9DEE2",
"c+ c #C6C6BD",
"d+ c #C6C6C6",
"e+ c #C6CEC1",
"f+ c #CECABD",
"g+ c #C6C6CE",
"h+ c #C6CECE",
"i+ c #CECACA",
"j+ c #CECECE",
"k+ c #CAD6CA",
"l+ c #CED6CE",
"m+ c #CEDEC6",
"n+ c #C6D6D6",
"o+ c #D6D3C5",
"p+ c #D6D6CE",
"q+ c #D6E7BD",
"r+ c #E1E6C8",
"s+ c #CEDEDE",
"t+ c #D6D6D6",
"u+ c #D6E2D6",
"v+ c #DEE1D8",
"w+ c #C6E7DE",
"x+ c #D4E9E6",
"y+ c #DEE7DE",
"z+ c #DBF1E9",
"A+ c #E7E7D6",
"B+ c #E7E7DE",
"C+ c #E7EFD6",
"D+ c #E7F3DE",
"E+ c #E7EBE7",
"F+ c #EFEFE2",
"G+ c #DEF9F7",
"H+ c #F3F7E7",
"T T T T P 6 # # @ @ @ * ) @ * ; ; # ) / / l ) q r r / ) 3 6 v r r O U U T T T T T T T T T T T U ",
"T T e.e.e.e.f.@ . . @ * ) @ @ # ) # ) ) * q l Z U .l k / n.n./ 6 C.C.U O C.C.T T T T T T T T T ",
"T T e.e.e.b.f.f.. . @ @ < @ ; ) / ) / ) l Z L ;.Z U Z U q A.A./ 6 A.C.v K D.C.T T T T U T T T T ",
"T 8 c.d.. @ f.f.j.@ @ @ / @ @ ) ; * / 6 q Z l l L ,.Z .Z .q k / D.D.l r D.D.P U T T T T T T T ",
"s @ c.d.@ @ @ j.j.# ) # # # ) < ) ) ) / q U ; r r u I L Z Z {.U l B.&+) < &+*+l T T T T T T T T ",
"@ . c.d.@ @ j.j.j.# * l.l.m.; 6 x.x.x.< l .y.y.z.B.B.l ;.B.B.l ) &+&+# / *+*+K K *+*+q+q+q+T T ",
"@ @ 0.0.i.b.j.j.@ @ l.l.l.) ) s.x.t.t.y.q Z z.z.v.v.v.l Z v.%+k . %+%+r v %+f+O K o+m+m+m+m+T T ",
"@ @ 0.0.i.i.j.@ # * l.l.* @ s.t.t.) t.z.z.Z l ;.v.v.#+l Z #+%+r < f+f+O .f+e+K K l O T h+6+T T ",
". @ h.0.@ # @ @ @ * k.k.* ; t.t.) ; / u.u.Z ) r #+#+E l ].@+{+m ] c+c+3 l ^+(+O U (+_+7+7+a+T T ",
"@ @ h.h.@ # @ . @ < k.s.; * t.t.; # # r.r.U k @+@+H L u E.{+{+o 9 ~+/+( { _+_+O !+!+v < )+)+N P ",
"@ @ a.h.# @ * @ @ # k.k.; * t.u.u.; r.r.r.U .+.+++F L r @.~+~++.i ;+!+{+4 !+!+l )+)+U K 6.6.l r ",
"@ # g.h.# ; ) # # @ k.k./ ) ) q.r.r.r..+@ l .+++W.W.X.l @.;+;++.1 ,+,+y ! '+'+, 6.6.8.8.8.8.O r ",
"; * g.h.# / * * # * k.k./ < < ) r.r..+6 / * W.W.W.W.;+q Y ;+,+X 7 '+'+~ 9 6.6.$ | 8.8.7.7.7.K K ",
"; # . . * @ @ @ * ) ) / ; < 3 6 6 < < l < < < / ; l J ;.U Y t x [ _ 5 f p q.9.a > , ) / l 6 K N ",
") # @ . * * @ ; * / @ @ ) / 3 < < < l r < < < l 6 3 ) v u l % 5 e j g y r.9.j c 0 } ) * / r N T ",
"* @ @ @ * # # # ; * / # ) < l 6 / < < < < < < 6 / / / / ) # # @ - 5 h j j d b & ) 6 / < v K r O ",
"@ @ @ @ # # * @ * # < / l < < 3 / < l < / ) 6 r ; < / < u ) ) ) # @ @ = * * # # 6 * ) / / r 6 6 ",
"@ @ @ @ * # * # @ # ; ) ) 6 < 3 ) 6 < r ) < 6 l ) r / 6 r ) 6 < / < ) * ) ) ) ) < 6 / 6 r l 6 6 ",
"@ @ @ @ ) @ * ) @ ) # # * * # 6 ; < 6 r / ) 6 r / 6 < r v ) 6 < 6 3 6 / 6 r < 6 r 3 l < r l 3 l ",
"@ . # @ @ ) # # @ @ # # / / / < < 6 r l 6 6 l < ) 6 ; 3 u * < < l ) l ) / < / < l ) 6 / 3 < * ) ",
"# @ # ; ) # 6 * ; k k q q l q l l l q v r r v z v r r :.H F v u z r v v z q l u v u r l v l / * ",
"@ @ @ @ # # ) # k @ @ . ) / / ) # # ) 6 6 6 r l 6 l 3 |.|.$.6 3 6 / ) ; < / ) / / * ) ) q l ) / ",
"; ) * * ; ; / @ k # * ) * 6 3 / ; 3 l v K O ].L.].].F.v v r r U U O K K r 6 / l l / < l / l ) < ",
"; @ * # ; * * ; k @ * # / 6 6 6 * 3 r K O ` ].F.U.h+d+h+s+^+L.R.V.F.].F.F.U O 6 r < 3 r ) 6 6 r ",
"* ) @ ; * @ / # k . ) * ) 6 / / l < K O #.].F.U.c+i+p+p+t+V.I.6+G+6+p.L.R.F.L. .O l / u * ) < 3 ",
"@ # # ) ) * # ; k @ # ) ) < / < 6 l r .Q.U.`.c+o+p+v+v+u+j+c+e+s+I.` ^+z+n+ +V.V.]. .U 6 l v < ",
". k k =.=.-.l k k . ) ) ) / / v q !.}.-+K.F.J.U.U.U.U.`.w+w+b+Q.J.p. .F.N.'.-+-+7+]. . .l 6 l r ",
". @ # C =.C # . # * # / 3 ) < / ) H }.>.U V ` #.^.#.^.p.5+w+_+I.p.#.T w n l *.-+3+~.Q O O ].O v ",
"@ # * ; l * @ @ ; # / < ) 6 < 3 3 < v l K V.c+p+A+A+r+C+D+`.J.J.F+B+p+c+U.^.` W O.<.K.^.h+V.V. .",
"@ / / * l ; @ * # # * < ) ) / v 6 ) u 6 ].V.c+l+v+A+C+C+C+Y.I.H+H+F+B+p+d+Y.L.'.Q ..T K.G+x+d+F.",
"* ) / ; l ; @ # * ; < / l / # / / < r < U L.d+y+u+y+B+y+y+Y.I.D+F+H+F+B+t+j+d+].K U.F.R.x+K.F.V.",
") ) # * k * @ # @ @ * * * * * 6 ) / q 6 K .F.$+k+u+y+y+u+Y.p.D+D+D+F+F+E+v+v+F.O j+j+t+ +....w+",
"Z Z U Z Z Z U U U U ; 6 ; U Z .Z . .{.E.E.L.V.$+u+d+d+d+h+j+j+j+j+l+j+j+i+i+d+d+d+d+d+d+j+d+G+",
"U l k k k l k k k U l ) ) U l l k l q v K K F.].n+G+d+p.F.I.J.J.J.J.I.i+].].{. . . . .{.d+{.t+z+",
"Z q =.-.-.-.=.=.%.U %.k ) U q :.%.).=.-.!.:.E.|.].z+ +'.|.|.=+=+=+=+4+d+4+U 4+}+1.1.2.2.]+4+ .i+",
"Z l %.=.-.).=.=.=.Z ; # ; Z r -.-.!.).).!.:.H.l v W +Y [.[.|.5.4.3.4+]+/ ^ ' }+/././.1.]+< 3 l ",
"U k k k k -.=.k k l -.U # Z q l q l =.).l q K }.F.v V.U 4.5.3.3.2.2.O O }+ +& M /././././.1.]+3 ",
" .l -.).).).-.).%.%.-.U * Z r =.=.!.:.-.-.).}.|.E.r +F.5.4.2.2.1.1.}+}+}+X.@ [+/./././././.]+: ",
"Z k k l -.q q r -.k l U @ Z l q k =.r q l -.l v E.< T.U 4.2._._././.}+M M X.@ [+/./././././. +) ",
"Z l =.=.-.-.).!.).=.%.U . Z q =.-.).).).!.-.).).E.< L.O _._._./././.[+[+[+X.@ [+/./././././.X.- ",
"Z C C C F C C r r q k U . Z k %.k q A F F F F F {.) T.K <+M M M }+M M M M X.@ M M [+M K M M X.& ",
"U A C C F F F ).).).%.U . U r %.=.=.F C C H H H {.@ T.K <+[+[+}+}+[+[+[+[+X.@ [+[+[+[+[+[+[+X.& ",
"Z C C F C C F ).u :.l U # U k k l l C C C F H G E.* T.K K M M [+M [+M [+M X.@ M [+M [+M [+M X.* ",
"U A C C C C C ).).!.).Z ; .k %.=.=.A A F C F H E.# L.z <+[+[+[+[+[+[+[+[+X.@ [+[+[+[+[+[+[+X.& ",
"{.C F F C H F !.z ).v {.) .r l u -.F A A F F G E.; T.z K K [+K M [+M [+M X.@ [+M M [+M [+M +- ",
"U A C C A A H -.!.=.-. .) Z k =.:.).I *.F A C D ].* H.z <+<+[+[+[+[+[+[+}+ +# }+}+}+}+}+}+}+{+^ ",
"Z Z Z .Z Z .Z {.].Z {./ {.Z Z ].].p.F.F.{.U Z {.* F.H.T.T.X.X.X.X.X.X.X.X.; + +]+]+]+]+]+]+2 ",
"; * ; ; @ ; ) / * ) ) ; / ; # ) / 6 r l l l / . ; / ; * # * ; ; * ; ) / / / / : < < 2 3 3 6 l n "};

25
src/images/pause.xpm Normal file
View File

@@ -0,0 +1,25 @@
/* XPM */
static char * pause_xpm[] = {
"34 17 5 1",
" c None",
". c #EEF2EE",
"+ c #CDCECD",
"@ c #626562",
"# c #000000",
".++++++++++++++++++++++++++++++++@",
".++++++++++++++++++++++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++##+++##+++++++++++++@",
".++++++++++++++++++++++++++++++++@",
".++++++++++++++++++++++++++++++++@"};

27
src/images/play.xpm Normal file
View File

@@ -0,0 +1,27 @@
/* XPM */
static char * play_xpm[] = {
"44 20 4 1",
" c None",
". c #EEF2EE",
"+ c #CDCECD",
"@ c #000000",
"............................................",
".+++++++++++++++++++++++++++++++++++++++++++",
".+++++++++++++++++++++++++++++++++++++++++++",
".+++++++++++++++++++++++++++++++++++++++++++",
".+++++++++++++++++++@@@+++++++++++++++++++++",
".+++++++++++++++++++@@@@++++++++++++++++++++",
".+++++++++++++++++++@@@@@+++++++++++++++++++",
".+++++++++++++++++++@@+@@@++++++++++++++++++",
".+++++++++++++++++++@@++@@@+++++++++++++++++",
".+++++++++++++++++++@@+++@@@++++++++++++++++",
".+++++++++++++++++++@@++++@@@+++++++++++++++",
".+++++++++++++++++++@@+++@@@++++++++++++++++",
".+++++++++++++++++++@@++@@@+++++++++++++++++",
".+++++++++++++++++++@@+@@@++++++++++++++++++",
".+++++++++++++++++++@@@@@+++++++++++++++++++",
".+++++++++++++++++++@@@@++++++++++++++++++++",
".+++++++++++++++++++@@@+++++++++++++++++++++",
".+++++++++++++++++++++++++++++++++++++++++++",
".+++++++++++++++++++++++++++++++++++++++++++",
".+++++++++++++++++++++++++++++++++++++++++++"};

37
src/index.html Normal file
View File

@@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test Page for Apache Installation</title>
</head>
<body>
<p>If you can see this, it means that the installation of the <a
href="http://www.apache.org/foundation/preFAQ.html">Apache web server</a>
software on this system was successful. You may now add content to this
directory and replace this page.</p>
<hr style="width: 100%; height: 3px;" />
<h2 style="text-align: center">Seeing this instead of the website you expected?</h2>
<p>This page is here because the site administrator has changed the
configuration of this web server. Please <strong>contact the person
responsible for maintaining this server with questions.</strong>
The Apache Software Foundation, which wrote the web server software
this site administrator is using, has nothing to do with
maintaining this site and cannot help resolve configuration
issues.</p>
<hr style="width: 100%; height: 3px;" />
<p>The Apache documentation is available
<a href="http://httpd.apache.org/docs-2.0/">online</a> or has been installed
<a href="/manual/">locally</a>.</p>
<p>You are free to use the image below on an Apache-powered web
server. Thanks for using Apache!</p>
<div style="text-align: center"><img src="apache_pb.gif" alt="" /></div>
</body>
</html>

226
src/init.cpp Normal file
View File

@@ -0,0 +1,226 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /*
* HAVE_CONFIG_H
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <limits.h>
#include "prozilla.h"
#include "main.h"
#include "init.h"
extern struct runtime rt;
/* Sets the default config */
void set_defaults()
{
struct stat st;
char cwd[PATH_MAX];
/*
* Zero the structure which holds the config data
*/
memset(&rt, 0, sizeof(rt));
if (getcwd(cwd, sizeof(cwd)) == NULL)
{
proz_debug("Failed to get the current working directory");
strcpy(cwd, ".");
}
if (rt.home_dir != 0)
free(rt.home_dir);
rt.home_dir = strdup(libprozrtinfo.home_dir);
/*TODO what to do if the homedir is NULL */
if (rt.config_dir != 0)
free(rt.config_dir);
rt.config_dir = (char *) malloc(PATH_MAX);
snprintf(rt.config_dir, PATH_MAX, "%s/%s", rt.home_dir, PRZCONFDIR);
/* Make the ~/.prozilla directory if necessary */
if (stat(rt.config_dir, &st) == -1)
{
/*error has hapenned */
if (errno == ENOENT)
{
/*Create the dir then */
if (mkdir(rt.config_dir, S_IRWXU) != 0)
{
perror
(_("unable to create the directory to store the config info in"));
exit(0);
}
} else
perror(_("Error while stating the config info directory"));
}
/*Output the file to the directory , cwd by default */
if (rt.output_dir != 0)
free(rt.output_dir);
rt.output_dir = strdup(cwd);
if (rt.dl_dir != 0)
free(rt.dl_dir);
rt.dl_dir = strdup(cwd);
if (rt.logfile_dir != 0)
free(rt.logfile_dir);
rt.logfile_dir = strdup(rt.config_dir);
/*
* The default no of connections and maximum redirections allowed
*/
rt.num_connections = 4;
rt.max_redirections = 10;
/* Uses PASV by default
*/
rt.ftp_use_pasv = libprozrtinfo.ftp_use_pasv;
/*
* The force option, off by default when enabled
* cause Prozilla not to prompt the user about overwriting existent
* files etc..
*/
rt.force_mode = FALSE;
/*
* .netrc options
*/
rt.use_netrc = TRUE;
/*
* The max number of trys and the delay between each
*/
rt.max_attempts = 0; /*TODO it is currently UNLIMITED */
rt.retry_delay = 15; /*
* delay in seconds
*/
/*Default is to not log any debug info */
rt.debug_mode = FALSE;
rt.quiet_mode = TRUE;
rt.libdebug_mode = TRUE;
rt.ftp_search = FALSE;
rt.min_search_size=128;
rt.max_simul_pings = 5;
rt.max_ping_wait = 8;
rt.ftps_mirror_req_n = 40;
rt.max_bps_per_dl = 0; /* 0= No throttling */
if (rt.http_proxy != 0)
free(rt.http_proxy);
rt.http_proxy = (proxy_info *) malloc(sizeof(proxy_info));
rt.http_proxy->username = strdup("");
rt.http_proxy->passwd = strdup("");
rt.http_proxy->type = HTTPPROXY;
proz_parse_url("localhost:3128", &rt.http_proxy->proxy_url, 0);
rt.use_http_proxy = FALSE;
if (rt.ftp_proxy != 0)
free(rt.ftp_proxy);
rt.ftp_proxy = (proxy_info *) malloc(sizeof(proxy_info));
rt.ftp_proxy->username = strdup("");
rt.ftp_proxy->passwd = strdup("");
rt.ftp_proxy->type = HTTPPROXY;
proz_parse_url("localhost:3128", &rt.ftp_proxy->proxy_url, 0);
rt.use_ftp_proxy = FALSE;
rt.http_no_cache = FALSE;
rt.timeout.tv_sec = 90;
rt.timeout.tv_usec = 0;
//rt.use_ftpsearch=FALSE;
rt.ftpsearch_server_id = 1;
/*Set the values necessary for libprozilla */
rt.display_mode = DISP_CURSES;
set_runtime_values();
}
/*This sets the runtime values to libprozilla from the runtime structure */
void set_runtime_values()
{
struct timeval tv;
proz_set_connection_timeout(&rt.timeout);
tv.tv_sec = rt.retry_delay;
tv.tv_usec = 0;
proz_set_connection_retry_delay(&tv);
libprozrtinfo.ftp_use_pasv = rt.ftp_use_pasv;
libprozrtinfo.http_no_cache = rt.http_no_cache;
proz_set_output_dir(rt.output_dir);
/*FIXME */
proz_set_download_dir(rt.output_dir);
proz_set_logfile_dir(rt.logfile_dir);
proz_set_http_proxy(rt.http_proxy);
proz_use_http_proxy(rt.use_http_proxy);
proz_set_ftp_proxy(rt.ftp_proxy);
proz_use_ftp_proxy(rt.use_ftp_proxy);
libprozrtinfo.max_bps_per_dl = rt.max_bps_per_dl;
libprozrtinfo.debug_mode = rt.libdebug_mode;
libprozrtinfo.max_attempts = rt.max_attempts;
}
void cleanuprt()
{
if (rt.config_dir != 0)
free(rt.config_dir);
if (rt.http_proxy != 0)
free(rt.http_proxy);
if (rt.ftp_proxy != 0)
free(rt.ftp_proxy);
if (rt.home_dir != 0)
free(rt.home_dir);
if (rt.output_dir != 0)
free(rt.output_dir);
if (rt.dl_dir != 0)
free(rt.dl_dir);
if (rt.logfile_dir != 0)
free(rt.logfile_dir);
}

28
src/init.h Normal file
View File

@@ -0,0 +1,28 @@
/* Declarations for initialising runtime variables
Copyright (C) 2000 Kalum Somaratna
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. */
#ifndef INIT_H
#define INIT_H
/*Initialises the default runtime values */
void set_defaults();
void set_runtime_values();
void cleanuprt();
#endif

365
src/interface.c Normal file
View File

@@ -0,0 +1,365 @@
/* The file contins routines for managing curses
Copyright (C) 2000 Kalum Somaratna
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. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /*
* HAVE_CONFIG_H
*/
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif /*
* HAVE_CURSES
*/
#include <ctype.h>
#include <assert.h>
#include <errno.h>
#include "interface.h"
#include "misc.h"
#include "main.h"
//#include "ftpsearch_win.h"
/* This is used to convert the connection.status enums to a user
* friendly text message */
/* the enums are defined in connection.h and are as belor
*typedef enum {
* IDLE = 0,
* CONNECTING,
* LOGGININ,
* DOWNLOADING,
* COMPLETED,
* LOGINFAIL,
* CONREJECTED,
* REMOTEFATAL,
* LOCALFATAL
*} dl_status;
*
* And here are the texts for the above enums.
*/
const char *dl_status_txt[] = {
"Idle",
"Connecting",
"Logging in",
"Downloading",
"Completed",
/* I have decided to change the login failed message
* to something else like "login rejected" because people
* might get alarmed and abort the download rather than
* letting prozilla handle it */
"Login Denied",
"Connect Refused",
"Remote Fatal",
"Local Fatal",
"Timed Out",
"Max attempts reached",
};
#define CTRL(x) ((x) & 0x1F)
//static int top_con = 0; // the connection that is on the top of the display
#define MAX_CON_VIEWS 4
/*
* needed for the message(...) function
*/
pthread_mutex_t curses_msg_mutex = PTHREAD_MUTEX_INITIALIZER;
char message_buffer[MAX_MSG_SIZE];
/* Added for current_dl_speed */
time_t time_stamp;
off_t bytes_got_last_time;
int start = 1;
float current_dl_speed = 0.0;
off_t total_bytes_got;
int maxRow = 0;
int maxCol = 0;
int messageRow = 0;
int messageCol = 0;
/* because of different args for different ncurses, I had to write these
* my self
*/
#define kwattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))),OK)
#define kwattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
/* Message: prints a message to the screen */
void curses_message(char *message)
{
short i;
int x, y;
attr_t attrs;
/*
* Lock the mutex
*/
pthread_mutex_lock(&curses_msg_mutex);
/*
* get the cursor position
*/
getyx(stdscr, y, x);
kwattr_get(stdscr, &attrs, &i, NULL);
move(messageRow-1, 0);
clrtoeol();
move(messageRow, 0);
clrtoeol();
move(messageRow+1, 0);
clrtoeol();
attrset(COLOR_PAIR(MSG_PAIR) | A_BOLD);
mvprintw(messageRow, 0, "%s", message);
attrset(COLOR_PAIR(NULL_PAIR));
/*
* Unlock the mutex
*/
refresh();
kwattr_set(stdscr, attrs, i, NULL);
/*
* set the cursor to whhere it was */
move(y, x);
pthread_mutex_unlock(&curses_msg_mutex);
}
/* Displays the mesasge and gets the users input for overwriting files*/
int curses_query_user_input(const char *args, ...)
{
char p[MAX_MSG_SIZE+1];
va_list vp;
attr_t attrs;
int x, y;
int ch;
int i;
va_start(vp, args);
vsnprintf(p,sizeof(p) , args, vp);
va_end(vp);
getyx(stdscr, y, x);
kwattr_get(stdscr, &attrs, &i, NULL);
attrset(COLOR_PAIR(PROMPT_PAIR) | A_BOLD);
move(19, 0);
clrtoeol();
move(20, 0);
clrtoeol();
move(21, 0);
clrtoeol();
mvprintw(19, 0, "%s", p);
echo();
refresh();
do
{
napms(20);
ch = getch();
}
while (ch == ERR);
refresh();
noecho();
kwattr_set(stdscr, attrs, i, NULL);
/*
* set the cursor to where it was
*/
move(y, x);
/*
* the following strange line is for compatibility
*/
return islower(ch) ? toupper(ch) : ch;
}
void initCurses()
{
initscr();
keypad(stdscr, TRUE);
start_color();
noecho();
nodelay(stdscr, TRUE);
init_pair(HIGHLIGHT_PAIR, COLOR_GREEN, COLOR_BLACK);
init_pair(MSG_PAIR, COLOR_YELLOW, COLOR_BLUE);
init_pair(WARN_PAIR, COLOR_RED, COLOR_BLACK);
init_pair(PROMPT_PAIR, COLOR_RED, COLOR_BLACK);
init_pair(SELECTED_PAIR, COLOR_WHITE, COLOR_BLUE);
getmaxyx(stdscr,maxRow,maxCol);
messageRow = maxRow - 2;
messageCol = 1;
}
void shutdownCurses()
{
endwin();
}
void PrintMessage(const char *format, ...)
{
va_list args;
char message[MAX_MSG_SIZE + 1 + 1];
va_start(args, format);
vsnprintf((char *) &message, MAX_MSG_SIZE, format, args);
va_end(args);
if (rt.display_mode == DISP_CURSES)
{
curses_message(message);
}
else
{
if (fwrite(message, 1, strlen(message), stdout) != strlen(message))
{
return;
}
}
delay_ms(500);
}
void DisplayInfo(int row, int col, const char *format, ...)
{
va_list args;
char message[MAX_MSG_SIZE + 1 + 1];
va_start(args, format);
vsnprintf((char *) &message, MAX_MSG_SIZE, format, args);
va_end(args);
if (rt.display_mode == DISP_CURSES)
{
attrset(COLOR_PAIR(NULL_PAIR) | A_BOLD);
mvaddstr(row,col, message);
attrset(COLOR_PAIR(NULL_PAIR));
refresh();
}
else
{
if (fwrite(message, 1, strlen(message), stdout) != strlen(message))
{
return;
}
}
// delay_ms(300);
}
void DisplayCursesInfo(download_t * download )
{
char buf[1000];
int i = 0;
int line = 1;
int secs_left;
// erase();
refresh();
attrset(COLOR_PAIR(HIGHLIGHT_PAIR) | A_BOLD);
snprintf(buf, sizeof(buf), _("Connection Server Status Received"));
mvprintw(line++,1, buf);
attrset(COLOR_PAIR(NULL_PAIR));
total_bytes_got = proz_download_get_total_bytes_got(download) / 1024;
if (start == 1)
{
time_stamp = time(NULL);
bytes_got_last_time = total_bytes_got;
start = 0;
}
if (time_stamp + 1 == time(NULL))
{
current_dl_speed = total_bytes_got - bytes_got_last_time;
time_stamp = time(NULL);
bytes_got_last_time = total_bytes_got;
}
for (i = 0; i < download->num_connections; i++)
{
snprintf(buf,sizeof(buf), _(" %2d %-25.25s %-15.15s %10.1fK of %.1fK"), i + 1,
download->pconnections[i]->u.host,
proz_connection_get_status_string(download->pconnections[i]),
(float)proz_connection_get_total_bytes_got(download->
pconnections[i])/1024,
((float)download->pconnections[i]->main_file_size / 1024) / download->num_connections);
mvprintw(line++,1, buf);
}
line = line + 2;
attrset(COLOR_PAIR(HIGHLIGHT_PAIR) | A_BOLD);
mvprintw(line++, 1, "%s", download->u.url);
line++;
attrset(COLOR_PAIR(HIGHLIGHT_PAIR));
if (download->main_file_size > 0)
mvprintw(line++,1,_("File Size = %lldK"),download->main_file_size / 1024);
else
mvprintw(line++,1,_("File Size = UNKNOWN"));
snprintf(buf,sizeof(buf), _("Total Bytes received %lld Kb (%.2f%%)"),
total_bytes_got,
(((float)total_bytes_got * 100) / ((float)download->main_file_size / 1024)));
line++;
mvprintw(line++,1, buf);
snprintf(buf,sizeof(buf),_("Current speed = %1.2fKb/s, Average D/L speed = %1.2fKb/s"),
current_dl_speed , proz_download_get_average_speed(download) / 1024);
mvprintw(line++,1, buf);
clrtoeol();
if ((secs_left = proz_download_get_est_time_left(download)) != -1)
{
if (secs_left < 60)
snprintf(buf,sizeof(buf), _("Time Remaining %d Seconds"), secs_left);
else if (secs_left < 3600)
snprintf(buf,sizeof(buf), _("Time Remaining %d Minutes %d Seconds"), secs_left / 60,
secs_left % 60);
else
snprintf(buf,sizeof(buf), _("Time Remaining %d Hours %d minutes"), secs_left / 3600,
(secs_left % 3600) / 60);
mvprintw(line++,1, buf);
clrtoeol();
line++;
attrset(COLOR_PAIR(HIGHLIGHT_PAIR) | A_BOLD);
if (download->resume_support)
mvprintw(line++,1,_("Resume Supported"));
else
mvprintw(line++,1,_("Resume NOT Supported"));
}
attrset(COLOR_PAIR(NULL_PAIR));
refresh();
}

54
src/interface.h Normal file
View File

@@ -0,0 +1,54 @@
/* Declarations for the interface
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. */
#ifndef INTERFACE_H
#include "prozilla.h"
//#include "connection.h"
//#include "ftpsearch_win.h"
#ifdef __cplusplus
extern "C" {
#endif
/*definnitions about the ncurse colors that the app will use*/
enum {
NULL_PAIR = 0,
HIGHLIGHT_PAIR,
MSG_PAIR,
WARN_PAIR,
PROMPT_PAIR,
SELECTED_PAIR
};
void initCurses();
void shutdownCurses();
void DisplayCursesInfo(download_t * download);
void curses_message(char *msg);
/* Displays the mesasge and gets the users input for overwriting files*/
int curses_query_user_input(const char *args, ...);
void PrintMessage(const char *format, ...);
void DisplayInfo(int row, int col, const char *format, ...);
#ifdef __cplusplus
}
#endif
#define INTERFACE_H
#endif

537
src/main.cpp Normal file
View File

@@ -0,0 +1,537 @@
/******************************************************************************
prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#if HAVE_CONFIG_H
# include <config.h>
#endif
//#include <malloc.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#include <unistd.h>
#include <getopt.h>
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif
#include "prozilla.h"
#include "misc.h"
#include "download_win.h"
#include "main.h"
#include "init.h"
#include "prefs.h"
#include "interface.h"
struct runtime rt;
// structure for options parsing,
struct option long_opts[] = {
/*
* { name has_arg *flag val }
*/
{"resume", no_argument, NULL, 'r'},
/* {"connections", required_argument, NULL, 'c'},*/
{"license", no_argument, NULL, 'L'},
{"help", no_argument, NULL, 'h'},
{"gtk", no_argument, NULL, 'g'},
{"no-netrc", no_argument, NULL, 'n'},
{"tries", required_argument, NULL, 't'},
{"force", no_argument, NULL, 'f'},
{"version", no_argument, NULL, 'v'},
{"directory-prefix", required_argument, NULL, 'P'},
{"use-port", no_argument, NULL, 129},
{"retry-delay", required_argument, NULL, 130},
{"timeout", required_argument, NULL, 131},
{"no-getch", no_argument, NULL, 132},
{"debug", no_argument, NULL, 133},
{"ftpsearch", no_argument, NULL, 's'},
{"no-search", no_argument, NULL, 135},
{"pt", required_argument, NULL, 136},
{"pao", required_argument, NULL, 137},
{"max-ftps-servers", required_argument, NULL, 138},
{"max-bps", required_argument, NULL, 139},
{"verbose", no_argument, NULL, 'v'},
{"no-curses", no_argument, NULL, 140},
{"min-size",required_argument,NULL,141},
{"ftpsid", required_argument, NULL,142},
{0, 0, 0, 0}
};
int open_new_dl_win (urlinfo * url_data, boolean ftpsearch);
DL_Window *dl_win = NULL;
extern int optind;
extern int opterr;
extern int nextchar;
/* displays the software license */
void
license (void)
{
fprintf (stderr,
" Copyright (C) 2000 Kalum Somaratna\n"
"\n"
" This program is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 2, or (at your option)\n"
" any later version.\n"
"\n"
" This program is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n"
"\n"
" You should have received a copy of the GNU General Public License\n"
" along with this program; if not, write to the Free Software\n"
" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n");
}
/* displays the help message */
void
help (void)
{
fprintf (stderr,
"Usage: proz [OPTIONS] file_url\n"
"\n"
"Ex: proz http://gnu.org/gnu.jpg\n"
"\n"
"Options:\n"
" -h, --help Give this help\n"
" -r, --resume Resume an interrupted download\n"
" -f, --force Never prompt the user when overwriting files\n"
" -1 Force a single connection only\n"
" -n, --no-netrc Don't use .netrc, get the user/password\n"
" from the command line,otherwise use the\n"
" anonymous login for FTP sessions\n"
" --no-getch Instead of waiting for the user pressing a key,\n"
" print the error to stdout and quit\n"
" --debug Log debugging info to a file (default is debug.log)\n"
" -v,--verbose Increase the amount of information sent to stdout\n"
" --no-curses Don't use Curses, plain text to stdout\n"
"\n"
"Directories:\n"
" -P, --directory-prefix=DIR save the generated file to DIR/\n"
"\n"
"FTP Options:\n"
" --use-port Force usage of PORT insted of PASV (default)\n"
" for ftp transactions\n"
"\n"
"Download Options:\n"
" -s, --ftpsearch Do a ftpsearch for faster mirrors\n"
" --no-search Do a direct download (no ftpsearch)\n"
" -k=n Use n connections instead of the default(4)\n"
" --timeout=n Set the timeout for connections to n seconds\n"
" (default 180)\n"
" -t, --tries=n Set number of attempts to n (default(200), 0=unlimited)\n"
" --retry-delay=n Set the time between retrys to n seconds\n"
" (default 15 seconds)\n"
" --max-bps=n Limit bandwith consumed to n bps (0=unlimited)\n"
"\n"
"FTP Search Options:\n"
" --pt=n Wait 2*n seconds for a server response (default 2*4)\n"
" --pao=n Ping n servers at once(default 5 servers at once)\n"
" --max-ftps-servers=n Request a max of n servers from ftpsearch (default 40)\n"
" --min-size=n If a file is smaller than 'n'Kb, don't search, just download it\n"
" --ftpsid=n The ftpsearch server to use\n"
" (0=filesearching.com\n"
" 1=ftpsearch.elmundo.es\n"
"\n"
"Information Options:\n"
" -L, --license Display software license\n"
" -V, --version Display version number\n"
"\n"
"ProZilla homepage: http://prozilla.genesys.ro\n"
"Please report bugs to <prozilla@genesys.ro>\n");
}
/* Displays the version */
void
version (void)
{
fprintf (stderr, _("%s. Version: %s\n"), PACKAGE_NAME, VERSION);
}
void
ms (const char *msg, void *cb_data)
{
PrintMessage("%s\n",msg);
}
int
open_new_dl_win (urlinfo * url_data, boolean ftpsearch)
{
dl_win = new DL_Window (url_data);
dl_win->dl_start (rt.num_connections, ftpsearch);
proz_debug ("calling the callback function...");
//need a timer here...
while (dl_win->status != DL_DONE && dl_win->status != DL_IDLING && dl_win->status != DL_ABORTED)
{
delay_ms (700); //wait before checking the status again...
dl_win->my_cb ();
}
return((dl_win->status==DL_DONE) ? 1:-1);
// delete (dl_win);
}
int
main (int argc, char **argv)
{
int c;
int ret;
proz_init (argc, argv); //init libprozilla
set_defaults (); //set some reasonable defaults
load_prefs (); //load values from the config file
while ((c =
getopt_long (argc, argv, "?hvrfk:1Lt:VgsP:", long_opts,
NULL)) != EOF)
{
switch (c)
{
case 'L':
license ();
exit (0);
case 'h':
help ();
exit (0);
case 'V':
version ();
exit (0);
case 'r':
rt.resume_mode = RESUME;
break;
case 'f':
rt.force_mode = TRUE;
break;
case 'k':
if (setargval (optarg, &rt.num_connections) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the -k option\n" "Please type proz --help for help\n"));
exit (0);
}
if (rt.num_connections == 0)
{
printf (_("Hey! How can I download anything with 0 (Zero)" " connections!?\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 't':
if (setargval (optarg, &rt.max_attempts) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the -t or --tries option(s)\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 'n':
/*
* Don't use ~/.netrc"
*/
rt.use_netrc = FALSE;
break;
case 'P':
/*
* Save the downloaded file to DIR
*/
rt.output_dir = kstrdup (optarg);
break;
case '?':
help ();
exit (0);
break;
case '1':
rt.num_connections = 1;
break;
case 'g':
/*
* TODO solve this soon
*/
printf ("Error: GTK interface is not supported in "
"the development version currently\n");
exit (0);
break;
case 129:
/*
* lets use PORT as the default then
*/
rt.ftp_use_pasv = FALSE;
break;
case 130:
/*
* retry-delay option
*/
if (setargval (optarg, &rt.retry_delay) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --retry-delay option\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 131:
/*--timout option */
if (setargval (optarg, &rt.itimeout) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --timeout option\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 132:
/* --no-getch option */
rt.dont_prompt = TRUE;
break;
case 133:
/* --debug option */
rt.debug_mode = TRUE;
rt.libdebug_mode=TRUE;
break;
case 'v':
/* --verbose option */
rt.quiet_mode = FALSE;
break;
case 's':
/* --ftpsearch option */
rt.ftp_search = TRUE;
break;
case 135:
/* --no-search option */
rt.ftp_search = FALSE;
break;
case 136:
/* --pt option */
if (setargval (optarg, &rt.max_ping_wait) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --pt option\n" "Please type proz --help for help\n"));
exit (0);
}
if (rt.max_ping_wait == 0)
{
printf (_("Hey! Does waiting for a server response for Zero(0)" " seconds make and sense to you!?\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 137:
/* --pao option */
if (setargval (optarg, &rt.max_simul_pings) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --pao option\n" "Please type proz --help for help\n"));
exit (0);
}
if (rt.max_simul_pings == 0)
{
printf (_("Hey you! Will pinging Zero(0) servers at once" " achive anything for me!?\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 138:
/* --max-ftp-servers option */
if (setargval (optarg, &rt.ftps_mirror_req_n) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --pao option\n" "Please type proz --help for help\n"));
exit (0);
}
if (rt.ftps_mirror_req_n == 0)
{
printf (_("Hey! Will requesting Zero(0) servers at once" "from the ftpearch achive anything!?\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 139:
/* --max-bps */
if (setlongargval (optarg, &rt.max_bps_per_dl) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --max-bps option\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 140:
rt.display_mode = DISP_STDOUT;
break;
case 141:
/* --min-size */
if (setlongargval (optarg, &rt.min_search_size) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --min-size option\n" "Please type proz --help for help\n"));
exit (0);
}
break;
case 142:
/* --ftpsid */
if (setargval (optarg, &rt.ftpsearch_server_id) != 1)
{
/*
* The call failed due to a invalid arg
*/
printf (_("Error: Invalid arguments for the --ftpsid option\n" "Please type proz --help for help\n"));
exit (0);
}
if (rt.ftpsearch_server_id < 0 || rt.ftpsearch_server_id >1)
{
printf (_("The available servers are (0) filesearching.com and (1) ftpsearch.elmundo.es\n" "Please type proz --help for help\n"));
exit (0);
}
break;
default:
printf (_("Error: Invalid option\n"));
exit (0);
}
}
set_runtime_values (); //tell libprozilla about any changed settings
if (optind == argc)
{
help ();
}
else
{
/* Gettext stuff */
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/*delete the ~/.prozilla/debug.log file if present at the start of each run */
proz_debug_delete_log ();
if (rt.display_mode == DISP_CURSES)
initCurses();
/* we will now see whether the user has specfied any urls in the command line and add them */
for (int i = optind; i < argc; i++)
{
uerr_t err;
urlinfo *url_data;
url_data = (urlinfo *) malloc (sizeof (urlinfo));
memset (url_data, 0, sizeof (urlinfo));
//parses and validates the command-line parm
err = proz_parse_url (argv[i], url_data, 0);
if (err != URLOK)
{
PrintMessage (_
("%s does not seem to be a valid URL"),
argv[optind]);
proz_debug
("%s does not seem to be a valid URL",
argv[optind]);
exit (0);
}
PrintMessage("Starting.....");
//In to %s\n",url_data->host);
// start the download
ret=open_new_dl_win (url_data, rt.ftp_search);
/*If the download failed the return -1 */
if(ret==-1)
{
free(url_data);
delete(dl_win);
shutdown();
return -1;
}
delete(dl_win);
free (url_data);
}
}
shutdown();
}
void shutdown(void)
{
cleanuprt ();
if (rt.display_mode == DISP_CURSES)
shutdownCurses();
proz_shutdown ();
}

84
src/main.h Normal file
View File

@@ -0,0 +1,84 @@
#ifndef MAIN_H
#define MAIN_H
#include <sys/time.h>
#include "prozilla.h"
/* Gettext */
#include <libintl.h>
//#define _(String) dgettext (PACKAGE,String)
#define gettext_noop(String) (String)
#ifndef HAVE_GNOME
#define N_(String) gettext_noop (String)
#endif
/* Gettext */
/*We will have a runtime structure for this program */
#define PRZCONFDIR ".prozilla"
typedef enum {
RESUME
} rto;
typedef enum {
DISP_CURSES,
DISP_STDOUT
} DISPLAYMODE;
struct runtime {
int num_connections;
int max_redirections;
/*
* whether to use the netrc file
*/
int use_netrc;
int ftp_use_pasv;
int max_attempts;
int retry_delay; /*delay in seconds */
/*
* The timeout period for the connections
*/
struct timeval timeout;
int itimeout;
int debug_mode;
int quiet_mode;
int libdebug_mode;
int ftp_search;
int force_mode;
/* The maximum number of servers to ping at once */
int max_simul_pings;
/* The max number of seconds to wait for a server response to ping */
int max_ping_wait;
/* The maximum number of servers/mirrors to request */
int ftps_mirror_req_n;
long max_bps_per_dl;
/* The dir to save the generated file in */
char *output_dir;
/*The directory where the Dl'ed portions are stored */
char *dl_dir;
char *logfile_dir;
char *home_dir;
/*The dir where the config files are stored */
char *config_dir;
proxy_info *ftp_proxy;
proxy_info *http_proxy;
int use_http_proxy;
int use_ftp_proxy;
int http_no_cache;
//int use_ftpsearch;
int ftpsearch_server_id;
//new options
int resume_mode; //
int dont_prompt; //don't prompt user, display message and die
int display_mode; //curses, bare terminal, others...
long min_search_size; //size in K
};
extern struct runtime rt;
void shutdown(void);
#endif

106
src/misc.cpp Normal file
View File

@@ -0,0 +1,106 @@
#include "interface.h"
#include "misc.h"
int is_number(char *str)
{
int i = 0;
while (str[i])
{
if (isdigit(str[i]) == 0)
{
return 0;
}
i++;
}
return 1;
}
/* TODO port these functions */
char *kstrdup(const char *s)
{
char *s1;
s1 = strdup(s);
if (!s1)
{
// die("Not enough memory to continue: strdup failed");
}
return s1;
}
/* Extracts a numurical argument from a option,
when it has been specified for example as -l=3 or, -l3
returns 1 on success or 0 on a error (non nemrical argument etc
*/
int setargval(char *optstr, int *num)
{
if (*optstr == '=')
{
if (is_number(optstr + 1) == 1)
{
*num = atoi(optstr + 1);
return 1;
} else
{
return 0;
}
} else
{
if (is_number(optstr) == 1)
{
*num = atoi(optstr);
return 1;
} else
{
return 0;
}
}
}
int setlongargval(char *optstr, long *num)
{
if (*optstr == '=')
{
if (is_number(optstr + 1) == 1)
{
*num = atol(optstr + 1);
return 1;
} else
{
return 0;
}
} else
{
if (is_number(optstr) == 1)
{
*num = atol(optstr);
return 1;
} else
{
return 0;
}
}
}
void delay_ms(int ms)
{
struct timeval tv_delay;
memset(&tv_delay, 0, sizeof(tv_delay));
tv_delay.tv_sec = ms / 1000;
tv_delay.tv_usec = (ms * 1000) % 1000000;
if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &tv_delay) < 0)
{
proz_debug("Warning Unable to delay\n");
}
}

18
src/misc.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef MISC_H
#define MISC_H
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
int is_number(char *);
char *kstrdup(const char *);
int setargval(char *, int *);
int setlongargval(char *, long *);
void delay_ms(int);
#endif

576
src/prefs.cpp Normal file
View File

@@ -0,0 +1,576 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <errno.h>
#include "prozilla.h"
#include "main.h"
#include "prefs.h"
typedef void (*prefproc) (int i, const char *const, FILE * const fp);
typedef struct prefopt_t {
const char *varname;
prefproc proc;
int visible;
} prefopt_t;
void set_num_threads(int, const char *const, FILE * const);
void set_max_attempts(int, const char *const, FILE * const);
void set_max_bps_per_dl(int, const char *const, FILE * const);
void set_use_pasv(int, const char *const, FILE * const);
void set_retry_delay(int, const char *const, FILE * const);
void set_conn_timeout(int, const char *const, FILE * const);
void set_debug_mode(int, const char *const, FILE * const);
void set_libdebug_mode(int, const char *const, FILE * const);
void set_http_no_cache(int, const char *const, FILE * const);
void set_output_dir(int i, const char *const val, FILE * const fp);
void set_http_proxy(int i, const char *const val, FILE * const fp);
void set_http_proxy_username(int i, const char *const val,
FILE * const fp);
void set_http_proxy_passwd(int i, const char *const val, FILE * const fp);
void set_http_use_proxy(int i, const char *const val, FILE * const fp);
void set_http_proxy_type(int i, const char *const val, FILE * const fp);
void set_ftp_proxy(int i, const char *const val, FILE * const fp);
void set_ftp_proxy_username(int i, const char *const val, FILE * const fp);
void set_ftp_proxy_passwd(int i, const char *const val, FILE * const fp);
void set_ftp_use_proxy(int i, const char *const val, FILE * const fp);
void set_ftp_proxy_type(int i, const char *const val, FILE * const fp);
void set_mirrors_req(int i, const char *const val, FILE * const fp);
void set_max_simul_pings(int i, const char *const val, FILE * const fp);
void set_max_ping_wait(int i, const char *const val, FILE * const fp);
void set_use_ftpsearch(int, const char *const, FILE * const);
void set_ftpsearch_server_id(int i, const char *const val, FILE * const fp);
void set_display_mode(int i, const char *const val, FILE * const fp);
void set_search_size(int i, const char *const val, FILE * const fp);
/*TODO add saving the proxy locations too*/
prefopt_t pref_opts[] = {
{"threads", set_num_threads, 1},
{"tries", set_max_attempts, 1},
{"pasv", set_use_pasv, 1},
{"retrydelay", set_retry_delay, 1},
{"conntimeout", set_conn_timeout, 1},
{"maxbpsperdl", set_max_bps_per_dl, 1},
{"debug", set_debug_mode, 1},
{"libdebug", set_libdebug_mode, 1},
{"pragmanocache", set_http_no_cache, 1},
// {"outputdir", set_output_dir, 1},
{"httpproxy", set_http_proxy, 1},
{"httpproxyuser", set_http_proxy_username, 1},
{"httpproxypassword", set_http_proxy_passwd, 1},
{"httpproxytype", set_http_proxy_type, 1},
{"usehttpproxy", set_http_use_proxy, 1},
{"ftpproxy", set_ftp_proxy, 1},
{"ftpproxyuser", set_ftp_proxy_username, 1},
{"ftpproxypassword", set_ftp_proxy_passwd, 1},
{"ftpproxytype", set_ftp_proxy_type, 1},
{"useftpproxy", set_ftp_use_proxy, 1},
{"mirrorsreq", set_mirrors_req, 1},
{"maxsimulpings", set_max_simul_pings, 1},
{"maxpingwait", set_max_ping_wait, 1},
{"defaultftpsearch", set_use_ftpsearch, 1},
{"ftpsearchserverid", set_ftpsearch_server_id, 1},
{"displaymode",set_display_mode, 1},
{"minsearchsize",set_search_size, 1},
{NULL, 0, 0}
};
void set_num_threads(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.num_connections);
} else
{
rt.num_connections = atoi(val);
if (rt.num_connections <= 0 || rt.num_connections > 30)
rt.num_connections = 4;
}
}
void set_max_attempts(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.max_attempts);
} else
{
rt.max_attempts = atoi(val);
if (rt.max_attempts < 0)
rt.max_attempts = 0;
}
}
void set_retry_delay(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.retry_delay);
} else
{
rt.retry_delay = atoi(val);
if (rt.retry_delay < 0)
rt.retry_delay = 15;
}
}
void set_conn_timeout(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", (int) rt.timeout.tv_sec);
} else
{
rt.timeout.tv_sec = atoi(val);
rt.timeout.tv_usec = 0;
if (rt.timeout.tv_sec < 0)
rt.timeout.tv_sec = 90;
}
}
void set_max_bps_per_dl(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", (int) rt.max_bps_per_dl);
} else
{
rt.max_bps_per_dl = atoi(val);
if (rt.max_bps_per_dl < 0)
rt.max_bps_per_dl = 0;
}
}
void set_use_pasv(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.ftp_use_pasv);
} else
{
rt.ftp_use_pasv = atoi(val);
}
}
void set_debug_mode(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.debug_mode);
} else
{
rt.debug_mode = atoi(val);
}
}
void set_libdebug_mode(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.libdebug_mode);
} else
{
rt.libdebug_mode = atoi(val);
}
}
void set_http_no_cache(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.http_no_cache);
} else
{
rt.http_no_cache = atoi(val);
}
}
void set_output_dir(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%s", rt.output_dir);
} else
{
free(rt.output_dir);
rt.output_dir = strdup(val);
}
}
void set_http_proxy(int i, const char *const val, FILE * const fp)
{
uerr_t err;
urlinfo url_data;
if (fp != NULL)
{
fprintf(fp, "%s:%d", rt.http_proxy->proxy_url.host,
rt.http_proxy->proxy_url.port);
} else
{
err = proz_parse_url(val, &url_data, 0);
if (err != URLOK)
{
proz_debug("%s does not seem to be a valid proxy value", val);
return;
}
proz_free_url(&rt.http_proxy->proxy_url, 0);
memcpy(&rt.http_proxy->proxy_url, &url_data, sizeof(url_data));
}
}
void set_http_proxy_username(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%s", rt.http_proxy->username);
} else
{
free(rt.http_proxy->username);
rt.http_proxy->username = strdup(val);
}
}
void set_http_proxy_passwd(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%s", rt.http_proxy->passwd);
} else
{
free(rt.http_proxy->passwd);
rt.http_proxy->passwd = strdup(val);
}
}
void set_http_proxy_type(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", (int) rt.http_proxy->type);
} else
{
rt.http_proxy->type = (proxy_type) atoi(val);
}
}
void set_http_use_proxy(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.use_http_proxy);
} else
{
rt.use_http_proxy = atoi(val);
}
}
void set_ftp_proxy(int i, const char *const val, FILE * const fp)
{
uerr_t err;
urlinfo url_data;
if (fp != NULL)
{
fprintf(fp, "%s:%d", rt.ftp_proxy->proxy_url.host,
rt.ftp_proxy->proxy_url.port);
} else
{
err = proz_parse_url(val, &url_data, 0);
if (err != URLOK)
{
proz_debug("%s does not seem to be a valid proxy value", val);
return;
}
proz_free_url(&rt.ftp_proxy->proxy_url, 0);
memcpy(&rt.ftp_proxy->proxy_url, &url_data, sizeof(url_data));
}
}
void set_ftp_proxy_username(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%s", rt.ftp_proxy->username);
} else
{
free(rt.ftp_proxy->username);
rt.ftp_proxy->username = strdup(val);
}
}
void set_ftp_proxy_passwd(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%s", rt.ftp_proxy->passwd);
} else
{
free(rt.ftp_proxy->passwd);
rt.ftp_proxy->passwd = strdup(val);
}
}
void set_ftp_proxy_type(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", (int) rt.ftp_proxy->type);
} else
{
rt.ftp_proxy->type = (proxy_type) atoi(val);
}
}
void set_ftp_use_proxy(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.use_ftp_proxy);
} else
{
rt.use_ftp_proxy = atoi(val);
}
}
void set_mirrors_req(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.ftps_mirror_req_n);
} else
{
rt.ftps_mirror_req_n = atoi(val);
if (rt.ftps_mirror_req_n <= 0 || rt.ftps_mirror_req_n> 1000)
rt.ftps_mirror_req_n = 40;
}
}
void set_max_simul_pings(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.max_simul_pings);
} else
{
rt.max_simul_pings= atoi(val);
if (rt.max_simul_pings <= 0 || rt.max_simul_pings> 30)
rt.max_simul_pings=5;
}
}
void set_max_ping_wait(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.max_ping_wait);
} else
{
rt.max_ping_wait= atoi(val);
if (rt.max_ping_wait <= 0 || rt.max_ping_wait> 30)
rt.max_ping_wait=5;
}
}
void set_use_ftpsearch(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.ftp_search);
} else
{
rt.ftp_search = atoi(val);
}
}
void set_ftpsearch_server_id(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.ftpsearch_server_id);
} else
{
rt.ftpsearch_server_id = atoi(val);
if (rt.ftpsearch_server_id < 0)
rt.ftpsearch_server_id = 0;
else if (rt.ftpsearch_server_id > 1)
rt.ftpsearch_server_id = 1;
}
}
void set_display_mode(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%d", rt.display_mode);
} else
{
rt.display_mode = atoi(val);
}
}
void set_search_size(int i, const char *const val, FILE * const fp)
{
if (fp != NULL)
{
fprintf(fp, "%ld", rt.min_search_size);
} else
{
rt.min_search_size = atoi(val);
}
}
void save_prefs()
{
char config_fname[PATH_MAX];
FILE *fp;
int i;
snprintf(config_fname, PATH_MAX, "%s/.prozilla/%s", rt.home_dir,
"prozconfig");
if ((fp = fopen(config_fname, "wt")) == NULL)
{
perror("could not save preferences file");
proz_debug("could not save preferences file :- %s", strerror(errno));
return;
}
fprintf(fp, "%s",
"# ProZilla preferences file\n# This file is loaded and OVERWRITTEN each time ProZilla is run.\n# Please try to avoid writing to this file.\n#\n");
for (i = 0; pref_opts[i].varname != NULL; i++)
{
fprintf(fp, "%s=", pref_opts[i].varname);
(*pref_opts[i].proc) (i, NULL, fp);
fprintf(fp, "\n");
}
fclose(fp);
}
void load_prefs()
{
char config_fname[PATH_MAX];
FILE *fp;
int i;
char line[256];
char *tok1, *tok2;
snprintf(config_fname, PATH_MAX, "%s/.prozilla/%s", rt.home_dir,
"prozconfig");
if ((fp = fopen(config_fname, "rt")) == NULL)
{
if (errno == ENOENT) /*Create the file then if it doesnt exist */
{
save_prefs();
return;
}
else
{
perror(_("could not open preferences file for reading"));
proz_debug("could not open preferences file :- %s", strerror(errno));
return;
}
}
line[sizeof(line) - 1] = '\0';
while (fgets(line, sizeof(line) - 1, fp) != NULL)
{
tok1 = strtok(line, " =\t\r\n");
if ((tok1 == NULL) || (tok1[0] == '#'))
continue;
tok2 = strtok(NULL, "\r\n");
if (tok2 == NULL)
continue;
for (i = 0; pref_opts[i].varname != NULL; i++)
{
if (strcmp(tok1, pref_opts[i].varname) == 0)
{
if (pref_opts[i].proc != NULL)
(*pref_opts[i].proc) (i, tok2, NULL);
}
}
}
fclose(fp);
}

23
src/prefs.h Normal file
View File

@@ -0,0 +1,23 @@
/******************************************************************************
fltk prozilla - a front end for prozilla, a download accelerator library
Copyright (C) 2001 Kalum Somaratna
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
******************************************************************************/
#ifndef PREFS_H
#define PREFS_H
void save_prefs();
void load_prefs();
#endif