changes to compare_string_array and setterm again

Tito farmatito at tiscali.it
Mon Sep 4 19:49:15 UTC 2006


On Monday 4 September 2006 15:51, Alastor Santamaria wrote:
> hi, here in fsck.c line 1006:
> 
> ------------------------------
>     /* Are we ignoring this type? */
>     if(compare_string_array(ignored_types, fs->type) >= 0)
>         return 1;
> 
>     /* Do we really really want to check this fs? */
>     wanted = compare_string_array(really_wanted, fs->type) >= 0;
> 
> ***
>         if (wanted)
> 
> ------------------------------
> 
> could be
> 
> 
> ------------------------------
> 
>     if(!compare_string_array(ignored_types, fs->type))
>         return 1;
> 
>     /* Do we really really want to check this fs? */
>     wanted = compare_string_array(really_wanted, fs->type);
> 
> ------------------------------
> 
> everybody else just use a switch or
> if ((returned == 0) || (returned == 2))
>     do_stuff;
> 
> the function can be renamed compare_string_pascal_array
> or the like, to not confuse anybody

Hi, i think its best you forget about compare_string_array ;-)

It is designed to match this easy concept and to work as
most people expects:

static const char *const options[] = {
	"Pippo", Pluto", "Topolino", 0
	};

	printf("%s\n", (compare_string_array(options, "Minnie") < 0) ? "Unknown": options[compare_string_array(options, "Minnie")]);

Maybe this is a little hazardous, untested but gives the idea.

> I'm sending setterm again check it out what doyou think?

Maybe if you repost a complete patch it would be easier to
test it as coding blindly leads to errors.

Ciao,
Tito
> best regards Alastor
> 



More information about the busybox mailing list