[Toybox] [PATCH] getconf: say "undefined" for sysconf/pathconf -1.

Rob Landley rob at landley.net
Sun Oct 7 08:32:10 PDT 2018


Sigh, window got buried instead of sent, sorry if this is a duplicate...

On 10/05/2018 05:30 PM, enh wrote:
> +static void printconf(long v)
> +{
> +  if (v == -1) puts("undefined");
> +  else printf("%ld\n", v);
> +}
> +
...
> -  if (!i) printf("%ld\n", sysconf(c->value));
> -  else if (i==1) printf("%ld\n", pathconf(toys.optargs[1], c->value));
> +  if (!i) printconf(sysconf(c->value));
> +  else if (i==1) printconf(pathconf(toys.optargs[1], c->value));

New function called twice, doesn't need to be called twice...

I pulled this into some cleanups I was poking at locally (help text tweak, made
the goto go away, curly brackets, etc).

Rob



More information about the Toybox mailing list