// -*- 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.
/* 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;
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)
{
// 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
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
HEADER_TARGETDIRS+=
# Options
-include $(BUILD)/environment.mak
CPPFLAGS+= -I$(INCLUDE)
LDFLAGS+= -L$(LIB)
# 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
-
+
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
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
// -*- 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.
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;
}
/*}}}*/
# 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)
// -*- 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,
// getaddrinfo support?
#ifndef HAVE_GETADDRINFO
- #error Boink
-
// Renamed to advoid type clashing.. (for debugging)
struct addrinfo_emu
{
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,
#define EAI_SERVICE -7
#define EAI_ADDRFAMILY -8
#define EAI_SYSTEM -10
+ #define EAI_MEMORY -11
#endif
#endif