FreeBSD/sys/boot/common/console.c
/*
 * Check that at least one the consoles listed in *string is valid
 */
Check that at least one the consoles listed in *string is valid
Check that at least one the consoles listed in * string is valid
static int
cons_check(const char *string)
{
    int		cons, found, failed;
    char	*curpos, *dup, *next;
    dup = next = strdup(string);
    found = failed = 0;
    while (next != NULL) {
	curpos = strsep(&next, " ,");
	if (*curpos != '\0') {
	    cons = cons_find(curpos);
	    if (cons == -1) {
		printf("console %s is invalid!\n", curpos);
		failed++;
	    } else {
		found++;
	    }
	}
    }
    free(dup);
    if (found == 0)
	printf("no valid consoles!\n");
    if (found == 0 || failed != 0) {
	printf("Available consoles:\n");
	for (cons = 0; consoles[cons] != NULL; cons++)
	    printf("    %s\n", consoles[cons]->c_name);
    }
    return (found);
}
static int cons_check ( const char * string ) { int cons , found , failed ; char * curpos , * dup , * next ; dup = next = strdup ( string ) ; found = failed = 0 ; while ( next != NULL ) { curpos = strsep ( & next , " " ) ; if ( * curpos != ' \0 ' ) { cons = cons_find ( curpos ) ; if ( cons == -1 ) { printf ( " \n " , curpos ) ; failed ++ ; } else { found ++ ; } } } free ( dup ) ; if ( found == 0 ) printf ( " \n " ) ; if ( found == 0 || failed != 0 ) { printf ( " \n " ) ; for ( cons = 0 ; consoles [ cons ] != NULL ; cons ++ ) printf ( " \n " , consoles [ cons ] -> c_name ) ; } return ( found ) ; }
Check that at least one the consoles listed in *string is valid
Check that at least one the consoles listed in * string is valid