httpup: various changes
This commit is contained in:
parent
d4513d341e
commit
71a2db495b
@ -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)
|
||||
|
98
Makefile
98
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
|
||||
|
||||
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
|
||||
prefix= /usr/local
|
||||
bindir= $(prefix)/bin
|
||||
libdir= $(prefix)/lib
|
||||
includedir= $(prefix)/include
|
||||
mandir= $(prefix)/man
|
||||
|
||||
|
||||
CXX= g++
|
||||
CXXFLAGS= -O2 -pipe -DMF_VERSION=\"${version}\"
|
||||
CXXFLAGS+= -g -Wall -Werror
|
||||
LDFLAGS= -lcurl
|
||||
|
||||
############################################################################
|
||||
$(objects): %.o: %.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $< -o $@
|
||||
INSTALL= /usr/bin/install
|
||||
STRIP= /usr/bin/strip
|
||||
|
||||
|
||||
httpup: $(objects) *.cpp *.h
|
||||
g++ -o httpup $(objects) $(LDFLAGS)
|
||||
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
|
||||
|
||||
.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)
|
||||
|
||||
dist:
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
mkdir ${NAME}-${VERSION}
|
||||
|
||||
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: 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)
|
||||
|
43
Makefile.orig
Normal file
43
Makefile.orig
Normal file
@ -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}
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
12
httpup.cpp
12
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user