FreeBSD/sys/cam/ctl/ctl.c
/*
 * Escape characters that are illegal or not recommended in XML.
 */
Escape characters that are illegal or not recommended in XML.
Escape characters that are illegal or not recommended in XML .
int
ctl_sbuf_printf_esc(struct sbuf *sb, char *str, int size)
{
	char *end = str + size;
	int retval;
	retval = 0;
	for (; *str && str < end; str++) {
		switch (*str) {
		case '&':
			retval = sbuf_printf(sb, "&amp;");
			break;
		case '>':
			retval = sbuf_printf(sb, "&gt;");
			break;
		case '<':
			retval = sbuf_printf(sb, "&lt;");
			break;
		default:
			retval = sbuf_putc(sb, *str);
			break;
		}
		if (retval != 0)
			break;
	}
	return (retval);
}
int ctl_sbuf_printf_esc ( struct sbuf * sb , char * str , int size ) { char * end = str + size ; int retval ; retval = 0 ; for ( ; * str && str < end ; str ++ ) { switch ( * str ) { case ' ' : retval = sbuf_printf ( sb , " " ) ; break ; case ' ' : retval = sbuf_printf ( sb , " " ) ; break ; case ' ' : retval = sbuf_printf ( sb , " " ) ; break ; default : retval = sbuf_putc ( sb , * str ) ; break ; } if ( retval != 0 ) break ; } return ( retval ) ; }
Escape characters that are illegal or not recommended in XML.
Escape characters that are illegal or not recommended in XML .