[PATCH] osmocon: correct parsing of -m

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Wed Dec 14 04:25:51 UTC 2011


Alexander Huemer wrote:
> diff --git a/src/host/osmocon/osmocon.c b/src/host/osmocon/osmocon.c
> index 5f28992..fc29506 100644
> --- a/src/host/osmocon/osmocon.c
> +++ b/src/host/osmocon/osmocon.c
> @@ -123,6 +123,7 @@ enum dnload_mode {
>  	MODE_C155,
>  	MODE_ROMLOAD,
>  	MODE_MTK,
> +	MODE_INVALID,
>  };
>  
>  struct dnload {
> @@ -1184,7 +1185,7 @@ static int parse_mode(const char *arg)
>  	else if (!strcasecmp(arg, "mtk"))
>  		return MODE_MTK;
>  
> -	return -1;
> +	return MODE_INVALID;
>  }
>  
>  #define HELP_TEXT \
> @@ -1413,7 +1414,7 @@ int main(int argc, char **argv)
>  			break;
>  		case 'm':
>  			dnload.mode = parse_mode(optarg);
> -			if (dnload.mode < 0)
> +			if (dnload.mode == MODE_INVALID)
>  				usage(argv[0]);
>  			break;
>  		case 's':

How was it incorrect before?


//Peter




More information about the baseband-devel mailing list