Browse Source

Moved time handling, fixed makefiles

Author: jgg
Date: 1999-12-10 07:21:52 GMT
Moved time handling, fixed makefiles
debian/1.8.y
Arch Librarian 18 years ago
parent
commit
f58a97d3de
  1. 17
      apt-pkg/contrib/strutl.cc
  2. 3
      buildlib/defaults.mak
  3. 6
      buildlib/environment.mak.in
  4. 4
      buildlib/makefile.in
  5. 2
      configure.in
  6. 15
      methods/ftp.cc
  7. 4
      methods/makefile
  8. 9
      methods/rfc2553emu.h

17
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

3
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)

6
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

4
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

2
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

15
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;
}
/*}}}*/

4
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)

9
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

Loading…
Cancel
Save