diff options
Diffstat (limited to 'WWW/Library/Implementation')
-rw-r--r-- | WWW/Library/Implementation/HTAnchor.c | 9 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTDOS.c | 7 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFTP.c | 113 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFTP.h | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFile.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTFinger.c | 2 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTGopher.c | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTLex.c | 4 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTNews.c | 23 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTCP.c | 71 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTTP.c | 105 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTVMSUtils.c | 81 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTVMSUtils.h | 15 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTWAIS.c | 53 | ||||
-rw-r--r-- | WWW/Library/Implementation/HTWSRC.c | 31 | ||||
-rw-r--r-- | WWW/Library/Implementation/www_tcp.h | 15 |
16 files changed, 201 insertions, 338 deletions
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index e9ebe1f3..42dcb4dc 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -860,13 +860,8 @@ PUBLIC char * HTAnchor_address ARGS1( !((HTChildAnchor *)me)->tag) { /* it's an adult or no tag */ StrAllocCopy(addr, me->parent->address); } else { /* it's a named child */ - addr = malloc(2 + - strlen(me->parent->address) + - strlen(((HTChildAnchor *)me)->tag)); - if (addr == NULL) - outofmem(__FILE__, "HTAnchor_address"); - sprintf(addr, "%s#%s", - me->parent->address, ((HTChildAnchor *)me)->tag); + HTSprintf0(&addr, "%s#%s", + me->parent->address, ((HTChildAnchor *)me)->tag); } } return(addr); diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c index bbdd36e1..68a5c82d 100644 --- a/WWW/Library/Implementation/HTDOS.c +++ b/WWW/Library/Implementation/HTDOS.c @@ -5,6 +5,10 @@ #include <HTUtils.h> #include <HTDOS.h> +#ifdef WIN_EX +#include <LYGlobalDefs.h> +#endif + /* * Make a copy of the source argument in the result, allowing some extra * space so we can append directly onto the result without reallocating. @@ -114,7 +118,8 @@ char * HTDOS_name ARGS1(char *, wwwname) #ifdef _WINDOWS /* 1998/04/02 (Thu) 08:59:48 */ if (strchr(result, '\\') && strchr(result, ':')==NULL) { - sprintf(temp_buff, "%s\\%s", windows_drive, result); + sprintf(temp_buff, "%.3s\\%.*s", windows_drive, + (int)(sizeof(temp_buff) - sizeof(windows_drive) - 2), result); ret = NULL; StrAllocCopy(ret, temp_buff); free(cp_url); diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index a4418474..b2ceeadb 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -79,9 +79,6 @@ BUGS: @@@ Limit connection cache size! #define LAST_TCP_PORT 5999 #define LINE_LENGTH 256 -#define COMMAND_LENGTH 256 - -#define INFINITY 512 #include <HTParse.h> #include <HTAnchor.h> @@ -208,7 +205,7 @@ PRIVATE void free_FTPGlobals NOARGS } #endif /* LY_FIND_LEAKS */ -/* PUBLIC HTMake_VMS_name() +/* PUBLIC HTVMS_name() ** CONVERTS WWW name into a VMS name ** ON ENTRY: ** nn Node Name (optional) @@ -219,7 +216,7 @@ PRIVATE void free_FTPGlobals NOARGS ** ** Bug: Returns pointer to static -- non-reentrant */ -PUBLIC char * HTMake_VMS_name ARGS2( +PUBLIC char * HTVMS_name ARGS2( CONST char *, nn, CONST char *, fn) { @@ -231,7 +228,7 @@ PUBLIC char * HTMake_VMS_name ARGS2( ** The node is assumed to be local if the hostname WITHOUT DOMAIN ** matches the local one. @@@ */ - static char vmsname[INFINITY]; /* returned */ + static char *vmsname; char * filename = (char*)malloc(strlen(fn)+1); char * nodename = (char*)malloc(strlen(nn)+2+1); /* Copies to hack */ char *second; /* 2nd slash */ @@ -264,16 +261,16 @@ PUBLIC char * HTMake_VMS_name ARGS2( last = strrchr(filename, '/'); /* last slash */ if (!second) { /* Only one slash */ - sprintf(vmsname, "%s%s", nodename, filename + 1); + HTSprintf0(&vmsname, "%s%s", nodename, filename + 1); } else if (second == last) { /* Exactly two slashes */ *second = '\0'; /* Split filename from disk */ - sprintf(vmsname, "%s%s:%s", nodename, filename+1, second+1); + HTSprintf0(&vmsname, "%s%s:%s", nodename, filename+1, second+1); *second = '/'; /* restore */ } else { /* More than two slashes */ char * p; *second = '\0'; /* Split disk from directories */ *last = '\0'; /* Split dir from filename */ - sprintf(vmsname, "%s%s:[%s]%s", + HTSprintf0(&vmsname, "%s%s:[%s]%s", nodename, filename+1, second+1, last+1); *second = *last = '/'; /* restore filename */ for (p = strchr(vmsname, '['); *p!=']'; p++) @@ -523,6 +520,7 @@ PRIVATE int response ARGS1( return result/100; } +#if 0 PRIVATE int send_cmd_nowait ARGS1(char *, verb) { char command[20]; @@ -530,6 +528,7 @@ PRIVATE int send_cmd_nowait ARGS1(char *, verb) sprintf(command, "%.*s%c%c", (int) sizeof(command)-4, verb, CR, LF); return write_cmd(command); } +#endif PRIVATE int send_cmd_1 ARGS1(char *, verb) { @@ -1266,8 +1265,7 @@ PRIVATE void set_years_and_date NOARGS } } i++; - sprintf(month, "%s%d", (i < 10 ? "0" : ""), i); - sprintf(date, "9999%.2s%.2s", month, day); + sprintf(date, "9999%02d%.2s", i, day); TheDate = atoi(date); strcpy(ThisYear, (char *)ctime(&NowTime)+20); ThisYear[4] = '\0'; @@ -1644,30 +1642,22 @@ PRIVATE void parse_vms_dir_entry ARGS2( isalpha(*(cpd+1)) && *(cpd+4) == '-') { /** Month **/ - *(cpd+4) = '\0'; *(cpd+2) = (char) TOLOWER(*(cpd+2)); *(cpd+3) = (char) TOLOWER(*(cpd+3)); - sprintf(date, "%s ", cpd+1); - *(cpd+4) = '-'; + sprintf(date, "%.3s ", cpd+1); /** Day **/ - *cpd = '\0'; if (isdigit(*(cpd-2))) - sprintf(date+4, "%s ", cpd-2); + sprintf(date+4, "%.2s ", cpd-2); else - sprintf(date+4, "%c%s ", HT_NON_BREAK_SPACE, cpd-1); - *cpd = '-'; + sprintf(date+4, "%c%.1s ", HT_NON_BREAK_SPACE, cpd-1); /** Time or Year **/ if (!strncmp(ThisYear, cpd+5, 4) && strlen(cpd) > 15 && *(cpd+12) == ':') { - *(cpd+15) = '\0'; - sprintf(date+7, "%s", cpd+10); - *(cpd+15) = ' '; + sprintf(date+7, "%.5s", cpd+10); } else { - *(cpd+9) = '\0'; - sprintf(date+7, " %s", cpd+5); - *(cpd+9) = ' '; + sprintf(date+7, " %.4s", cpd+5); } StrAllocCopy(entry_info->date, date); @@ -1768,10 +1758,10 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2( *(cpd+17) = '\0'; /* Time */ if (strcmp(ThisYear, cpd+7)) /* Not this year, so show the year */ - sprintf(date, "%s %s", cpd, (cpd+7)); + sprintf(date, "%.6s %.4s", cpd, (cpd+7)); else /* Is this year, so show the time */ - sprintf(date, "%s %s", cpd, (cpd+12)); + sprintf(date, "%.6s %.5s", cpd, (cpd+12)); StrAllocCopy(entry_info->date, date); if (entry_info->date[4] == ' '|| entry_info->date[4] == '0') { entry_info->date[4] = HT_NON_BREAK_SPACE; @@ -1849,16 +1839,16 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( *(cp+2) = '\0'; /* Month */ i = atoi(cp) - 1; *(cp+5) = '\0'; /* Day */ - sprintf(date, "%s %s", months[i], (cp+3)); + sprintf(date, "%.3s %.2s", months[i], (cp+3)); if (date[4] == '0') date[4] = ' '; cp += 6; /* Year */ if (strcmp((ThisYear+2), cp)) { /* Not this year, so show the year */ if (atoi(cp) < 70) { - sprintf(&date[6], " 20%s", cp); + sprintf(&date[6], " 20%.2s", cp); } else { - sprintf(&date[6], " 19%s", cp); + sprintf(&date[6], " 19%.2s", cp); } } else { /* Is this year, so show the time */ @@ -1866,9 +1856,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2( i = atoi(cpd); if (*(cpd+5) == 'P' || *(cpd+5) == 'p') i += 12; - *(cpd+5) = '\0'; - sprintf(&date[6], " %s%d:%s", - (i < 10 ? "0" : ""), i, (cpd+3)); + sprintf(&date[6], " %02d:%.2s", i, (cpd+3)); } StrAllocCopy(entry_info->date, date); if (entry_info->date[4] == ' '|| entry_info->date[4] == '0') { @@ -2007,23 +1995,22 @@ PRIVATE void parse_cms_dir_entry ARGS2( if (*cpd == ' ') *cpd = '0'; i = atoi(cpd) - 1; - sprintf(date, "%s %s", months[i], (cpd+3)); + sprintf(date, "%.3s %.2s", months[i], (cpd+3)); if (date[4] == '0') date[4] = ' '; cpd += 6; /* Year */ if (strcmp((ThisYear+2), cpd)) { /* Not this year, so show the year. */ if (atoi(cpd) < 70) { - sprintf(&date[6], " 20%s", cpd); + sprintf(&date[6], " 20%.2s", cpd); } else { - sprintf(&date[6], " 19%s", cpd); + sprintf(&date[6], " 19%.2s", cpd); } } else { /* Is this year, so show the time. */ *(cps+2) = '\0'; /* Hour */ i = atoi(cps); - sprintf(&date[6], " %s%d:%s", - (i < 10 ? "0" : ""), i, (cps+3)); + sprintf(&date[6], " %02d:%.2s", i, (cps+3)); } StrAllocCopy(entry_info->date, date); if (entry_info->date[4] == ' '|| entry_info->date[4] == '0') { @@ -2432,7 +2419,7 @@ PRIVATE int compare_EntryInfo_structs ARGS2( } } i++; - sprintf(month, "%s%d", (i < 10 ? "0" : ""), i); + sprintf(month, "%02d", i); strcat(date1, month); strncat(date1, &entry1->date[4], 2); date1[8] = '\0'; @@ -2467,7 +2454,7 @@ PRIVATE int compare_EntryInfo_structs ARGS2( } } i++; - sprintf(month, "%s%d", (i < 10 ? "0" : ""), i); + sprintf(month, "%02d", i); strcat(date2, month); strncat(date2, &entry2->date[4], 2); date2[8] = '\0'; @@ -2931,8 +2918,8 @@ PUBLIC int HTFTPLoad ARGS4( /* Open connection for data: */ - sprintf(command, - "ftp://%d.%d.%d.%d:%d/",h0,h1,h2,h3,passive_port); + sprintf(command, "ftp://%d.%d.%d.%d:%d/", + h0, h1, h2, h3, passive_port); status = HTDoConnect(name, "FTP", passive_port, &data_soc); if (status < 0) { @@ -2955,6 +2942,7 @@ PUBLIC int HTFTPLoad ARGS4( { char *filename = HTParse(name, "", PARSE_PATH + PARSE_PUNCTUATION); char *fname = filename; /** Save for subsequent free() **/ + char *vmsname = NULL; BOOL binary; char *type = NULL; char *cp; @@ -3133,13 +3121,10 @@ PUBLIC int HTFTPLoad ARGS4( filename[i] = filename[(i+1)]; filename[i] = '\0'; CTRACE((tfp, "HTFTP: Trimmed '%s'\n", filename)); - cp = HTMake_VMS_name("", filename); + cp = HTVMS_name("", filename); CTRACE((tfp, "HTFTP: VMSized '%s'\n", cp)); if ((cp1=strrchr(cp, ']')) != NULL) { - cp1++; - for (i = 0; cp1[i]; i++) - filename[i] = cp1[i]; - filename[i] = '\0'; + strcpy(filename, ++cp1); CTRACE((tfp, "HTFTP: Filename '%s'\n", filename)); *cp1 = '\0'; status = send_cwd(cp); @@ -3178,22 +3163,16 @@ PUBLIC int HTFTPLoad ARGS4( strchr(cp, ']') == NULL) { cp1++; if (*cp1 != '\0') { - for (i = 0; cp1[i]; i++) - filename[i] = cp1[i]; - filename[i] = '\0'; + strcpy(filename, cp1); CTRACE((tfp, "HTFTP: Filename '%s'\n", filename)); - *cp1 = '\0'; - strcat(cp, "["); - strcat(cp, filename); - strcat(cp, "]"); - status = send_cwd(cp); + HTSprintf0(&vmsname, "%.*s[%s]", cp1-cp, cp, filename); + status = send_cwd(vmsname); if (status != 2) { - *cp1 = '\0'; - strcat(cp, "[000000]"); - status = send_cwd(cp); + HTSprintf(&vmsname, "%.*s[000000]", cp1-cp, cp); + status = send_cwd(vmsname); if (status != 2) { - *cp1 = '\0'; - status = send_cwd(cp); + HTSprintf(&vmsname, "%.*s", cp1-cp, cp); + status = send_cwd(vmsname); if (status != 2) { FREE(fname); init_help_message_cache(); @@ -3203,15 +3182,15 @@ PUBLIC int HTFTPLoad ARGS4( } } } else { - strcpy(cp, "000000"); - filename = cp; + HTSprintf0(&vmsname, "000000"); + filename = vmsname; } } } else if (0==strcmp(cp, (filename+1))) { status = send_cwd(cp); if (status != 2) { - strcat(cp, ":"); - status = send_cwd(cp); + HTSprintf0(&vmsname, "%s:", cp); + status = send_cwd(vmsname); if (status != 2) { FREE(fname); init_help_message_cache(); /* to free memory */ @@ -3220,8 +3199,8 @@ PUBLIC int HTFTPLoad ARGS4( return ((status < 0) ? status : -status); } } - strcpy(cp, "000000"); - filename = cp; + HTSprintf0(&vmsname, "000000"); + filename = vmsname; } } /** Trim trailing slash if filename is not the top directory **/ @@ -3420,6 +3399,7 @@ PUBLIC int HTFTPLoad ARGS4( } } FREE(fname); + FREE(vmsname); if (status != 1) { init_help_message_cache(); /* to free memory */ NETCLOSE(control->socket); @@ -3454,8 +3434,11 @@ listen: data_soc = status; } /* !ftp_passive */ +#if 0 /* no - this makes the data connection go away too soon (2.8.3dev.22) */ if ((status = send_cmd_nowait("QUIT")) == 1) outstanding++; +#endif + if (isDirectory) { if (server_type == UNIX_SERVER && !unsure_type && !strcmp(response_text, diff --git a/WWW/Library/Implementation/HTFTP.h b/WWW/Library/Implementation/HTFTP.h index 4ef22f2d..60168b61 100644 --- a/WWW/Library/Implementation/HTFTP.h +++ b/WWW/Library/Implementation/HTFTP.h @@ -21,7 +21,7 @@ extern int HTfileSortMethod; /* specifies the method of sorting */ -/* PUBLIC HTMake_VMS_name() +/* PUBLIC HTVMS_name() ** CONVERTS WWW name into a VMS name ** ON ENTRY: ** nn Node Name (optional) @@ -32,7 +32,7 @@ extern int HTfileSortMethod; /* specifies the method of sorting */ ** ** Bug: Returns pointer to static -- non-reentrant */ -PUBLIC char * HTMake_VMS_name PARAMS(( +PUBLIC char * HTVMS_name PARAMS(( CONST char * nn, CONST char * fn)); diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index 20cda536..e5596265 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -2210,7 +2210,7 @@ PUBLIC int HTLoadFile ARGS4( StrAllocCopy(anchor->content_encoding, "x-compress"); format = HTAtom_for("www/compressed"); } else if ((len > 3) && - !strcasecomp((char *)&vmsname[len - 2], "gz")) { + !strcasecomp(&vmsname[len - 2], "gz")) { if (vmsname[len - 3] == '.' || vmsname[len - 3] == '-' || vmsname[len - 3] == '_') { diff --git a/WWW/Library/Implementation/HTFinger.c b/WWW/Library/Implementation/HTFinger.c index f0255bb8..9f205e0c 100644 --- a/WWW/Library/Implementation/HTFinger.c +++ b/WWW/Library/Implementation/HTFinger.c @@ -107,7 +107,7 @@ PRIVATE void start_anchor ARGS1(CONST char *, href) PRIVATE int response ARGS5( - CONST char *, command, + char *, command, char *, sitename, HTParentAnchor *, anAnchor, HTFormat, format_out, diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index f92fcb49..389d1fd7 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -760,9 +760,7 @@ PRIVATE void interpret_cso_key ARGS5( if (0 == strncmp(key, "$(FID)", 6)) { sprintf(buf, "%d", fld->id); } else if (0 == strncmp(key, "$(FDESC)", 8)) { - sprintf(buf, "%s%s%s", fld->description, - ctx->public_override ? /***" "***/"" : "", - ctx->public_override ? /***fld->attributes***/"" : ""); + sprintf(buf, "%.2046s", fld->description); } else if (0 == strncmp(key, "$(FDEF)", 7)) { strcpy(buf, fld->defreturn ? " checked" : ""); } else if (0 == strncmp(key, "$(FNDX)", 7)) { diff --git a/WWW/Library/Implementation/HTLex.c b/WWW/Library/Implementation/HTLex.c index 64b113d8..dedf7bc9 100644 --- a/WWW/Library/Implementation/HTLex.c +++ b/WWW/Library/Implementation/HTLex.c @@ -119,10 +119,10 @@ PUBLIC char *lex_verbose ARGS1(LexItem, lex_item) case LEX_AT_SIGN: /* Address qualifier */ return "address qualifier '@'"; case LEX_ALPH_STR: /* Alphanumeric string */ - sprintf(msg, "alphanumeric string '%s'", HTlex_buffer); + sprintf(msg, "alphanumeric string '%.70s'", HTlex_buffer); return msg; case LEX_TMPL_STR: /* Template string */ - sprintf(msg, "template string '%s'", HTlex_buffer); + sprintf(msg, "template string '%.70s'", HTlex_buffer); return msg; default: return "UNKNOWN-LEX-ITEM"; diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 68457ffd..dcde38a3 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -229,7 +229,7 @@ PRIVATE BOOL initialize NOARGS ** Negative status indicates transmission error, socket closed. ** Positive status is an NNTP status. */ -PRIVATE int response ARGS1(CONST char *,command) +PRIVATE int response ARGS1(char *,command) { int result; char * p = response_text; @@ -358,10 +358,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( while (tries) { if (UserName == NULL) { - if ((msg = (char *)calloc(1, (strlen(host) + 30))) == NULL) { - outofmem(__FILE__, "HTHandleAuthInfo"); - } - sprintf(msg, gettext("Username for news host '%s':"), host); + HTSprintf0(&msg, gettext("Username for news host '%s':"), host); UserName = HTPrompt(msg, NULL); FREE(msg); if (!(UserName && *UserName)) { @@ -443,10 +440,7 @@ PRIVATE NNTPAuthResult HTHandleAuthInfo ARGS1( tries = 3; while (tries) { if (PassWord == NULL) { - if ((msg = (char *)calloc(1, (strlen(host) + 30))) == NULL) { - outofmem(__FILE__, "HTHandleAuthInfo"); - } - sprintf(msg, gettext("Password for news host '%s':"), host); + HTSprintf0(&msg, gettext("Password for news host '%s':"), host); PassWord = HTPromptPassword(msg); FREE(msg); if (!(PassWord && *PassWord)) { @@ -1698,10 +1692,12 @@ PRIVATE int read_list ARGS1(char *, arg) } /* if end of line */ } /* Loop over characters */ if (!listing) { + char *msg = NULL; START(HTML_DT); - sprintf(line, gettext("No matches for: %s"), arg); - PUTS(line); + HTSprintf0(&msg, gettext("No matches for: %s"), arg); + PUTS(msg); MAYBE_END(HTML_DT); + FREE(msg); } END(HTML_DLC); PUTC('\n'); @@ -2033,7 +2029,7 @@ PRIVATE int read_group ARGS3( } } } - sprintf(buffer, " [%s]", date); + sprintf(buffer, " [%.*s]", (int)(sizeof(buffer) - 4), date); PUTS(buffer); FREE(date); } @@ -2231,7 +2227,7 @@ PRIVATE int HTLoadNews ARGS4( StrAllocCopy(NewsHost, cp); } FREE(cp); - sprintf(command, "%s://%.*s/", + HTSprintf0(&NewsHREF, "%s://%.*s/", (post_wanted ? "newspost" : (reply_wanted ? @@ -2239,7 +2235,6 @@ PRIVATE int HTLoadNews ARGS4( (spost_wanted ? "snewspost" : "snewsreply"))), (int) sizeof(command) - 15, NewsHost); - StrAllocCopy(NewsHREF, command); /* ** If the SSL daemon is being used as a proxy, diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index 505ed74f..0671371c 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -93,30 +93,12 @@ PUBLIC unsigned long socks_bind_remoteAddr; /* for long Rbind */ ** On return, ** returns a negative status in the Unix way. */ -#ifndef PCNFS - -#ifdef VMS -#include <perror.h> -#ifndef errno -extern int errno; -#endif /* !errno */ -#endif /* VMS */ - -#ifndef VM -#ifndef VMS -#ifndef THINK_C #ifdef DECL_SYS_ERRLIST extern char *sys_errlist[]; /* see man perror on cernvax */ extern int sys_nerr; #endif /* DECL_SYS_ERRLIST */ -#endif /* !THINK_C */ -#endif /* !VMS */ -#endif /* !VM */ - -#endif /* !PCNFS */ - #ifdef _WINDOWS_NSL char host[512]; struct hostent *phost; /* Pointer to host - See netdb.h */ @@ -167,7 +149,7 @@ PUBLIC int HTioctl ARGS3( } ioctl_desc; if ((sdc = vaxc$get_sdc (d)) == 0) { - errno = EBADF; + set_errno(EBADF); return -1; } ioctl_desc.opt = UCX$C_IOCTL; @@ -186,11 +168,11 @@ PUBLIC int HTioctl ARGS3( ioctl_comm.addr = (char *)argp; status = sys$qiow (0, sdc, fun, iosb, 0, 0, 0, 0, 0, 0, p5, p6); if (!(status & 01)) { - errno = status; + set_errno(status); return -1; } if (!(iosb[0] & 01)) { - errno = iosb[0]; + set_errno(iosb[0]); return -1; } return 0; @@ -206,6 +188,7 @@ PUBLIC int HTioctl ARGS3( PUBLIC int HTInetStatus ARGS1( char *, where) { + int saved_errno = errno; #ifdef VMS #ifdef MULTINET SOCKET_ERRNO = vmserrno; @@ -253,6 +236,8 @@ PUBLIC int HTInetStatus ARGS1( #endif /* MULTINET */ #endif /* VMS */ + set_errno(saved_errno); + #ifdef VMS /* ** uerrno and errno happen to be zero if vmserrno <> 0 @@ -833,7 +818,7 @@ PUBLIC struct hostent * LYGetHostByName ARGS1( /* to detect cases when it doesn't get set although it should */ h_errno = -2; #endif - errno = 0; + set_errno(0); phost = gethostbyname(host); statuses.child_errno = errno; statuses.child_h_errno = h_errno; @@ -952,7 +937,7 @@ PUBLIC struct hostent * LYGetHostByName ARGS1( readret = read(pfd[0], &statuses, sizeof(statuses)); if (readret == sizeof(statuses)) { h_errno = statuses.child_h_errno; - errno = statuses.child_errno; + set_errno(statuses.child_errno); #ifdef HAVE_H_ERRNO if (statuses.h_errno_valid) { lynx_nsl_status = HT_H_ERRNO_VALID; @@ -1585,11 +1570,7 @@ PUBLIC int HTDoConnect ARGS4( int tries=0; #ifdef SOCKET_DEBUG_TRACE - { - int saved_errno = SOCKET_ERRNO; - HTInetStatus("this socket's first connect"); - errno = saved_errno; /* I don't trust HTInetStatus */ - } + HTInetStatus("this socket's first connect"); #endif /* SOCKET_DEBUG_TRACE */ ret = 0; while (ret <= 0) { @@ -1622,24 +1603,20 @@ PUBLIC int HTDoConnect ARGS4( #ifdef SOCKET_DEBUG_TRACE if (tries == 1) { - int saved_errno = SOCKET_ERRNO; HTInetStatus("this socket's first select"); - errno = saved_errno; /* I don't trust HTInetStatus */ } #endif /* SOCKET_DEBUG_TRACE */ - /* - ** If we suspend, then it is possible that select will be - ** interrupted. Allow for this possibility. - JED - */ - if ((ret == -1) && (errno == EINTR)) - continue; + /* + ** If we suspend, then it is possible that select will be + ** interrupted. Allow for this possibility. - JED + */ + if ((ret == -1) && (errno == EINTR)) + continue; #ifdef SOCKET_DEBUG_TRACE - if (ret < 0) { - int saved_errno = SOCKET_ERRNO; - HTInetStatus("failed select"); - errno = saved_errno; /* I don't trust HTInetStatus */ - } + if (ret < 0) { + HTInetStatus("failed select"); + } #endif /* SOCKET_DEBUG_TRACE */ /* ** Again according to the Sun and Motorola man pages for connect: @@ -1687,9 +1664,7 @@ PUBLIC int HTDoConnect ARGS4( else { #ifdef SOCKET_DEBUG_TRACE if (status < 0) { - int saved_errno = SOCKET_ERRNO; HTInetStatus("confirm-ready connect"); - errno = saved_errno; } #endif /* SOCKET_DEBUG_TRACE */ break; @@ -1725,9 +1700,7 @@ PUBLIC int HTDoConnect ARGS4( #endif /* UCX */ (SOCKET_ERRNO != EISCONN)) { #ifdef SOCKET_DEBUG_TRACE - int saved_errno = SOCKET_ERRNO; HTInetStatus("confirm-not-ready connect"); - errno = saved_errno; #endif /* SOCKET_DEBUG_TRACE */ break; } @@ -1746,9 +1719,7 @@ PUBLIC int HTDoConnect ARGS4( } #ifdef SOCKET_DEBUG_TRACE else if (status < 0) { - int saved_errno = SOCKET_ERRNO; - HTInetStatus("this socket's first and only connect"); - errno = saved_errno; /* I don't trust HTInetStatus */ + HTInetStatus("this socket's first and only connect"); } #endif /* SOCKET_DEBUG_TRACE */ #endif /* !__DJGPP__ */ @@ -1891,7 +1862,6 @@ PUBLIC int HTDoRead ARGS3( #if !defined(UCX) || !defined(VAXC) #ifdef UNIX while ((nb = SOCKET_READ (fildes, buf, nbyte)) == -1) { - int saved_errno = errno; if (errno == EINTR) continue; #ifdef ERESTARTSYS @@ -1899,7 +1869,6 @@ PUBLIC int HTDoRead ARGS3( continue; #endif /* ERESTARTSYS */ HTInetStatus("read"); - errno = saved_errno; /* our caller may check it */ break; } return nb; @@ -1922,7 +1891,7 @@ PUBLIC int HTDoRead ARGS3( */ if ((nb <= 0) && (errno == EPIPE)) { nb = 0; - errno = 0; + set_errno(0); } return nb; #endif /* UCX, BSN */ diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index 302fb7bf..f7a2dc9a 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -287,7 +287,7 @@ PRIVATE int HTLoadHTTP ARGS4 ( char *line_kept_clean; int real_length_of_line; BOOL extensions; /* Assume good HTTP server */ - char line[INIT_LINE_SIZE]; + char *linebuf = NULL; char temp[80]; BOOL first_Accept = TRUE; BOOL show_401 = FALSE; @@ -415,8 +415,7 @@ try_again: char * host = NULL; if ((host = HTParse(anAnchor->address, "", PARSE_HOST)) != NULL) { - sprintf(line, "Host: %s%c%c", host, CR,LF); - StrAllocCat(command, line); + HTSprintf(&command, "Host: %s%c%c", host, CR,LF); FREE(host); } @@ -446,53 +445,49 @@ try_again: } else { temp[0] = '\0'; } - sprintf(line, "%s%s%s", + HTSprintf0(&linebuf, "%s%s%s", (first_Accept ? "Accept: " : ", "), HTAtom_name(pres->rep), temp); - len += strlen(line); + len += strlen(linebuf); if (len > 252 && !first_Accept) { StrAllocCat(command, crlf); - sprintf(line, "Accept: %s%s", + HTSprintf0(&linebuf, "Accept: %s%s", HTAtom_name(pres->rep), temp); - len = strlen(line); + len = strlen(linebuf); } - StrAllocCat(command, line); + StrAllocCat(command, linebuf); first_Accept = FALSE; } } } - sprintf(line, "%s*/*;q=0.01%c%c", + HTSprintf(&command, "%s*/*;q=0.01%c%c", (first_Accept ? "Accept: " : ", "), CR, LF); - StrAllocCat(command, line); first_Accept = FALSE; len = 0; - sprintf(line, "Accept-Encoding: %s, %s%c%c", + HTSprintf(&command, "Accept-Encoding: %s, %s%c%c", "gzip", "compress", CR, LF); - StrAllocCat(command, line); if (language && *language) { - sprintf(line, "Accept-Language: %s%c%c", language, CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "Accept-Language: %s%c%c", language, CR, LF); } if (pref_charset && *pref_charset) { StrAllocCat(command, "Accept-Charset: "); - strcpy(line, pref_charset); - if (line[strlen(line)-1] == ',') - line[strlen(line)-1] = '\0'; - LYLowerCase(line); - if (strstr(line, "iso-8859-1") == NULL) - strcat(line, ", iso-8859-1;q=0.01"); - if (strstr(line, "us-ascii") == NULL) - strcat(line, ", us-ascii;q=0.01"); - StrAllocCat(command, line); - sprintf(line, "%c%c", CR, LF); - StrAllocCat(command, line); + StrAllocCopy(linebuf, pref_charset); + if (linebuf[strlen(linebuf)-1] == ',') + linebuf[strlen(linebuf)-1] = '\0'; + LYLowerCase(linebuf); + if (strstr(linebuf, "iso-8859-1") == NULL) + StrAllocCat(linebuf, ", iso-8859-1;q=0.01"); + if (strstr(linebuf, "us-ascii") == NULL) + StrAllocCat(linebuf, ", us-ascii;q=0.01"); + StrAllocCat(command, linebuf); + HTSprintf(&command, "%c%c", CR, LF); } #if 0 @@ -519,8 +514,7 @@ try_again: ** new-httpd@apache.org from Koen Holtman, Jan 1999. */ if (!do_post) { - sprintf(line, "Negotiate: trans%c%c", CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "Negotiate: trans%c%c", CR, LF); } #endif /* 0 */ @@ -531,29 +525,25 @@ try_again: ** Also send it as a Cache-Control header for HTTP/1.1. - FM */ if (reloading) { - sprintf(line, "Pragma: no-cache%c%c", CR, LF); - StrAllocCat(command, line); - sprintf(line, "Cache-Control: no-cache%c%c", CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "Pragma: no-cache%c%c", CR, LF); + HTSprintf(&command, "Cache-Control: no-cache%c%c", CR, LF); } if (LYUserAgent && *LYUserAgent) { char *cp = LYSkipBlanks(LYUserAgent); /* Won't send it at all if all blank - kw */ if (*cp != '\0') - sprintf(line, "User-Agent: %.*s%c%c", + HTSprintf(&command, "User-Agent: %.*s%c%c", INIT_LINE_SIZE-15, LYUserAgent, CR, LF); } else { - sprintf(line, "User-Agent: %s/%s libwww-FM/%s%c%c", + HTSprintf(&command, "User-Agent: %s/%s libwww-FM/%s%c%c", HTAppName ? HTAppName : "unknown", HTAppVersion ? HTAppVersion : "0.0", HTLibraryVersion, CR, LF); } - StrAllocCat(command, line); if (personal_mail_address && !LYNoFromHeader) { - sprintf(line, "From: %s%c%c", personal_mail_address, CR,LF); - StrAllocCat(command, line); + HTSprintf(&command, "From: %s%c%c", personal_mail_address, CR,LF); } if (!(LYUserSpecifiedURL || @@ -572,8 +562,7 @@ try_again: } else { StrAllocCat(command, cp); } - sprintf(line, "%c%c", CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "%c%c", CR, LF); } { @@ -635,8 +624,7 @@ try_again: ** If auth is not NULL nor zero-length, it's ** an Authorization header to be included. - FM */ - sprintf(line, "%s%c%c", auth, CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "%s%c%c", auth, CR, LF); CTRACE((tfp, "HTTP: Sending authorization: %s\n", auth)); } else if (auth && *auth == '\0') { /* @@ -727,8 +715,7 @@ try_again: ** an Authorization or Proxy-Authorization ** header to be included. - FM */ - sprintf(line, "%s%c%c", auth, CR, LF); - StrAllocCat(command, line); + HTSprintf(&command, "%s%c%c", auth, CR, LF); CTRACE((tfp, (auth_proxy ? "HTTP: Sending proxy authorization: %s\n" : "HTTP: Sending authorization: %s\n"), @@ -769,28 +756,24 @@ try_again: CTRACE((tfp, "HTTP: Doing post, content-type '%s'\n", anAnchor->post_content_type ? anAnchor->post_content_type : "lose")); - sprintf (line, "Content-type: %s%c%c", - anAnchor->post_content_type ? anAnchor->post_content_type - : "lose", CR, LF); - StrAllocCat(command, line); - { - int content_length; - if (!anAnchor->post_data) - content_length = 0; - else + HTSprintf(&command, "Content-type: %s%c%c", + anAnchor->post_content_type + ? anAnchor->post_content_type + : "lose", + CR, LF); /* * Ack! This assumes non-binary data! Icky! * */ - content_length = strlen (anAnchor->post_data); - sprintf (line, "Content-length: %d%c%c", - content_length, CR, LF); - StrAllocCat(command, line); - } + HTSprintf(&command, "Content-length: %d%c%c", + (anAnchor->post_data) + ? strlen (anAnchor->post_data) + : 0, + CR, LF); - StrAllocCat(command, crlf); /* Blank line means "end" of headers */ + StrAllocCat(command, crlf); /* Blank line means "end" of headers */ - StrAllocCat(command, anAnchor->post_data); + StrAllocCat(command, anAnchor->post_data); } else StrAllocCat(command, crlf); /* Blank line means "end" of headers */ @@ -810,6 +793,7 @@ try_again: #endif /* NOT_ASCII */ status = HTTP_NETWRITE(s, command, (int)strlen(command), handle); FREE(command); + FREE(linebuf); if (status <= 0) { if (status == 0) { CTRACE((tfp, "HTTP: Got status 0 in initial write\n")); @@ -1588,12 +1572,13 @@ try_again: sink, anAnchor); if (!target || target == NULL) { - char buffer[1024]; /* @@@@@@@@ */ + char *buffer = NULL; HTTP_NETCLOSE(s, handle); - sprintf(buffer, CANNOT_CONVERT_I_TO_O, + HTSprintf0(&buffer, CANNOT_CONVERT_I_TO_O, HTAtom_name(format_in), HTAtom_name(format_out)); _HTProgress (buffer); + FREE(buffer); status = -1; goto clean_up; } diff --git a/WWW/Library/Implementation/HTVMSUtils.c b/WWW/Library/Implementation/HTVMSUtils.c index d3333e5c..df8cda8a 100644 --- a/WWW/Library/Implementation/HTVMSUtils.c +++ b/WWW/Library/Implementation/HTVMSUtils.c @@ -299,78 +299,6 @@ int dir; } -/* PUBLIC HTVMS_name() -** CONVERTS WWW name into a VMS name -** ON ENTRY: -** nn Node Name (optional) -** fn WWW file name -** -** ON EXIT: -** returns vms file specification -** -** Bug: Returns pointer to static -- non-reentrant -*/ -PUBLIC char * HTVMS_name ARGS2( - CONST char *, nn, - CONST char *, fn) -{ - -/* We try converting the filename into Files-11 syntax. That is, we assume -** first that the file is, like us, on a VMS node. We try remote -** (or local) DECnet access. Files-11, VMS, VAX and DECnet -** are trademarks of Digital Equipment Corporation. -** The node is assumed to be local if the hostname WITHOUT DOMAIN -** matches the local one. @@@ -*/ - static char vmsname[INFINITY]; /* returned */ - char * filename = (char*)malloc(strlen(fn)+1); - char * nodename = (char*)malloc(strlen(nn)+2+1); /* Copies to hack */ - char *second; /* 2nd slash */ - char *last; /* last slash */ - - char * hostname = (char *)HTHostName(); - - if (!filename || !nodename) outofmem(__FILE__, "HTVMSname"); - strcpy(filename, fn); - strcpy(nodename, ""); /* On same node? Yes if node names match */ - if (strncmp(nn,"localhost",9)) { - char *p, *q; - for (p=hostname, q=(char *)nn; - *p && *p!='.' && *q && *q!='.'; p++, q++){ - if (TOUPPER(*p)!=TOUPPER(*q)) { - strcpy(nodename, nn); - q = strchr(nodename, '.'); /* Mismatch */ - if (q) *q=0; /* Chop domain */ - strcat(nodename, "::"); /* Try decnet anyway */ - break; - } - } - } - - second = strchr(filename+1, '/'); /* 2nd slash */ - last = strrchr(filename, '/'); /* last slash */ - - if (!second) { /* Only one slash */ - sprintf(vmsname, "%s%s", nodename, filename + 1); - } else if(second==last) { /* Exactly two slashes */ - *second = 0; /* Split filename from disk */ - sprintf(vmsname, "%s%s:%s", nodename, filename+1, second+1); - *second = '/'; /* restore */ - } else { /* More than two slashes */ - char * p; - *second = 0; /* Split disk from directories */ - *last = 0; /* Split dir from filename */ - sprintf(vmsname, "%s%s:[%s]%s", - nodename, filename+1, second+1, last+1); - *second = *last = '/'; /* restore filename */ - for (p=strchr(vmsname, '['); *p!=']'; p++) - if (*p=='/') *p='.'; /* Convert dir sep. to dots */ - } - FREE(nodename); - FREE(filename); - return vmsname; -} - /* ** The code below is for directory browsing by VMS Curses clients. ** It is based on the newer WWWLib's HTDirBrw.c. - Foteos Macrides @@ -797,7 +725,7 @@ PUBLIC int compare_VMSEntryInfo_structs ARGS2(VMSEntryInfo *,entry1, } } i++; - sprintf(month, "%s%d", (i < 10 ? "0" : ""), i); + sprintf(month, "%02d", i); strcat(date1, month); strncat(date1, (char *)&entry1->date[4], 2); date1[8] = '\0'; @@ -820,7 +748,7 @@ PUBLIC int compare_VMSEntryInfo_structs ARGS2(VMSEntryInfo *,entry1, } } i++; - sprintf(month, "%s%d", (i < 10 ? "0" : ""), i); + sprintf(month, "%02d", i); strcat(date2, month); strncat(date2, (char *)&entry2->date[4], 2); date2[8] = '\0'; @@ -1007,10 +935,7 @@ PUBLIC int HTVMSBrowseDir ARGS4( } FREE(header); if (parent) { - relative = (char*) malloc(strlen(tail) + 4); - if (relative == NULL) - outofmem(__FILE__, "HTVMSBrowseDir"); - sprintf(relative, "%s/..", tail); + HTSprintf0(&relative, "%s/..", tail); HTStartAnchor(target, "", relative); PUTS("Up to "); HTUnEscape(parent); diff --git a/WWW/Library/Implementation/HTVMSUtils.h b/WWW/Library/Implementation/HTVMSUtils.h index 9bcff503..6eb55ca6 100644 --- a/WWW/Library/Implementation/HTVMSUtils.h +++ b/WWW/Library/Implementation/HTVMSUtils.h @@ -89,21 +89,6 @@ PUBLIC BOOL HTVMS_checkAccess PARAMS(( PUBLIC char * HTVMS_wwwName PARAMS(( CONST char * vmsname)); -/* PUBLIC HTVMS_name() -** CONVERTS WWW name into a VMS name -** ON ENTRY: -** nn Node Name (optional) -** fn WWW file name -** -** ON EXIT: -** returns vms file specification -** -** Bug: Returns pointer to static -- non-reentrant -*/ -PUBLIC char * HTVMS_name PARAMS(( - CONST char * nn, - CONST char * fn)); - PUBLIC int HTStat PARAMS(( CONST char * filename, struct stat * info)); diff --git a/WWW/Library/Implementation/HTWAIS.c b/WWW/Library/Implementation/HTWAIS.c index 92a8b3b0..ad6f73ba 100644 --- a/WWW/Library/Implementation/HTWAIS.c +++ b/WWW/Library/Implementation/HTWAIS.c @@ -124,21 +124,22 @@ PRIVATE int fd_mosaic_connect_to_server ARGS3( long, port, long *, fd) { - /* - ** New version. - */ - char dummy[256]; + char *dummy = NULL; int status; + int result; - sprintf (dummy, "wais://%s:%d/", host_name, port); + HTSprintf0(&dummy, "wais://%s:%d/", host_name, port); status = HTDoConnect (dummy, "WAIS", 210, (int *)fd); if (status == HT_INTERRUPTED) { - return -1; + result = -1; + } else if (status < 0) { + result = 0; + } else { + result = 1; } - if (status < 0) - return 0; - return 1; + FREE(dummy); + return result; } /* Returns 1 on success, 0 on fail, -1 on interrupt. */ @@ -526,21 +527,24 @@ PRIVATE void display_search_response ARGS4( } else { /* Not archie */ docname = WWW_from_WAIS(docid); if (docname) { - char * dbname = HTEscape(database, URL_XPALPHAS); - sprintf(line, - "/%s/%s/%d/%s", /* W3 address */ - dbname, - head->Types ? head->Types[0] : "TEXT", - (int)(head->DocumentLength), - docname); - HTStartAnchor(target, NULL, - ((head->Types) && - (!strcmp(head->Types[0], "URL"))) - ? - headline : line); /* NT, Sep 93 */ + if ((head->Types) && + (!strcmp(head->Types[0], "URL"))) { + HTStartAnchor(target, NULL, headline); + } else{ + char * dbname = HTEscape(database, URL_XPALPHAS); + char * w3_address = NULL; + HTSprintf0(&w3_address, + "/%s/%s/%d/%s", + dbname, + head->Types ? head->Types[0] : "TEXT", + (int)(head->DocumentLength), + docname); + HTStartAnchor(target, NULL, w3_address); + FREE(w3_address); + FREE(dbname); + } PUTS(headline); END(HTML_A); - FREE(dbname); FREE(docname); } else { PUTS(gettext("(bad doc id)")); @@ -753,7 +757,7 @@ PUBLIC int HTLoadWAIS ARGS4( */ if (key && !*key) { /* I N D E X */ #ifdef CACHE_FILE_PREFIX - char filename[256]; + char * filename = NULL; FILE * fp; #endif HTStructured * target = HTML_new(anAnchor, format_out, sink); @@ -790,7 +794,7 @@ PUBLIC int HTLoadWAIS ARGS4( ** If we have seen a source file for this database, use that. */ #ifdef CACHE_FILE_PREFIX - sprintf(filename, "%sWSRC-%s:%s:%.100s.txt", + HTSprintf0(&filename, "%sWSRC-%s:%s:%.100s.txt", CACHE_FILE_PREFIX, server_name, service, www_database); @@ -807,6 +811,7 @@ PUBLIC int HTLoadWAIS ARGS4( END(HTML_PRE); fclose(fp); } + FREE(filename); #endif START(HTML_P); PUTS(gettext("\nEnter the 's'earch command and then specify search words.\n")); diff --git a/WWW/Library/Implementation/HTWSRC.c b/WWW/Library/Implementation/HTWSRC.c index 7e1d899c..4fca40ca 100644 --- a/WWW/Library/Implementation/HTWSRC.c +++ b/WWW/Library/Implementation/HTWSRC.c @@ -244,28 +244,32 @@ PRIVATE void WSRCParser_put_character ARGS2(HTStream*, me, char, c) PRIVATE BOOL write_cache ARGS1(HTStream *, me) { FILE * fp; - char cache_file_name[LY_MAXPATH]; + char * cache_file_name = NULL; char * www_database; + int result = NO; + if (!me->par_value[PAR_DATABASE_NAME] || !me->par_value[PAR_IP_NAME] ) return NO; www_database = HTEscape(me->par_value[PAR_DATABASE_NAME], URL_XALPHAS); - sprintf(cache_file_name, "%sWSRC-%s:%s:%.100s.txt", + HTSprintf0(&cache_file_name, "%sWSRC-%s:%s:%.100s.txt", CACHE_FILE_PREFIX, me->par_value[PAR_IP_NAME], me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] : "210", www_database); + + if ((fp = fopen(cache_file_name, "w")) != 0) { + result = YES; + if (me->par_value[PAR_DESCRIPTION]) + fputs(me->par_value[PAR_DESCRIPTION], fp); + else + fputs("Description not available\n", fp); + fclose(fp); + } FREE(www_database); - fp = fopen(cache_file_name, "w"); - if (!fp) return NO; - - if (me->par_value[PAR_DESCRIPTION]) - fputs(me->par_value[PAR_DESCRIPTION], fp); - else - fputs("Description not available\n", fp); - fclose(fp); - return YES; + FREE(cache_file_name); + return result; } #endif @@ -329,11 +333,11 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) if (me->par_value[PAR_IP_NAME] && me->par_value[PAR_DATABASE_NAME]) { - char WSRC_address[256]; + char * WSRC_address = NULL; char * www_database; www_database = HTEscape(me->par_value[PAR_DATABASE_NAME], URL_XALPHAS); - sprintf(WSRC_address, "wais://%s%s%s/%s", + HTSprintf0(&WSRC_address, "wais://%s%s%s/%s", me->par_value[PAR_IP_NAME], me->par_value[PAR_TCP_PORT] ? ":" : "", me->par_value[PAR_TCP_PORT] ? me->par_value[PAR_TCP_PORT] :"", @@ -346,6 +350,7 @@ PRIVATE void WSRC_gen_html ARGS2(HTStream *, me, BOOL, source_file) PUTS(gettext(" (or via proxy server, if defined)")); FREE(www_database); + FREE(WSRC_address); } else { give_parameter(me, PAR_IP_NAME); diff --git a/WWW/Library/Implementation/www_tcp.h b/WWW/Library/Implementation/www_tcp.h index 4048d7cf..85ac581e 100644 --- a/WWW/Library/Implementation/www_tcp.h +++ b/WWW/Library/Implementation/www_tcp.h @@ -491,6 +491,11 @@ struct timeval { #endif /* __GNUC__ */ #endif /* VAXC && !DECC */ +#include <perror.h> +#ifndef errno +extern int errno; +#endif /* !errno */ + #endif /* VMS */ /* @@ -641,7 +646,7 @@ typedef int pid_t; #else -#if !(defined(VM) || defined(VMS) || defined(THINK_C) || defined(__MINGW32__)) +#if !(defined(VM) || defined(VMS) || defined(THINK_C) || defined(PCNFS) || defined(__MINGW32__)) #define DECL_SYS_ERRLIST 1 #endif @@ -771,5 +776,13 @@ typedef unsigned int fd_set; #endif /* !FD_SET */ #endif /* SELECT */ +/* + * Macro for setting errno - only define this if you really can do it. + */ +#if !defined(errno) && (!defined(VMS) || defined(UCX)) +#define set_errno(value) errno = value +#else +#define set_errno(value) /* we do not know how */ +#endif #endif /* TCP_H */ |