From 99437fdbf8918a033bb210a0d9ad126114397421 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 27 Apr 2000 02:19:08 +0000 Subject: [PATCH] * setup.c (findhref): Change method for scanning for href= to choose the last one on the line. This is still not foolproof and probably will need to be changed eventually. Don't abort if no "size" field is evident. (processdirlisting): Fix boolean algebra. --- ChangeLog | 8 ++++++++ setup.c | 49 +++++++++++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4db1919f..6e2f4690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Apr 26 22:16:57 2000 Christopher Faylor + + * setup.c (findhref): Change method for scanning for href= to choose + the last one on the line. This is still not foolproof and probably + will need to be changed eventually. Don't abort if no "size" field is + evident. + (processdirlisting): Fix boolean algebra. + Wed Apr 26 01:10:39 2000 Christopher Faylor * main.c (tarx): Add some code for future task of unmounting diff --git a/setup.c b/setup.c index 9120a0be..49cb40f7 100644 --- a/setup.c +++ b/setup.c @@ -645,20 +645,32 @@ geturl (const char *url, const char *file, int verbose) static char * findhref (char *buffer, char *date, size_t *filesize) { - char *ref; - char *anchor = strstr (buffer, ""); @@ -679,6 +688,10 @@ findhref (char *buffer, char *date, size_t *filesize) return ref; *filesize = 0; + + if (anchor == buffer || !isspace (anchor[-1])) + return ref; + eatspace = 1; *diglast = '\0'; for (p = anchor, q = diglast; --p >= buffer; ) @@ -726,7 +739,7 @@ processdirlisting (const char *urlbase, const char *file) DWORD urlspace = sizeof (url); struct _stat st; - if (!ref) + if (!ref || strnicmp (ref, "http:", 5) == 0) continue; if (!InternetCombineUrl @@ -792,7 +805,7 @@ processdirlisting (const char *urlbase, const char *file) warning ("Downloading: %s...", filename); fflush (stdout); res = geturl (url, filename, 0); - if (res && !filesize || !needfile (filename, filedate, filesize)) + if ((res && !filesize) || !needfile (filename, filedate, filesize)) warning ("Done.\n"); else { @@ -846,7 +859,7 @@ processdirlisting (const char *urlbase, const char *file) static char * tmpfilename () { - return xstrdup (tmpnam (NULL)); + return _tempnam (NULL, "su"); } static int @@ -858,7 +871,7 @@ downloaddir (const char *url) if (geturl (url, file, 1)) { retval = processdirlisting (url, file); - // unlink (file); + unlink (file); } xfree (file); @@ -882,7 +895,7 @@ downloadfrom (const char *url) if (geturl (url, file, 1)) { retval = processdirlisting (url, file); - // unlink (file); + unlink (file); } xfree (file); @@ -1137,7 +1150,7 @@ getdownloadsource () sa_cleanup (&names); } } - // unlink (filename); + unlink (filename); return retval; } -- 2.43.5