]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[settings] Use a generic setting's own type as its default type
authorMichael Brown <mcb30@ipxe.org>
Fri, 31 Aug 2012 02:52:06 +0000 (03:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 10 Sep 2012 13:25:04 +0000 (14:25 +0100)
commit25ec56e0ecaa516a790fc409798e031af4bba650
tree5fa960eb24c1cced9d376b4d4139458db71580bc
parente6427b7ee117ea4af0812bb13b57999bccd8e058
[settings] Use a generic setting's own type as its default type

When fetching a named setting using a name that does not explicitly
specify a type, default to using the type stored when the setting was
created, rather than always defaulting to "string".  This allows the
behaviour of user-defined settings to match the behaviour of
predefined settings (which have a sensible default type).

For example:

  set server:ipv4 192.168.0.1
  echo ${server}

will now print "192.168.0.1", rather than trying to print out the raw
IPv4 address bytes as a string.

The downside of this change is that existing tricks for printing
special characters within scripts may require (backwards-compatible)
modification.  For example, the "clear screen" sequence:

  set esc:hex 1b
  set cls ${esc}[2J
  echo ${cls}

will now have to become

  set esc:hex 1b
  set cls ${esc:string}[2J  # Must now explicitly specify ":string"
  echo ${cls}

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/settings.c
src/hci/commands/menu_cmd.c
src/hci/commands/nvo_cmd.c
src/include/ipxe/settings.h