diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-10-14 12:32:07 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-10-14 12:32:07 -0400 |
commit | 64c4d93e6c1d2751c8517e10192e585db0cbce82 (patch) | |
tree | e2d8a765b19927ff7cb92bd171073dc86fe11f40 /WWW/Library/Implementation | |
parent | 043745f9329c2bc33b8e6282b57970bbc550355e (diff) | |
download | lynx-snapshots-64c4d93e6c1d2751c8517e10192e585db0cbce82.tar.gz |
snapshot of project "lynx", label v2-8-1pre_10
Diffstat (limited to 'WWW/Library/Implementation')
-rw-r--r-- | WWW/Library/Implementation/HTAccess.c | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFWriter.c | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFile.c | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFinger.c | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 1 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTNews.c | 64 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTCP.c | 15 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTVMSUtils.c | 31 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTVMSUtils.h | 3 |
10 files changed, 59 insertions, 64 deletions
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c index 9bf69d38..12b17d54 100644 --- a/WWW/Library/Implementation/HTAccess.c +++ b/WWW/Library/Implementation/HTAccess.c @@ -63,6 +63,7 @@ #include <GridText.h> #include <LYGlobalDefs.h> #include <LYexit.h> +#include <LYUtils.h> #include <LYLeaks.h> extern HTCJKlang HTCJK; diff --git a/WWW/Library/Implementation/HTFWriter.c b/WWW/Library/Implementation/HTFWriter.c index f30461c9..8bccb379 100644 --- a/WWW/Library/Implementation/HTFWriter.c +++ b/WWW/Library/Implementation/HTFWriter.c @@ -16,6 +16,7 @@ #include <HTAlert.h> #include <HTFile.h> +#include <LYUtils.h> #include <LYLeaks.h> /* Stream Object diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index 70936cf3..d04b2013 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -52,10 +52,6 @@ #define INFINITY 512 /* file name length @@ FIXME */ #define MULTI_SUFFIX ".multi" /* Extension for scanning formats */ -#ifdef VMS -#include <HTVMSUtils.h> -#endif /* VMS */ - #include <HTParse.h> #include <HTTCP.h> #ifndef DECNET diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index 0932b4d2..91b8d40e 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -34,6 +34,7 @@ #include <HTString.h> #include <HTFinger.h> +#include <LYUtils.h> #include <LYLeaks.h> #define FINGER_PORT 79 /* See rfc742 */ diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index 8c7855ca..d6790693 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -68,6 +68,7 @@ #include <HTML.h> #include <LYStrings.h> +#include <LYUtils.h> #include <LYLeaks.h> #define PUTC(c) (*targetClass.put_character)(target, c) diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 2b547783..331b4fa7 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -15,6 +15,7 @@ #include <HTCJK.h> #include <HTMIME.h> #include <HTTCP.h> +#include <LYUtils.h> /* this define should be in HTFont.h :( */ #define HT_NON_BREAK_SPACE ((char)1) /* For now */ @@ -893,12 +894,7 @@ PRIVATE void post_article ARGS1( } } fclose(fd); -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); /* ** Send the nntp EOF and get the server's response. - FM @@ -2351,12 +2347,7 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return HT_NOT_LOADED; @@ -2375,12 +2366,7 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return HTLoadError(stream, 500, message); @@ -2409,12 +2395,7 @@ PRIVATE int HTLoadNews ARGS4( FREE(ProxyHREF); FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return(HT_NOT_LOADED); @@ -2441,12 +2422,7 @@ PRIVATE int HTLoadNews ARGS4( } FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return(HT_NOT_LOADED); @@ -2467,12 +2443,7 @@ PRIVATE int HTLoadNews ARGS4( } FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return(HT_NOT_LOADED); @@ -2617,12 +2588,7 @@ Send_NNTP_command: if (status != 340) { HTAlert("Cannot POST to this host."); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); } } else { post_article(postfile); @@ -2684,12 +2650,7 @@ Send_NNTP_command: } FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return status; @@ -2712,12 +2673,7 @@ Send_NNTP_command: } FREE(ListArg); if (postfile) { -#ifdef VMS - while (remove(postfile) == 0) - ; /* loop through all versions */ -#else - remove(postfile); -#endif /* VMS */ + HTSYS_remove(postfile); FREE(postfile); } return HT_NOT_LOADED; diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index 05cce142..f83334c7 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -117,11 +117,14 @@ extern int sys_nerr; #ifdef _WINDOWS_NSL char host[512]; - struct hostent *phost; /* Pointer to host - See netdb.h */ + struct hostent *phost; /* Pointer to host - See netdb.h */ + int donelookup; unsigned long _fork_func (void *arglist) { - return (unsigned long)(phost = gethostbyname(host)); + phost = gethostbyname(host); + donelookup = TRUE; + return (unsigned long)(phost); } #endif /* _WINDOWS_NSL */ @@ -642,7 +645,9 @@ PUBLIC int HTParseInet ARGS2( if (!hThread) MessageBox((void *)NULL, "CreateThread", "CreateThread Failed", 0L); - while (!phost) + + donelookup = FALSE; + while (!donelookup) if (HTCheckForInterrupt()) { /* Note that host is a character array and is not freed */ @@ -653,6 +658,8 @@ PUBLIC int HTParseInet ARGS2( return HT_INTERRUPTED; }; }; + if (!phost) goto failed; + memcpy((void *)&soc_in->sin_addr, phost->h_addr, phost->h_length); #else /* !NSL_FORK, !DJGPP, !_WINDOWS_NSL: */ { struct hostent *phost; @@ -680,8 +687,6 @@ PUBLIC int HTParseInet ARGS2( #endif /* !NSL_FORK */ #ifndef _WINDOWS_NSL FREE(host); -#else - memcpy((void *)&soc_in->sin_addr, phost->h_addr, phost->h_length); #endif /* _WINDOWS_NSL */ } diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 5d2a9642..4d128c81 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -7,8 +7,8 @@ */ #include <HTUtils.h> - #include <HTTP.h> +#include <LYUtils.h> #define HTTP_VERSION "HTTP/1.0" diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c index d2e981a9..7f49ff67 100644 --- a/WWW/Library/Implementation/HTVMSUtils.c +++ b/WWW/Library/Implementation/HTVMSUtils.c @@ -30,6 +30,7 @@ #include <starlet.h> #include <rmsdef.h> +#include <LYUtils.h> #include <LYLeaks.h> #define FREE(x) if (x) {free(x); x = NULL;} @@ -1245,3 +1246,33 @@ PUBLIC int HTVMSBrowseDir ARGS4( return HT_LOADED; } /* End of directory reading section */ + +/* + * Remove all versions of the given file. We assume there are no permissions + * problems, since we do this mainly for removing temporary files. + */ +int HTVMS_remove(char *filename) +{ + int code = remove(filename); /* return the first status code */ + while (remove(filename) == 0) + ; + return code; +} + +/* + * Remove all older versions of the given file. We may fail to remove some + * version due to permissions -- the loop stops either at that point, or when + * we run out of older versions to remove. + */ +void HTVMS_purge(char *filename) +{ + char *older_file = 0; + + StrAllocCopy(older_file, filename); + StrAllocCat(older_file, ";-1"); + + while (remove(older_file) == 0) + ; + + FREE(older_file); +} diff --git a/WWW/Library/Implementation/HTVMSUtils.h b/WWW/Library/Implementation/HTVMSUtils.h index da6b9432..25fd5adb 100644 --- a/WWW/Library/Implementation/HTVMSUtils.h +++ b/WWW/Library/Implementation/HTVMSUtils.h @@ -111,4 +111,7 @@ PUBLIC int HTVMSBrowseDir PARAMS(( HTFormat format_out, HTStream * sink)); +extern int HTVMS_remove(char *filename); +extern void HTVMS_purge(char *filename); + #endif /* not HTVMSUTIL_H */ |