On Friday 17 August 2012 16:26:29 Joe Hershberger wrote: > Use standard sh syntax: > ${VAR:-default} > Use default value: if VAR is set and non-null, expands to $VAR. > Otherwise, expands to default. > ${VAR:=default} > Set default value: if VAR is set and non-null, expands to $VAR. > Otherwise, sets hush VAR to default and expands to default. > ${VAR:+default} > If VAR is set and non-null, expands to the empty string. > Otherwise, expands to default.
how about ${VAR-default} and ${VAR=default} and ${VAR+default} ? > --- a/common/hush.c > +++ b/common/hush.c > > + if (sep) { > + *sep = '\0'; > + if (*(sep + 1) == '-') switch (sep[1]) { case '-': ... > + default_val = sep+2; sep + 2 > + if (!p || strlen(p) == 0) { if (!p || !p[0]) > + if (assign) { > + char *var = malloc(strlen(src)+strlen(default_val)+2); please put spaces around the "+" > + if (var) { > + sprintf(var, "%s=%s", src, default_val); > + set_local_var(var, 0); > + } isn't there a helper func for this ? -mike
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot