usr.bin/find/misc.c
void
brace_subst(char *orig, char **store, char *path, int len)
{
	int plen;
	char ch, *p;

	plen = strlen(path);
	for (p = *store; (ch = *orig) != '\0'; ++orig)
		if (ch == '{' && orig[1] == '}') {
			while ((p - *store) + plen > len)
				if (!(*store = realloc(*store, len *= 2)))
					err(1, NULL);
			memmove(p, path, plen);
			p += plen;
			++orig;
		} else
			*p++ = ch;
	*p = '\0';
}
/*
 * brace_subst --
 *	Replace occurrences of {} in s1 with s2 and return the result string.
 */
brace_subst
Replace occurrences of {} in s1 with s2 and return the result string.
brace_subst Replace occurrences of {} in s1 with s2 and return the result string .
void
brace_subst(char *orig, char **store, char *path, int len)
{
	int plen;
	char ch, *p;
	plen = strlen(path);
	for (p = *store; (ch = *orig) != '\0'; ++orig)
		if (ch == '{' && orig[1] == '}') {
			while ((p - *store) + plen > len)
				if (!(*store = realloc(*store, len *= 2)))
					err(1, NULL);
			memmove(p, path, plen);
			p += plen;
			++orig;
		} else
			*p++ = ch;
	*p = '\0';
}
void brace_subst ( char * orig , char * * store , char * path , int len ) { int plen ; char ch , * p ; plen = strlen ( path ) ; for ( p = * store ; ( ch = * orig ) != ' \0 ' ; ++ orig ) if ( ch == ' ' && orig [ 1 ] == ' ' ) { while ( ( p - * store ) + plen > len ) if ( ! ( * store = realloc ( * store , len *= 2 ) ) ) err ( 1 , NULL ) ; memmove ( p , path , plen ) ; p += plen ; ++ orig ; } else * p ++ = ch ; * p = ' \0 ' ; }
brace_subst
      Replace occurrences of {} in s1 with s2 and return the result string.
brace_subst Replace occurrences of {} in s1 with s2 and return the result string .