diff options
Diffstat (limited to 'WWW')
-rw-r--r-- | WWW/BUILD | 42 | ||||
-rw-r--r-- | WWW/Copyright.txt | 22 | ||||
-rw-r--r-- | WWW/FreeofCharge.html | 26 | ||||
-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 | ||||
-rw-r--r-- | WWW/Makefile | 9 | ||||
-rw-r--r-- | WWW/README.txt | 208 |
21 files changed, 227 insertions, 619 deletions
diff --git a/WWW/BUILD b/WWW/BUILD deleted file mode 100644 index 5fda9e0e..00000000 --- a/WWW/BUILD +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/csh -# Build all WWW Code for this platform -# -# Figure out what sort of unix this is -# (NeXT machines don't have uname!) - -set UNAME=NeXT -if (-e /usr/bin/uname) set UNAME=`/usr/bin/uname` -if (-e /bin/uname) set UNAME=`/bin/uname` -if (-e /usr/apollo/bin) set UNAME=`ver sys5.3 /bin/uname` -if ( $UNAME == "" ) then - if (-r /NextApps ) set UNAME=next -endif -# -setenv UNAME $UNAME -# For apollo, must use bsd mode. Also, WWW_MACH not inherited through make! -if ($UNAME == "DomainOS") setenv WWW_MACH apollo_m68k -if ($UNAME == next) setenv WWW_MACH next -if ($UNAME == "HP-UX") setenv WWW_MACH snake -if ($UNAME == "IRIX") setenv WWW_MACH sgi -if ($UNAME == "SunOS") setenv WWW_MACH sun4 -if ($UNAME == "ULTRIX") setenv WWW_MACH decstation -if ($UNAME == "AIX") setenv WWW_MACH rs6000 -if ($UNAME == "OSF1") setenv WWW_MACH osf1 - -if ($WWW_MACH == "") then - echo "Please edit BUILD file to include your machine OS" - echo "and mail differences back to www-bug@info.cern.ch - exit -99 -endif -echo "________________________________________________________________" -echo "WWW build for machine type: " $WWW_MACH - -# Now go do build - -# We don't want SHELL set to something funny to screw up make - -(cd All/Implementation; unsetenv SHELL; make) -set stat = $status -echo -echo "WWW build for " $WWW_MACH " done. status = " $stat -exit $stat diff --git a/WWW/Copyright.txt b/WWW/Copyright.txt deleted file mode 100644 index 3d7397bb..00000000 --- a/WWW/Copyright.txt +++ /dev/null @@ -1,22 +0,0 @@ - Copyright -- /hypertext - COPYRIGHT CERN 1990-1993 - - Except where specifically placed in the public domain, the information (of - all forms) in these directories is the intellectual property of the European - Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is - provided by CERN. No liability whatsoever is accepted for any loss or damage - of any kind resulting from any defect or inaccuracy in this information or - code. - - The conditions for public domain and other access to the code are defined in - distribution conditions of WWW code[1] - - Tim Berners-Lee[2] - - CERN - - 1211 Geneva 23, Switzerland - - Tel +41(22)767 3755, Fax +41(22)767 7155, Email: tbl@cernvax.cern.ch - - diff --git a/WWW/FreeofCharge.html b/WWW/FreeofCharge.html new file mode 100644 index 00000000..67cb3f20 --- /dev/null +++ b/WWW/FreeofCharge.html @@ -0,0 +1,26 @@ +<!-- X-URL: http://www.w3.org/History/1993/WWW/Conditions/old/FreeofCharge.html --> +<BASE HREF="http://www.w3.org/History/1993/WWW/Conditions/old/FreeofCharge.html"> + +<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> + +<HTML><HEAD><TITLE> +CERN WWW software freely available</TITLE><NEXTID N="z9"></HEAD><BODY><H1> +Software freely available</H1>The following CERN software is hereby put into +the public domain. +<UL> +<LI>WWW basic ("line-mode") client <LI>WWW basic server <LI>WWW Library of +common code.</UL>CERN relinquishes all intellectual property rights to this +code, both source and binary form and permission is granted for anyone to use, +duplicate, +modify and redistribute it.<P>CERN provides absolutely NO WARRANTY OF ANY KIND +with respect to this software. +The entire risk as to the quality and performance of this software is with the +user. +IN NO EVENT WILL CERN BE LIABLE TO ANYONE FOR ANY DAMAGES ARISING OUT THE USE +OF THIS SOFTWARE, INCLUDING, WITHOUT LIMITATION, +DAMAGES RESULTING FROM LOST DATA OR LOST PROFITS, OR FOR ANY SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES.<P>This is part of the <A +HREF="Introduction.html" NAME="z8"> +CERN WWW</A> distribution condidtions.<P>Declaration to this effect signed by +the CERN directors of Administration (H. Weber) and Research (W. +Hoogland), May 1993.</BODY></HTML> 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 */ diff --git a/WWW/Makefile b/WWW/Makefile deleted file mode 100644 index 41a90056..00000000 --- a/WWW/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# Make basic WWW distribution -# -# See the README and the documentation on the web. -# When you have done BUILD you will have www so you will be able to -# read the documentation online. -# -all : - BUILD - diff --git a/WWW/README.txt b/WWW/README.txt deleted file mode 100644 index be7e3e96..00000000 --- a/WWW/README.txt +++ /dev/null @@ -1,208 +0,0 @@ - Read Me - WORLDWIDEWEB CERN-DISTRIBUTED CODE - - See the CERN copyright[1] . This is the README file which you get when you - unwrap one of our tar files. These files contain information about - hypertext, hypertext systems, and the WorldWideWeb project. If you have - taken this with a .tar file, you will have only a subset of the files. - - THIS FILE IS A VERY ABRIDGED VERSION OF THE INFORMATION AVAILABLE ON THE - WEB. IF IN DOUBT, READ THE WEB DIRECTLY. If you have not got ANY browser - installed yet, do this by telnet to info.cern.ch (no username or password). - - Files from info.cern.ch are also mirrored on ftp.ripe.net. - -Archive Directory structure - - Under /pub/www[2] , besides this README file, you'll find bin[3] , src[4] - and doc[5] directories. The main archives are as follows: - - bin/xxx/bbbb Executable binaries of program bbbb for system xxx. - Check what's there before you bother compiling. (Note - HP700/8800 series is "snake") - - bin/next/WorldWideWeb_v.vv.tar.Z - The Hypertext Browser/editor for the NeXT -- binary. - - src/WWWLibrary_v.vv.tar.Z - The W3 Library. All source, and Makefiles for - selected systems. - - src/WWWLineMode_v.vv.tar.Z - The Line mode browser - all source, and Makefiles for - selected systems. Requires the Library[6] . - - src/WWWDaemon_v.vv.tar.Z - The HTTP daemon, and WWW-WAIS gateway programs. - Source. Requires the Library. - - src/WWWMailRobot_v.vv.tar.Z - The Mail Robot. - - doc/WWWBook.tar.Z A snapshot of our internal documentation - we prefer - you to access this on line -- see warnings below. - -Basic WWW software installation from source - - This applies to the line mode client and the server. Below, $prod means - LineMode or Daemon depending on which you are building. - - GENERATED DIRECTORY STRUCTURE - - The tar files are all designed to be unwrapped in the same (this) directory. - They create different parts of a common directory tree under that directory. - There may be some duplication. They also generate a few files in this - directory: README.*, Copyright.*, and some installation instructions (.txt). - - The directory structure is, for product $prod and machine $WWW_MACH - - WWW/$prod/Implementation - Source files for a given product - - WWW/$prod/Implementation/CommonMakefile - The machine-independent parts of the Makefile for this - product - - - Read Me (65/66) - WWW/$prod/$WWW_MACH/ Area for compiling for a given system - - WWW/All/$WWW_MACH/Makefile.include - The machine-dependent parts of the makefile for any - product - - WWW/All/Implementation/Makefile.product - A makefile which includes both parts above and so can - be used from any product, any machine. - - COMPILATION ON ALREADY SUPPORTED PLATFORMS - - You must get the WWWLibrary tar file as well as the products you want and - unwrap them all from the same directory. - - You must define the environmant variable WWW_MACH to be the architecure of - your machine (sun4, decstation, rs6000, sgi, snake, etc) - - In directory WWW, type BUILD. - - COMPILATION ON NEW PLATFORMS - - If your machine is not on the list: - - Make up a new subdirectory of that name under WWW/$prod and WWW/All, - copying the contents of a basically similar architecture's directory. - - Check the WWW/All/$WWW_MACH/Makefile.include for suitable directory and - flag definitions. - - Check the file www_tcp.h for the system-specific include file - coordinates, etc. - - Send any changes you have to make back to www-request@info.cern.ch for - inclusion into future releases. - - Once you have this set up, type BUILD. - -NeXTStep Browser/Editor - - The browser for the NeXT is those files contained in the application - directory WWW/Next/Implementation/WorldWideWeb.app and is compiled. When you - install the app, you may want to configure the default page, - WorldWideWeb.app/default.html. These must point to some useful information! - You should keep it up to date with pointers to info on your site and - elsewhere. If you use the CERN home page note there is a link at the bottom - to the master copy on our server. You should set up the address of your - local news server with - - dwrite WorldWideWeb NewsHost news - - replacing the last word with the actual address of your news host. See - Installation instructions[7] . - -Line Mode browser - - Binaries of this for some systems are available in /pub/www/bin/ . The - binaries can be picked up, set executable, and run immediately. - - If there is no binary, see "Installation from source" above. - - (See Installation notes[8] ). Do the same thing (in the same directory) to - the WWWLibrary_v.cc.tar.Z file to get the common library. - - - Read Me (65/130) - You will have an ASCII printable manual in the file - WWW/LineMode/Defaults/line-mode-guide.txt which you can print out at this - stage. This is a frozen copy of some of the online documentation. - - Whe you install the browser, you may configure a default page. This is - /usr/local/lib/WWW/default.html for the line mode browser. This must point - to some useful information! You should keep it up to date with pointers to - info on your site and elsewhere. If you use the CERN home page note there is - a link at the bottom to the master copy on our server. - - Some basic documentation on the browser is delivered with the home page in - the directory WWW/LineMode/Defaults. A separate tar file of that directory - (WWWLineModeDefaults.tar.Z) is available if you just want to update that. - - The rest of the documentation is in hypertext, and so wil be readable most - easily with a browser. We suggest that after installing the browser, you - browse through the basic documentation so that you are aware of the options - and customisation possibilities for example. - -Server - - The server can be run very simply under the internet daemon, to export a - file directory tree as a browsable hypertext tree. Binaries are avilable - for some platofrms, otherwise follow instructions above for compiling and - then go on to " Installing the basic W3 server[9] ". - -XMosaic - - XMosaic is an X11/Motif W3 browser. - - The sources and binaries are distributed separately from - FTP.NCSA.UIUC.EDU[10] , in /Web/xmosaic[11] . Binaries are available for - some platforms. If you have to build from source, check the README in the - distribution. - - The binaries can be picked up, uncompressed, set "executable" and run - immediately. - -Viola browser for X11 - - Viola is an X11 application for reading global hypertext. If a binary is - available from your machine, in /pub/www/bin/.../viola*, then take that and - also the Viola "apps" tar file which contains the scripts you will need. - - To generate this from source, you will need both the W3 library and the - Viola source files. There is an Imakefile with the viola source directory. - You will need to generate the XPA and XPM libraries and the W3 library - befere you make viola itself. - -Documentation - - In the /pub/www/doc[12] directory are a number articles, preprints and - guides on the web. - - See the online WWW bibliography[13] for a list of these and other articles, - books, etc. and also the list of WWW Manuals[14] available in text and - postscript form. - -General - - Your comments will of course be most appreciated, on code, or information on - the web which is out of date or misleading. If you write your own hypertext - and make it available by anonymous ftp or using a server, tell us and we'll - put some pointers to it in ours. Thus spreads the web... - - Read Me (66/195) - Tim Berners-Lee - - WorldWideWeb project - - CERN, 1211 Geneva 23, Switzerland - - Tel: +41 22 767 3755; Fax: +41 22 767 7155; email: timbl@info.cern.ch - - |