summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Makefile94
-rw-r--r--Makefile.orig43
-rw-r--r--argparser.cpp3
-rw-r--r--fileutils.cpp5
-rw-r--r--httpup.cpp12
-rw-r--r--httpup.h2
7 files changed, 123 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index dbb457c..a4436bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)
diff --git a/Makefile b/Makefile
index d3f6036..0113801 100644
--- a/Makefile
+++ b/Makefile
@@ -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;
diff --git a/httpup.cpp b/httpup.cpp
index 64694ba..22932d7 100644
--- a/httpup.cpp
+++ b/httpup.cpp
@@ -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;
diff --git a/httpup.h b/httpup.h
index affa4c7..410e680 100644
--- a/httpup.h
+++ b/httpup.h
@@ -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:

Generated by cgit