From f58a97d3de5b43fd2cf8c0928939241b7b01c67d Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:55:29 +0000 Subject: [PATCH] Moved time handling, fixed makefiles Author: jgg Date: 1999-12-10 07:21:52 GMT Moved time handling, fixed makefiles --- apt-pkg/contrib/strutl.cc | 17 +++++++++++++---- buildlib/defaults.mak | 3 ++- buildlib/environment.mak.in | 6 ++++-- buildlib/makefile.in | 4 ++-- configure.in | 2 +- methods/ftp.cc | 15 ++------------- methods/makefile | 4 ++-- methods/rfc2553emu.h | 9 ++++----- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 93a2b39cd..8e80c5efd 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: strutl.cc,v 1.30 1999/10/17 07:30:23 jgg Exp $ +// $Id: strutl.cc,v 1.31 1999/12/10 07:21:52 jgg Exp $ /* ###################################################################### String Util - Some usefull string functions. @@ -633,7 +633,8 @@ static time_t timegm(struct tm *t) /* This handles all 3 populare time formats including RFC 1123, RFC 1036 and the C library asctime format. It requires the GNU library function 'timegm' to convert a struct tm in UTC to a time_t. For some bizzar - reason the C library does not provide any such function :<*/ + reason the C library does not provide any such function :< This also + handles the weird, but unambiguous FTP time format*/ bool StrToTime(string Val,time_t &Result) { struct tm Tm; @@ -644,6 +645,7 @@ bool StrToTime(string Val,time_t &Result) for (;*I != 0 && *I != ' '; I++); // Handle RFC 1123 time + Month[0] = 0; if (sscanf(I," %d %3s %d %d:%d:%d GMT",&Tm.tm_mday,Month,&Tm.tm_year, &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6) { @@ -656,12 +658,19 @@ bool StrToTime(string Val,time_t &Result) // asctime format if (sscanf(I," %3s %d %d:%d:%d %d",Month,&Tm.tm_mday, &Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec,&Tm.tm_year) != 6) - return false; + { + // 'ftp' time + if (sscanf(I,"%4d%2d%2d%2d%2d%2d",&Tm.tm_year,&Tm.tm_mon, + &Tm.tm_mday,&Tm.tm_hour,&Tm.tm_min,&Tm.tm_sec) != 6) + return false; + Tm.tm_mon--; + } } } Tm.tm_isdst = 0; - Tm.tm_mon = MonthConv(Month); + if (Month[0] != 0) + Tm.tm_mon = MonthConv(Month); Tm.tm_year -= 1900; // Convert to local time and then to GMT diff --git a/buildlib/defaults.mak b/buildlib/defaults.mak index 47f297cdf..6e504390c 100644 --- a/buildlib/defaults.mak +++ b/buildlib/defaults.mak @@ -79,6 +79,8 @@ PROGRAM_H = $(BASE)/buildlib/program.mak COPY_H = $(BASE)/buildlib/copy.mak YODL_MANPAGE_H = $(BASE)/buildlib/yodl_manpage.mak +include $(BUILD)/environment.mak + ifdef STATICLIBS LIBRARY_H += $(BASE)/buildlib/staticlibrary.mak endif @@ -100,7 +102,6 @@ SUBDIRS+= HEADER_TARGETDIRS+= # Options -include $(BUILD)/environment.mak CPPFLAGS+= -I$(INCLUDE) LDFLAGS+= -L$(LIB) diff --git a/buildlib/environment.mak.in b/buildlib/environment.mak.in index 6d721c711..e7545bac8 100644 --- a/buildlib/environment.mak.in +++ b/buildlib/environment.mak.in @@ -39,8 +39,10 @@ HAVE_STATVFS = @HAVE_STATVFS@ # Shared library things HOST_OS = @host_os@ ifeq ($(HOST_OS),linux-gnu) - ONLYSHAREDLIBS = yes SONAME_MAGIC=-Wl,-soname -Wl, LFLAGS_SO= +else + # Do not know how to creat shared libraries here. + ONLYSTATICLIBS = yes endif - + diff --git a/buildlib/makefile.in b/buildlib/makefile.in index 677aee4d3..4eb64606c 100644 --- a/buildlib/makefile.in +++ b/buildlib/makefile.in @@ -40,11 +40,11 @@ endif ifeq ($(HAVE_C9X),yes) @rm -f include/inttypes.h > /dev/null 2>&1 else - @cp $(SRCDIR)/buildlib/inttypes.h.in include/inttypes.h + @cp -p $(SRCDIR)/buildlib/inttypes.h.in include/inttypes.h endif ifeq ($(HAVE_STATVFS),yes) @rm -f include/statvfs.h > /dev/null 2>&1 else - @cp $(SRCDIR)/buildlib/statvfs.h.in include/statvfs.h + @cp -p $(SRCDIR)/buildlib/statvfs.h.in include/statvfs.h ln -sf . include/sys endif diff --git a/configure.in b/configure.in index 6c8a1dc03..beed25387 100644 --- a/configure.in +++ b/configure.in @@ -95,7 +95,7 @@ AC_CACHE_CHECK([for C9x integer types],c9x_ints,[ c9x_ints=yes,c9x_ints=no)]) dnl Single Unix Spec statvfs -AC_CHECK_FUNC(statvfs) +AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes]) AC_SUBST(HAVE_STATVFS) dnl Check the sizes etc. of the architecture diff --git a/methods/ftp.cc b/methods/ftp.cc index a7fa83233..1780ac740 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: ftp.cc,v 1.17 1999/12/09 03:45:56 jgg Exp $ +// $Id: ftp.cc,v 1.18 1999/12/10 07:21:52 jgg Exp $ /* ###################################################################### HTTP Aquire Method - This is the FTP aquire method for APT. @@ -498,18 +498,7 @@ bool FTPConn::ModTime(const char *Path, time_t &Time) return true; // Parse it - struct tm tm; - memset(&tm,0,sizeof(tm)); - if (sscanf(Msg.c_str(),"%4d%2d%2d%2d%2d%2d",&tm.tm_year,&tm.tm_mon, - &tm.tm_mday,&tm.tm_hour,&tm.tm_min,&tm.tm_sec) != 6) - return true; - - tm.tm_year -= 1900; - tm.tm_mon--; - - /* We use timegm from the GNU C library, libapt-pkg will provide this - symbol if it does not exist */ - Time = timegm(&tm); + StrToTime(Msg,Time); return true; } /*}}}*/ diff --git a/methods/makefile b/methods/makefile index addaf23c9..e8eaec230 100644 --- a/methods/makefile +++ b/methods/makefile @@ -36,14 +36,14 @@ include $(PROGRAM_H) # The http method PROGRAM=http -SLIBS = -lapt-pkg $SOCKETLIBS +SLIBS = -lapt-pkg $(SOCKETLIBS) LIB_MAKES = apt-pkg/makefile SOURCE = http.cc rfc2553emu.cc connect.cc include $(PROGRAM_H) # The ftp method PROGRAM=ftp -SLIBS = -lapt-pkg $SOCKETLIBS +SLIBS = -lapt-pkg $(SOCKETLIBS) LIB_MAKES = apt-pkg/makefile SOURCE = ftp.cc rfc2553emu.cc connect.cc include $(PROGRAM_H) diff --git a/methods/rfc2553emu.h b/methods/rfc2553emu.h index 5b9abbd84..86765b3cc 100644 --- a/methods/rfc2553emu.h +++ b/methods/rfc2553emu.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: rfc2553emu.h,v 1.2 1999/05/26 04:08:39 jgg Exp $ +// $Id: rfc2553emu.h,v 1.3 1999/12/10 07:21:52 jgg Exp $ /* ###################################################################### RFC 2553 Emulation - Provides emulation for RFC 2553 getaddrinfo, @@ -38,8 +38,6 @@ // getaddrinfo support? #ifndef HAVE_GETADDRINFO - #error Boink - // Renamed to advoid type clashing.. (for debugging) struct addrinfo_emu { @@ -50,9 +48,9 @@ size_t ai_addrlen; /* length of ai_addr */ char *ai_canonname; /* canonical name for nodename */ struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ + struct addrinfo_emu *ai_next; /* next structure in linked list */ }; - #define addinfo addrinfo_emu + #define addrinfo addrinfo_emu int getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, @@ -73,6 +71,7 @@ #define EAI_SERVICE -7 #define EAI_ADDRFAMILY -8 #define EAI_SYSTEM -10 + #define EAI_MEMORY -11 #endif #endif -- 2.45.2