CVS update: php3/functions
| From: | steinm | Date: | Fri, 16 Apr 1999 12:19:02 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5098@lists.php.net to get a copy of this message | ||
Date: Friday April 16, 1999 @ 8:19
Author: steinm
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv5898/functions
Modified Files:
hg_comm.c
Log Message:
- more sprint by snprint replacements
Index: php3/functions/hg_comm.c
diff -c php3/functions/hg_comm.c:1.17 php3/functions/hg_comm.c:1.18
*** php3/functions/hg_comm.c:1.17 Fri Apr 16 08:09:49 1999
--- php3/functions/hg_comm.c Fri Apr 16 08:19:01 1999
***************
*** 23,29 ****
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.17 1999/04/16 12:09:49 steinm Exp $ */
/* #define HW_DEBUG */
--- 23,29 ----
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.18 1999/04/16 12:19:01 steinm Exp $ */
/* #define HW_DEBUG */
***************
*** 457,465 ****
* DList *pAnchorList: list of anchors *
* Return: Text with anchors *
***********************************************************************/
char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag) {
ANCHOR *cur_ptr;
! char bgstr[100], istr[200];
char *scriptname;
char *newtext;
int offset = 0;
--- 457,466 ----
* DList *pAnchorList: list of anchors *
* Return: Text with anchors *
***********************************************************************/
+ #define BUFFERLEN 200
char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag) {
ANCHOR *cur_ptr;
! char bgstr[BUFFERLEN], istr[BUFFERLEN];
char *scriptname;
char *newtext;
int offset = 0;
***************
*** 495,551 ****
/* The link is only set if the Link points to an external document */
switch(cur_ptr->linktype) {
case HW_BACKGROUND_LINK:
! sprintf(bgstr, " background='%s'", cur_ptr->link);
break;
case HW_INTAG_LINK:
! sprintf(istr, " %s='%s' start=%d", cur_ptr->tagattr,
cur_ptr->link, cur_ptr->start);
offset -= 4; /* because there is no closing tag </A> */
/* laststart = cur_ptr->start; */
break;
case HW_APPLET_LINK:
if(cur_ptr->codebase)
! sprintf(istr, " CODEBASE='%s' CODE='%s'",
cur_ptr->codebase, cur_ptr->code);
else
! sprintf(istr, " CODEBASE='/' CODE='%s'", cur_ptr->code);
break;
default:
newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
! sprintf(istr, "<A HREF='%s' %s offset=%d>", cur_ptr->link,
cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr, offset);
}
} else {
switch(cur_ptr->linktype) {
case HW_BACKGROUND_LINK:
if(NULL != cur_ptr->destdocname)
! sprintf(bgstr, " background='%s/%s'", scriptname == NULL ? ""
: scriptname, cur_ptr->destdocname);
else
bgstr[0] = '\0';
break;
case HW_INTAG_LINK:
if(cur_ptr->fragment)
! /* sprintf(istr, " %s='%s/%s#%s'", cur_ptr->tagattr, scriptname ==
NULL ? "." : scriptname, cur_ptr->destdocname, cur_ptr->fragment);*/
! sprintf(istr, " %s='#%s'", cur_ptr->tagattr, cur_ptr->fragment);
else
! sprintf(istr, " %s='%s/%s'", cur_ptr->tagattr, scriptname == NULL ?
"." : scriptname, cur_ptr->destdocname);
offset -= 4; /* because there is no closing tag </A> */
/* laststart = cur_ptr->start; */
break;
case HW_APPLET_LINK:
if(cur_ptr->codebase)
! /* sprintf(istr, " CODEBASE='%s%s' CODE='%s'", scriptname ==
NULL ? "" : scriptname, cur_ptr->codebase, cur_ptr->code); */
! sprintf(istr, " CODEBASE='%s' CODE='%s'",
cur_ptr->codebase, cur_ptr->code);
else
! sprintf(istr, " CODEBASE='/' CODE='%s'", cur_ptr->code);
break;
default:
newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
if(cur_ptr->nameanchor)
! sprintf(istr, "<A HREF='%s/%s#%s' %s>", scriptname == NULL ?
"schade" : scriptname, cur_ptr->destdocname, cur_ptr->nameanchor,
cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr);
else
if(cur_ptr->fragment)
! sprintf(istr, "<A HREF='%s/%s#%s' %s>", scriptname == NULL ?
"" : scriptname, cur_ptr->destdocname, cur_ptr->fragment, cur_ptr->htmlattr ==
NULL ? "" : cur_ptr->htmlattr);
else
! sprintf(istr, "<A HREF='%s/%s' %s offset=%d>", scriptname == NULL
? "" : scriptname, cur_ptr->destdocname, cur_ptr->htmlattr == NULL ? "" :
cur_ptr->htmlattr, offset);
}
}
newtext = fnInsStr(newtext, cur_ptr->start, istr);
--- 496,552 ----
/* The link is only set if the Link points to an external document */
switch(cur_ptr->linktype) {
case HW_BACKGROUND_LINK:
! snprintf(bgstr, BUFFERLEN, " background='%s'", cur_ptr->link);
break;
case HW_INTAG_LINK:
! snprintf(istr, BUFFERLEN, " %s='%s' start=%d", cur_ptr->tagattr,
cur_ptr->link, cur_ptr->start);
offset -= 4; /* because there is no closing tag </A> */
/* laststart = cur_ptr->start; */
break;
case HW_APPLET_LINK:
if(cur_ptr->codebase)
! snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'",
cur_ptr->codebase, cur_ptr->code);
else
! snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'",
cur_ptr->code);
break;
default:
newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
! snprintf(istr, BUFFERLEN, "<A HREF='%s' %s offset=%d>",
cur_ptr->link, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr, offset);
}
} else {
switch(cur_ptr->linktype) {
case HW_BACKGROUND_LINK:
if(NULL != cur_ptr->destdocname)
! snprintf(bgstr, BUFFERLEN, " background='%s/%s'", scriptname == NULL ?
"" : scriptname, cur_ptr->destdocname);
else
bgstr[0] = '\0';
break;
case HW_INTAG_LINK:
if(cur_ptr->fragment)
! /* snprintf(istr, BUFFERLEN, " %s='%s/%s#%s'", cur_ptr->tagattr,
scriptname == NULL ? "." : scriptname, cur_ptr->destdocname, cur_ptr->fragment);*/
! snprintf(istr, BUFFERLEN, " %s='#%s'", cur_ptr->tagattr,
cur_ptr->fragment);
else
! snprintf(istr, BUFFERLEN, " %s='%s/%s'", cur_ptr->tagattr,
scriptname == NULL ? "." : scriptname, cur_ptr->destdocname);
offset -= 4; /* because there is no closing tag </A> */
/* laststart = cur_ptr->start; */
break;
case HW_APPLET_LINK:
if(cur_ptr->codebase)
! /* snprintf(istr, BUFFERLEN, " CODEBASE='%s%s' CODE='%s'",
scriptname == NULL ? "" : scriptname, cur_ptr->codebase, cur_ptr->code); */
! snprintf(istr, BUFFERLEN, " CODEBASE='%s' CODE='%s'",
cur_ptr->codebase, cur_ptr->code);
else
! snprintf(istr, BUFFERLEN, " CODEBASE='/' CODE='%s'",
cur_ptr->code);
break;
default:
newtext = fnInsStr(newtext, cur_ptr->end+offset, "</A>");
if(cur_ptr->nameanchor)
! snprintf(istr, BUFFERLEN, "<A HREF='%s/%s#%s' %s>", scriptname ==
NULL ? "schade" : scriptname, cur_ptr->destdocname, cur_ptr->nameanchor,
cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr);
else
if(cur_ptr->fragment)
! snprintf(istr, BUFFERLEN, "<A HREF='%s/%s#%s' %s>", scriptname ==
NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->fragment,
cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr);
else
! snprintf(istr, BUFFERLEN, "<A HREF='%s/%s' %s offset=%d>",
scriptname == NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->htmlattr ==
NULL ? "" : cur_ptr->htmlattr, offset);
}
}
newtext = fnInsStr(newtext, cur_ptr->start, istr);
***************
*** 562,570 ****
instead of the destdocname
*/
if(cur_ptr->keyword)
! sprintf(istr, "<A NAME='%s'>", cur_ptr->keyword);
else if(cur_ptr->nameanchor)
! sprintf(istr, "<A NAME='%s'>", cur_ptr->nameanchor);
newtext = fnInsStr(newtext, cur_ptr->start, istr);
/* In case there are several TAGS nested, we accumulate the offset
You wonder what the 4 means? It's the length of </A> */
--- 563,571 ----
instead of the destdocname
*/
if(cur_ptr->keyword)
! snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->keyword);
else if(cur_ptr->nameanchor)
! snprintf(istr, BUFFERLEN, "<A NAME='%s'>", cur_ptr->nameanchor);
newtext = fnInsStr(newtext, cur_ptr->start, istr);
/* In case there are several TAGS nested, we accumulate the offset
You wonder what the 4 means? It's the length of </A> */
***************
*** 573,582 ****
}
cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
}
! sprintf(istr, "<BODY %s>", bgstr);
*bodytag = estrdup(istr);
return(newtext);
}
/***********************************************************************
* Function fnAttributeValue() *
--- 574,584 ----
}
cur_ptr = (ANCHOR *) dlst_prev(cur_ptr);
}
! snprintf(istr, BUFFERLEN, "<BODY %s>", bgstr);
*bodytag = estrdup(istr);
return(newtext);
}
+ #undef BUFFERLEN
/***********************************************************************
* Function fnAttributeValue() *
***************
*** 4524,4532 ****
return(0);
}
! char *get_hw_info(hw_connection *conn)
! {
! char temp[200];
int len;
struct sockaddr_in serv_addr;
--- 4526,4534 ----
return(0);
}
! #define BUFFERLEN 200
! char *get_hw_info(hw_connection *conn) {
! char temp[BUFFERLEN];
int len;
struct sockaddr_in serv_addr;
***************
*** 4534,4544 ****
if(getsockname(conn->socket, (struct sockaddr *)&serv_addr, &len) < 0)
return(NULL);
! sprintf(temp, "%s, %s, %d, %s, %d, %d", conn->server_string, conn->hostname,
conn->version, conn->username,
serv_addr.sin_port, conn->swap_on);
return(estrdup(temp));
! }
static int send_hg_msg(int sockfd, hg_msg *msg, int length)
{
--- 4536,4547 ----
if(getsockname(conn->socket, (struct sockaddr *)&serv_addr, &len) < 0)
return(NULL);
! snprintf(temp, BUFFERLEN, "%s, %s, %d, %s, %d, %d", conn->server_string,
conn->hostname,
conn->version, conn->username,
serv_addr.sin_port, conn->swap_on);
return(estrdup(temp));
! }
! #undef BUFFERLEN
static int send_hg_msg(int sockfd, hg_msg *msg, int length)
{
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net