diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Makefile | 94 | ||||
-rw-r--r-- | Makefile.orig | 43 | ||||
-rw-r--r-- | argparser.cpp | 3 | ||||
-rw-r--r-- | fileutils.cpp | 5 | ||||
-rw-r--r-- | httpup.cpp | 12 | ||||
-rw-r--r-- | httpup.h | 2 |
7 files changed, 123 insertions, 40 deletions
@@ -1,3 +1,7 @@ +* 0.4.0i 15.04.2006 Johannes Winkelmann +- Remove directories again (regression from 4.0h) +- improve some compilation issues reported by Han + * 0.4.0h 04.04.2006 Johannes Winkelmann - fix potentially dangerous deltree call (Thanks Martin Koniczek for reporting and debugging) @@ -1,43 +1,75 @@ -all: httpup +name=httpup +version=0.4.0i -############################################################################ -### -## Configuration -# -NAME=httpup -VERSION="0.4.0h" -CXX=g++ -CXXFLAGS=-Wall -ansi -pedantic -DMF_VERSION='${VERSION}' -LDFLAGS=-lcurl +prefix= /usr/local +bindir= $(prefix)/bin +libdir= $(prefix)/lib +includedir= $(prefix)/include +mandir= $(prefix)/man -objects=httpupargparser.o argparser.o main.o httpup.o \ - fileutils.o md5.o configparser.o -httpupargparser.o: httpupargparser.cpp httpupargparser.h -argparser.o: argparser.cpp argparser.h -main.o: main.cpp -httpup.o: httpup.cpp httpup.h -fileutils.o: fileutils.cpp fileutils.h -md5.o: md5.cpp md5.h -configparser.o: configparser.cpp configparser.h +CXX= g++ +CXXFLAGS= -O2 -pipe -DMF_VERSION=\"${version}\" +CXXFLAGS+= -g -Wall -Werror +LDFLAGS= -lcurl +INSTALL= /usr/bin/install +STRIP= /usr/bin/strip -############################################################################ -$(objects): %.o: %.cpp - $(CXX) -c $(CXXFLAGS) $< -o $@ +OBJS= httpup.o \ + fileutils.o \ + argparser.o \ + md5.o \ + httpupargparser.o \ + configparser.o \ + main.o +# # Portability stuff. +CXXFLAGS+= -Wno-strict-aliasing +# OBJS+= strtonum.o strlcpy.o strlcat.o fgetln.o -httpup: $(objects) *.cpp *.h - g++ -o httpup $(objects) $(LDFLAGS) +.c.o: + $(CC) $(CFLAGS) -c $< + +all: $(name) + + +$(name): $(OBJS) + $(CXX) $(LDFLAGS) $(OBJS) -o $(name) + +distclean: clean + -rm -f Makefile config.log config.h *~ *.core core.* clean: - rm -f httpup $(objects) + -rm -f *.o $(name) + + +install: $(name) $(name).8 + $(INSTALL) -d $(DESTDIR)$(bindir) + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL) -m 755 $(name) $(DESTDIR)$(bindir)/$(name) + $(INSTALL) -m 755 httpup-repgen $(DESTDIR)$(bindir)/httpup-repgen + $(INSTALL) -m 644 $(name).8 $(DESTDIR)$(mandir)/man8/$(name).8 + $(INSTALL) -m 644 httpup-repgen.8 \ + $(DESTDIR)$(mandir)/man8/httpup-repgen.8 + +install-strip: install + $(STRIP) $(DESTDIR)$(bindir)/$(name) + +uninstall: + rm -f \ + $(DESTDIR)$(bindir)/$(name) \ + $(DESTDIR)$(mandir)/man1/$(name).8 + +rebuild: + make clean all + -dist: - rm -rf ${NAME}-${VERSION} - mkdir ${NAME}-${VERSION} +dist: all + rm -rf $(name)-$(version) + mkdir $(name)-$(version) cp *.cpp *.h Makefile AUTHORS COPYING ChangeLog README TODO *.8 \ - httpup-repgen* httpup.conf* ${NAME}-${VERSION} - tar cvzf ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION} - rm -rf ${NAME}-${VERSION} + httpup-repgen* httpup.conf* $(name)-$(version) + tar cvzf $(name)-$(version).tar.gz $(name)-$(version) + rm -rf $(name)-$(version) diff --git a/Makefile.orig b/Makefile.orig new file mode 100644 index 0000000..d3f6036 --- /dev/null +++ b/Makefile.orig @@ -0,0 +1,43 @@ +all: httpup + +############################################################################ +### +## Configuration +# +NAME=httpup +VERSION="0.4.0h" +CXX=g++ +CXXFLAGS=-Wall -ansi -pedantic -DMF_VERSION='${VERSION}' +LDFLAGS=-lcurl + +objects=httpupargparser.o argparser.o main.o httpup.o \ + fileutils.o md5.o configparser.o + +httpupargparser.o: httpupargparser.cpp httpupargparser.h +argparser.o: argparser.cpp argparser.h +main.o: main.cpp +httpup.o: httpup.cpp httpup.h +fileutils.o: fileutils.cpp fileutils.h +md5.o: md5.cpp md5.h +configparser.o: configparser.cpp configparser.h + + + +############################################################################ +$(objects): %.o: %.cpp + $(CXX) -c $(CXXFLAGS) $< -o $@ + + +httpup: $(objects) *.cpp *.h + g++ -o httpup $(objects) $(LDFLAGS) + +clean: + rm -f httpup $(objects) + +dist: + rm -rf ${NAME}-${VERSION} + mkdir ${NAME}-${VERSION} + cp *.cpp *.h Makefile AUTHORS COPYING ChangeLog README TODO *.8 \ + httpup-repgen* httpup.conf* ${NAME}-${VERSION} + tar cvzf ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION} + rm -rf ${NAME}-${VERSION} diff --git a/argparser.cpp b/argparser.cpp index 861261c..d676501 100644 --- a/argparser.cpp +++ b/argparser.cpp @@ -346,8 +346,7 @@ std::string ArgParser::generateHelpForCommand(const std::string& command) const help += "\n\n"; - std::map<int, Option*>::const_iterator it = - it = cmd->mandatoryOptions.begin(); + std::map<int, Option*>::const_iterator it = cmd->mandatoryOptions.begin(); if (it != cmd->mandatoryOptions.end()) { help += " Required: \n"; for (; it != cmd->mandatoryOptions.end(); ++it) { diff --git a/fileutils.cpp b/fileutils.cpp index 39a7dca..0d993c4 100644 --- a/fileutils.cpp +++ b/fileutils.cpp @@ -42,10 +42,11 @@ int FileUtils::deltree(const char* directory) continue; } struct stat info; - if (stat(entry->d_name, &info) != 0) { + string pathName = string(directory) + "/" + string(entry->d_name); + if (stat(pathName.c_str(), &info) != 0) { + cout << entry->d_name << endl; return -1; } - string pathName = string(directory) + "/" + string(entry->d_name); if (S_ISDIR(info.st_mode)) { if (deltree(pathName.c_str())) { ret = -1; @@ -14,6 +14,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <libgen.h> #include <dirent.h> #include "fileutils.h" @@ -239,7 +240,7 @@ int HttpUp::exec(ExecType type) } } curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); - + // proxy, proxy auth if (config.proxyHost != "") { @@ -304,9 +305,12 @@ int HttpUp::syncOrReturn(CURL* curl, char* curlErrorBuffer) return -1; } - string collectionName = - basename((m_baseDirectory.substr(0, m_baseDirectory.length()-1)). - c_str()); + string collectionName = + m_baseDirectory.substr(0, m_baseDirectory.length()-1); + string::size_type pos = collectionName.rfind("/"); + if (pos != string::npos) { + collectionName = collectionName.substr(pos+1); + } cout << "Updating collection " << collectionName << endl; @@ -49,7 +49,7 @@ public: static const std::string REPOCURRENTFILE; static const std::string REPOCURRENTFILEOLD; static const std::string URLINFO; - + static const int DEFAULT_TIMEOUT; private: |