busybox-1.32.0/networking/httpd.c
static char *encodeString(const char *string)
{
	/* take the simple route and encode everything */
	/* could possibly scan once to get length.     */
	int len = strlen(string);
	char *out = xmalloc(len * 6 + 1);
	char *p = out;
	char ch;

	while ((ch = *string++) != '\0') {
		/* very simple check for what to encode */
		if (isalnum(ch))
			*p++ = ch;
		else
			p += sprintf(p, "&#%u;", (unsigned char) ch);
	}
	*p = '\0';
	return out;
}
/*
 * Given a string, html-encode special characters.
 * This is used for the -e command line option to provide an easy way
 * for scripts to encode result data without confusing browsers.  The
 * returned string pointer is memory allocated by malloc().
 *
 * Returns a pointer to the encoded string (malloced).
 */
Given a string, html-encode special characters.
This is used for the -e command line option to provide an easy way
for scripts to encode result data without confusing browsers.  The
returned string pointer is memory allocated by malloc().

Returns a pointer to the encoded string (malloced).
Given a string html - encode special characters . This is used for the - e command line option to provide an easy way for scripts to encode result data without confusing browsers . The returned string pointer is memory allocated by malloc () . Returns a pointer to the encoded string ( malloced ) .
static char *encodeString(const char *string)
{
	int len = strlen(string);
	char *out = xmalloc(len * 6 + 1);
	char *p = out;
	char ch;
	while ((ch = *string++) != '\0') {
		if (isalnum(ch))
			*p++ = ch;
		else
			p += sprintf(p, "&#%u;", (unsigned char) ch);
	}
	*p = '\0';
	return out;
}
static char * encodeString ( const char * string ) { int len = strlen ( string ) ; char * out = xmalloc ( len * 6 + 1 ) ; char * p = out ; char ch ; while ( ( ch = * string ++ ) != ' \0 ' ) { if ( isalnum ( ch ) ) * p ++ = ch ; else p += sprintf ( p , " " , ( unsigned char ) ch ) ; } * p = ' \0 ' ; return out ; }
Given a string, html-encode special characters.
Given a string html - encode special characters .
/* take the simple route and encode everything */ /* could possibly scan once to get length.     */ /* very simple check for what to encode */