FreeBSD/usr.sbin/jail/jail.c
/*
 * Print a string with quotes around spaces.
 */
Print a string with quotes around spaces.
Print a string with quotes around spaces .
static void
quoted_print(FILE *fp, char *str)
{
	int c, qc;
	char *p = str;
	qc = !*p ? '"'
	    : strchr(p, '\'') ? '"'
	    : strchr(p, '"') ? '\''
	    : strchr(p, ' ') || strchr(p, '\t') ? '"'
	    : 0;
	if (qc)
		putc(qc, fp);
	while ((c = *p++)) {
		if (c == '\\' || c == qc)
			putc('\\', fp);
		putc(c, fp);
	}
	if (qc)
		putc(qc, fp);
}
static void quoted_print ( FILE * fp , char * str ) { int c , qc ; char * p = str ; qc = ! * p ? ' ' : strchr ( p , ' \' ' ) ? ' ' : strchr ( p , ' ' ) ? ' \' ' : strchr ( p , ' ' ) || strchr ( p , ' \t ' ) ? ' ' : 0 ; if ( qc ) putc ( qc , fp ) ; while ( ( c = * p ++ ) ) { if ( c == ' \\ ' || c == qc ) putc ( ' \\ ' , fp ) ; putc ( c , fp ) ; } if ( qc ) putc ( qc , fp ) ; }
Print a string with quotes around spaces.
Print a string with quotes around spaces .