FreeBSD/sys/kern/imgact_binmisc.c
/*
 * Populate the entry with the information about the interpreter.
 */
Populate the entry with the information about the interpreter.
Populate the entry with the information about the interpreter .
static void
imgact_binmisc_populate_interp(char *str, imgact_binmisc_entry_t *ibe)
{
	uint32_t len = 0, argc = 1;
	char t[IBE_INTERP_LEN_MAX];
	char *sp, *tp;
	memset(t, 0, sizeof(t));
	sp = str; tp = t;
	while (*sp != '\0') {
		if (*sp == ' ' || *sp == '\t') {
			if (++len > IBE_INTERP_LEN_MAX)
				break;
			*tp++ = ' ';
			argc++;
			while (*sp == ' ' || *sp == '\t')
				sp++;
			continue;
		} else {
			*tp++ = *sp++;
			len++;
		}
	}
	*tp = '\0';
	len++;
	ibe->ibe_interpreter = malloc(len, M_BINMISC, M_WAITOK|M_ZERO);
	memcpy(ibe->ibe_interpreter, t, len);
	ibe->ibe_interp_argcnt = argc;
	ibe->ibe_interp_length = len;
}
static void imgact_binmisc_populate_interp ( char * str , imgact_binmisc_entry_t * ibe ) { uint32_t len = 0 , argc = 1 ; char t [ IBE_INTERP_LEN_MAX ] ; char * sp , * tp ; memset ( t , 0 , sizeof ( t ) ) ; sp = str ; tp = t ; while ( * sp != ' \0 ' ) { if ( * sp == ' ' || * sp == ' \t ' ) { if ( ++ len > IBE_INTERP_LEN_MAX ) break ; * tp ++ = ' ' ; argc ++ ; while ( * sp == ' ' || * sp == ' \t ' ) sp ++ ; continue ; } else { * tp ++ = * sp ++ ; len ++ ; } } * tp = ' \0 ' ; len ++ ; ibe -> ibe_interpreter = malloc ( len , M_BINMISC , M_WAITOK | M_ZERO ) ; memcpy ( ibe -> ibe_interpreter , t , len ) ; ibe -> ibe_interp_argcnt = argc ; ibe -> ibe_interp_length = len ; }
Populate the entry with the information about the interpreter.
Populate the entry with the information about the interpreter .
/*
	 * Normalize interpreter string. Replace white space between args with
	 * single space.
	 */ /* Populate all the ibe fields for the interpreter. */