summaryrefslogtreecommitdiffstats
path: root/qemu/roms/ipxe/src/hci
diff options
context:
space:
mode:
authorDon Dugger <n0ano@n0ano.com>2016-06-03 03:33:22 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-03 03:33:23 +0000
commitda27230f80795d0028333713f036d44c53cb0e68 (patch)
treeb3d379eaf000adf72b36cb01cdf4d79c3e3f064c /qemu/roms/ipxe/src/hci
parent0e68cb048bb8aadb14675f5d4286d8ab2fc35449 (diff)
parent437fd90c0250dee670290f9b714253671a990160 (diff)
Merge "These changes are the raw update to qemu-2.6."
Diffstat (limited to 'qemu/roms/ipxe/src/hci')
-rw-r--r--qemu/roms/ipxe/src/hci/commands/autoboot_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/config_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/console_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/dhcp_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/fcmgmt_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/gdbstub_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/ifmgmt_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/image_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/image_trust_cmd.c9
-rw-r--r--qemu/roms/ipxe/src/hci/commands/ipstat_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/login_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/lotest_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/menu_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/neighbour_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/nvo_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/param_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/pci_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/ping_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/poweroff_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/profstat_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/reboot_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/route_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/sanboot_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/sync_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/commands/vlan_cmd.c6
-rw-r--r--qemu/roms/ipxe/src/hci/editstring.c6
-rw-r--r--qemu/roms/ipxe/src/hci/jumpscroll.c140
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/alert.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/ansi_screen.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/clear.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/colour.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/cursor.h2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/edging.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/kb.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/mucurses.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/mucurses.h2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/print.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/print_nadv.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/slk.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/widgets/editbox.c6
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/winattrs.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/windows.c2
-rw-r--r--qemu/roms/ipxe/src/hci/mucurses/wininit.c2
-rw-r--r--qemu/roms/ipxe/src/hci/readline.c6
-rw-r--r--qemu/roms/ipxe/src/hci/shell.c9
-rw-r--r--qemu/roms/ipxe/src/hci/strerror.c9
-rw-r--r--qemu/roms/ipxe/src/hci/tui/login_ui.c6
-rw-r--r--qemu/roms/ipxe/src/hci/tui/menu_ui.c102
-rw-r--r--qemu/roms/ipxe/src/hci/tui/settings_ui.c355
49 files changed, 514 insertions, 308 deletions
diff --git a/qemu/roms/ipxe/src/hci/commands/autoboot_cmd.c b/qemu/roms/ipxe/src/hci/commands/autoboot_cmd.c
index 62235a278..56f39a1ce 100644
--- a/qemu/roms/ipxe/src/hci/commands/autoboot_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/autoboot_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <stdio.h>
@@ -25,7 +29,7 @@
#include <hci/ifmgmt_cmd.h>
#include <usr/autoboot.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/config_cmd.c b/qemu/roms/ipxe/src/hci/commands/config_cmd.c
index b81c866ff..ad415e045 100644
--- a/qemu/roms/ipxe/src/hci/commands/config_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/config_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <string.h>
@@ -26,7 +30,7 @@
#include <ipxe/settings.h>
#include <ipxe/settings_ui.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/console_cmd.c b/qemu/roms/ipxe/src/hci/commands/console_cmd.c
index d2eae59f0..ba472b9f6 100644
--- a/qemu/roms/ipxe/src/hci/commands/console_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/console_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/dhcp_cmd.c b/qemu/roms/ipxe/src/hci/commands/dhcp_cmd.c
index feeb55ee5..45a922b51 100644
--- a/qemu/roms/ipxe/src/hci/commands/dhcp_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/dhcp_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <stdint.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/fcmgmt_cmd.c b/qemu/roms/ipxe/src/hci/commands/fcmgmt_cmd.c
index 1c199b5dc..97f10f4dd 100644
--- a/qemu/roms/ipxe/src/hci/commands/fcmgmt_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/fcmgmt_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <errno.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/gdbstub_cmd.c b/qemu/roms/ipxe/src/hci/commands/gdbstub_cmd.c
index 33890aebc..c4a831e7a 100644
--- a/qemu/roms/ipxe/src/hci/commands/gdbstub_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/gdbstub_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <errno.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/ifmgmt_cmd.c b/qemu/roms/ipxe/src/hci/commands/ifmgmt_cmd.c
index 5307c9423..c89af2e81 100644
--- a/qemu/roms/ipxe/src/hci/commands/ifmgmt_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/ifmgmt_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <errno.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/image_cmd.c b/qemu/roms/ipxe/src/hci/commands/image_cmd.c
index a9e831bf5..4a7c500a4 100644
--- a/qemu/roms/ipxe/src/hci/commands/image_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/image_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/image_trust_cmd.c b/qemu/roms/ipxe/src/hci/commands/image_trust_cmd.c
index ca59a858a..f9d6b5b3e 100644
--- a/qemu/roms/ipxe/src/hci/commands/image_trust_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/image_trust_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdio.h>
@@ -169,6 +173,9 @@ struct command image_trust_commands[] __command = {
},
};
+/* Drag in objects via command list */
+REQUIRING_SYMBOL ( image_trust_commands );
+
/* Drag in objects typically required for signature verification */
REQUIRE_OBJECT ( rsa );
REQUIRE_OBJECT ( md5 );
diff --git a/qemu/roms/ipxe/src/hci/commands/ipstat_cmd.c b/qemu/roms/ipxe/src/hci/commands/ipstat_cmd.c
index d565dc0ae..763e4dfd6 100644
--- a/qemu/roms/ipxe/src/hci/commands/ipstat_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/ipstat_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <getopt.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/login_cmd.c b/qemu/roms/ipxe/src/hci/commands/login_cmd.c
index f5db427d5..c9e196437 100644
--- a/qemu/roms/ipxe/src/hci/commands/login_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/login_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <string.h>
@@ -23,7 +27,7 @@
#include <ipxe/parseopt.h>
#include <ipxe/login_ui.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/lotest_cmd.c b/qemu/roms/ipxe/src/hci/commands/lotest_cmd.c
index 0fa031bcb..a989932d4 100644
--- a/qemu/roms/ipxe/src/hci/commands/lotest_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/lotest_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <stdlib.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/menu_cmd.c b/qemu/roms/ipxe/src/hci/commands/menu_cmd.c
index 66a6262e6..76bce8695 100644
--- a/qemu/roms/ipxe/src/hci/commands/menu_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/menu_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/neighbour_cmd.c b/qemu/roms/ipxe/src/hci/commands/neighbour_cmd.c
index a1e052439..816e87357 100644
--- a/qemu/roms/ipxe/src/hci/commands/neighbour_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/neighbour_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/nvo_cmd.c b/qemu/roms/ipxe/src/hci/commands/nvo_cmd.c
index e63dab08e..ac0d60651 100644
--- a/qemu/roms/ipxe/src/hci/commands/nvo_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/nvo_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <stdint.h>
@@ -29,7 +33,7 @@
#include <ipxe/parseopt.h>
#include <readline/readline.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/param_cmd.c b/qemu/roms/ipxe/src/hci/commands/param_cmd.c
index 6cf096d00..bff04f2ff 100644
--- a/qemu/roms/ipxe/src/hci/commands/param_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/param_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/pci_cmd.c b/qemu/roms/ipxe/src/hci/commands/pci_cmd.c
index f5145fb35..a2a811aa0 100644
--- a/qemu/roms/ipxe/src/hci/commands/pci_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/pci_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <stdio.h>
@@ -23,7 +27,7 @@
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/ping_cmd.c b/qemu/roms/ipxe/src/hci/commands/ping_cmd.c
index 34807696f..ab271e75a 100644
--- a/qemu/roms/ipxe/src/hci/commands/ping_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/ping_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/poweroff_cmd.c b/qemu/roms/ipxe/src/hci/commands/poweroff_cmd.c
index 9d487d330..afdf12dde 100644
--- a/qemu/roms/ipxe/src/hci/commands/poweroff_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/poweroff_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <stdio.h>
@@ -24,7 +28,7 @@
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/profstat_cmd.c b/qemu/roms/ipxe/src/hci/commands/profstat_cmd.c
index e4c9e5a24..dc6f649e3 100644
--- a/qemu/roms/ipxe/src/hci/commands/profstat_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/profstat_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <getopt.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/reboot_cmd.c b/qemu/roms/ipxe/src/hci/commands/reboot_cmd.c
index 485939e42..45d54cc2c 100644
--- a/qemu/roms/ipxe/src/hci/commands/reboot_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/reboot_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <getopt.h>
@@ -22,7 +26,7 @@
#include <ipxe/parseopt.h>
#include <ipxe/reboot.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/route_cmd.c b/qemu/roms/ipxe/src/hci/commands/route_cmd.c
index cc5ffc2f2..8aa535363 100644
--- a/qemu/roms/ipxe/src/hci/commands/route_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/route_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <getopt.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/sanboot_cmd.c b/qemu/roms/ipxe/src/hci/commands/sanboot_cmd.c
index 5954b6326..24ec8bc4e 100644
--- a/qemu/roms/ipxe/src/hci/commands/sanboot_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/sanboot_cmd.c
@@ -15,6 +15,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
#include <stdio.h>
@@ -27,7 +31,7 @@
#include <ipxe/sanboot.h>
#include <usr/autoboot.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/commands/sync_cmd.c b/qemu/roms/ipxe/src/hci/commands/sync_cmd.c
index adf7e3cc6..54799d422 100644
--- a/qemu/roms/ipxe/src/hci/commands/sync_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/sync_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <stdio.h>
diff --git a/qemu/roms/ipxe/src/hci/commands/vlan_cmd.c b/qemu/roms/ipxe/src/hci/commands/vlan_cmd.c
index 5d7298220..8a2f0c749 100644
--- a/qemu/roms/ipxe/src/hci/commands/vlan_cmd.c
+++ b/qemu/roms/ipxe/src/hci/commands/vlan_cmd.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <stdlib.h>
diff --git a/qemu/roms/ipxe/src/hci/editstring.c b/qemu/roms/ipxe/src/hci/editstring.c
index 5f6f04d51..8cbce0767 100644
--- a/qemu/roms/ipxe/src/hci/editstring.c
+++ b/qemu/roms/ipxe/src/hci/editstring.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <assert.h>
#include <string.h>
diff --git a/qemu/roms/ipxe/src/hci/jumpscroll.c b/qemu/roms/ipxe/src/hci/jumpscroll.c
new file mode 100644
index 000000000..dd6bcac2b
--- /dev/null
+++ b/qemu/roms/ipxe/src/hci/jumpscroll.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2015 Michael Brown <mbrown@fensystems.co.uk>.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+/**
+ * Jump scrolling
+ *
+ */
+
+#include <assert.h>
+#include <ipxe/keys.h>
+#include <ipxe/jumpscroll.h>
+
+/**
+ * Handle keypress
+ *
+ * @v scroll Jump scroller
+ * @v key Key pressed by user
+ * @ret move Scroller movement, or zero
+ */
+int jump_scroll_key ( struct jump_scroller *scroll, int key ) {
+
+ /* Sanity checks */
+ assert ( scroll->rows != 0 );
+ assert ( scroll->count != 0 );
+ assert ( scroll->current < scroll->count );
+ assert ( scroll->first < scroll->count );
+ assert ( scroll->first <= scroll->current );
+ assert ( scroll->current < ( scroll->first + scroll->rows ) );
+
+ /* Handle key, if applicable */
+ switch ( key ) {
+ case KEY_UP:
+ return -1;
+ case KEY_DOWN:
+ return +1;
+ case KEY_PPAGE:
+ return ( scroll->first - scroll->current - 1 );
+ case KEY_NPAGE:
+ return ( scroll->first - scroll->current + scroll->rows );
+ case KEY_HOME:
+ return -( scroll->count );
+ case KEY_END:
+ return +( scroll->count );
+ default:
+ return 0;
+ }
+}
+
+/**
+ * Move scroller
+ *
+ * @v scroll Jump scroller
+ * @v move Scroller movement
+ * @ret move Continuing scroller movement (if applicable)
+ */
+int jump_scroll_move ( struct jump_scroller *scroll, int move ) {
+ int current = scroll->current;
+ int last = ( scroll->count - 1 );
+
+ /* Sanity checks */
+ assert ( move != 0 );
+ assert ( scroll->count != 0 );
+
+ /* Move to the new current item */
+ current += move;
+
+ /* Check for start/end of list */
+ if ( current < 0 ) {
+ /* We have attempted to move before the start of the
+ * list. Move to the start of the list and continue
+ * moving forwards (if applicable).
+ */
+ scroll->current = 0;
+ return +1;
+ } else if ( current > last ) {
+ /* We have attempted to move after the end of the
+ * list. Move to the end of the list and continue
+ * moving backwards (if applicable).
+ */
+ scroll->current = last;
+ return -1;
+ } else {
+ /* Update the current item and continue moving in the
+ * same direction (if applicable).
+ */
+ scroll->current = current;
+ return ( ( move > 0 ) ? +1 : -1 );
+ }
+}
+
+/**
+ * Jump scroll to new page (if applicable)
+ *
+ * @v scroll Jump scroller
+ * @ret jumped Jumped to a new page
+ */
+int jump_scroll ( struct jump_scroller *scroll ) {
+ unsigned int index;
+
+ /* Sanity checks */
+ assert ( scroll->rows != 0 );
+ assert ( scroll->count != 0 );
+ assert ( scroll->current < scroll->count );
+ assert ( scroll->first < scroll->count );
+
+ /* Do nothing if we are already on the correct page */
+ index = ( scroll->current - scroll->first );
+ if ( index < scroll->rows )
+ return 0;
+
+ /* Move to required page */
+ while ( scroll->first < scroll->current )
+ scroll->first += scroll->rows;
+ while ( scroll->first > scroll->current )
+ scroll->first -= scroll->rows;
+
+ return 1;
+}
diff --git a/qemu/roms/ipxe/src/hci/mucurses/alert.c b/qemu/roms/ipxe/src/hci/mucurses/alert.c
index 00e959a89..7dc61c222 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/alert.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/alert.c
@@ -7,6 +7,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
/**
* Audible signal
*
diff --git a/qemu/roms/ipxe/src/hci/mucurses/ansi_screen.c b/qemu/roms/ipxe/src/hci/mucurses/ansi_screen.c
index 1d3143f89..1cf3309dd 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/ansi_screen.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/ansi_screen.c
@@ -3,7 +3,7 @@
#include <ipxe/ansicol.h>
#include <ipxe/console.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
static void ansiscr_reset(struct _curses_screen *scr) __nonnull;
static void ansiscr_movetoyx(struct _curses_screen *scr,
diff --git a/qemu/roms/ipxe/src/hci/mucurses/clear.c b/qemu/roms/ipxe/src/hci/mucurses/clear.c
index f5e52ca20..2054f72cc 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/clear.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/clear.c
@@ -8,7 +8,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Clear a window to the bottom from current cursor position
diff --git a/qemu/roms/ipxe/src/hci/mucurses/colour.c b/qemu/roms/ipxe/src/hci/mucurses/colour.c
index c1359c868..b0c480b1f 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/colour.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/colour.c
@@ -1,6 +1,6 @@
#include <curses.h>
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
struct colour_pair {
short fcol;
diff --git a/qemu/roms/ipxe/src/hci/mucurses/cursor.h b/qemu/roms/ipxe/src/hci/mucurses/cursor.h
index 16b7d27c2..2e0c896a6 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/cursor.h
+++ b/qemu/roms/ipxe/src/hci/mucurses/cursor.h
@@ -7,7 +7,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
struct cursor_pos {
unsigned int y, x;
diff --git a/qemu/roms/ipxe/src/hci/mucurses/edging.c b/qemu/roms/ipxe/src/hci/mucurses/edging.c
index eccd32422..e938d338b 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/edging.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/edging.c
@@ -8,6 +8,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
/**
* Draw borders from single-byte characters and renditions around a
* window
diff --git a/qemu/roms/ipxe/src/hci/mucurses/kb.c b/qemu/roms/ipxe/src/hci/mucurses/kb.c
index b38c8c146..8face14d8 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/kb.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/kb.c
@@ -8,6 +8,8 @@
* MuCurses keyboard input handling functions
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
#define INPUT_DELAY 200 // half-blocking delay timer resolution (ms)
#define INPUT_DELAY_TIMEOUT 1000 // half-blocking delay timeout
diff --git a/qemu/roms/ipxe/src/hci/mucurses/mucurses.c b/qemu/roms/ipxe/src/hci/mucurses/mucurses.c
index b67445baf..98a8a2c59 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/mucurses.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/mucurses.c
@@ -7,7 +7,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
static void _wupdcurs ( WINDOW *win ) __nonnull;
void _wputch ( WINDOW *win, chtype ch, int wrap ) __nonnull;
diff --git a/qemu/roms/ipxe/src/hci/mucurses/mucurses.h b/qemu/roms/ipxe/src/hci/mucurses/mucurses.h
index 7ac1086ac..270394787 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/mucurses.h
+++ b/qemu/roms/ipxe/src/hci/mucurses/mucurses.h
@@ -7,7 +7,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define WRAP 0
#define NOWRAP 1
diff --git a/qemu/roms/ipxe/src/hci/mucurses/print.c b/qemu/roms/ipxe/src/hci/mucurses/print.c
index 9c682588b..e8831c58f 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/print.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/print.c
@@ -10,7 +10,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Add a single-byte character and rendition to a window and advance
diff --git a/qemu/roms/ipxe/src/hci/mucurses/print_nadv.c b/qemu/roms/ipxe/src/hci/mucurses/print_nadv.c
index ee472e685..3a44e5bd2 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/print_nadv.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/print_nadv.c
@@ -8,6 +8,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
/**
* Add string of single-byte characters and renditions to a window
*
diff --git a/qemu/roms/ipxe/src/hci/mucurses/slk.c b/qemu/roms/ipxe/src/hci/mucurses/slk.c
index 600658e75..660eb65c0 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/slk.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/slk.c
@@ -11,6 +11,8 @@
* Soft label key functions
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
#define MIN_SPACE_SIZE 2
#define SLK_MAX_LABEL_LEN 8
diff --git a/qemu/roms/ipxe/src/hci/mucurses/widgets/editbox.c b/qemu/roms/ipxe/src/hci/mucurses/widgets/editbox.c
index 630a66e0b..210de4481 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/widgets/editbox.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/widgets/editbox.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <string.h>
#include <assert.h>
diff --git a/qemu/roms/ipxe/src/hci/mucurses/winattrs.c b/qemu/roms/ipxe/src/hci/mucurses/winattrs.c
index f549d7519..97a5a18b3 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/winattrs.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/winattrs.c
@@ -6,7 +6,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Get the background rendition attributes for a window
diff --git a/qemu/roms/ipxe/src/hci/mucurses/windows.c b/qemu/roms/ipxe/src/hci/mucurses/windows.c
index 63d0af08c..7f39bdea2 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/windows.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/windows.c
@@ -9,6 +9,8 @@
*
*/
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
/**
* Delete a window
*
diff --git a/qemu/roms/ipxe/src/hci/mucurses/wininit.c b/qemu/roms/ipxe/src/hci/mucurses/wininit.c
index b75abba44..dd84d2f1d 100644
--- a/qemu/roms/ipxe/src/hci/mucurses/wininit.c
+++ b/qemu/roms/ipxe/src/hci/mucurses/wininit.c
@@ -7,7 +7,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Initialise console environment
diff --git a/qemu/roms/ipxe/src/hci/readline.c b/qemu/roms/ipxe/src/hci/readline.c
index 40aa59787..83a2e0b90 100644
--- a/qemu/roms/ipxe/src/hci/readline.c
+++ b/qemu/roms/ipxe/src/hci/readline.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <string.h>
diff --git a/qemu/roms/ipxe/src/hci/shell.c b/qemu/roms/ipxe/src/hci/shell.c
index c1a543849..276eb3527 100644
--- a/qemu/roms/ipxe/src/hci/shell.c
+++ b/qemu/roms/ipxe/src/hci/shell.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdint.h>
#include <stdlib.h>
@@ -28,6 +32,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/shell.h>
+#include <config/branding.h>
/** @file
*
@@ -36,7 +41,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
*/
/** The shell prompt string */
-static const char shell_prompt[] = "iPXE> ";
+static const char shell_prompt[] = PRODUCT_SHORT_NAME "> ";
/**
* "help" command
diff --git a/qemu/roms/ipxe/src/hci/strerror.c b/qemu/roms/ipxe/src/hci/strerror.c
index 9356e9e0a..1bba8c620 100644
--- a/qemu/roms/ipxe/src/hci/strerror.c
+++ b/qemu/roms/ipxe/src/hci/strerror.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdio.h>
#include <ipxe/errortab.h>
+#include <config/branding.h>
/** @file
*
@@ -18,7 +19,7 @@
*
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/**
* Find error description
@@ -74,7 +75,7 @@ static struct errortab * find_closest_error ( int errno ) {
* call to strerror().
*
*/
-const char * strerror ( int errno ) {
+char * strerror ( int errno ) {
static char errbuf[64];
struct errortab *errortab;
@@ -88,11 +89,11 @@ const char * strerror ( int errno ) {
/* Construct the error message */
if ( errortab ) {
snprintf ( errbuf, sizeof ( errbuf ),
- "%s (http://ipxe.org/%08x)",
+ "%s (" PRODUCT_ERROR_URI ")",
errortab->text, errno );
} else {
snprintf ( errbuf, sizeof ( errbuf ),
- "Error %#08x (http://ipxe.org/%08x)",
+ "Error %#08x (" PRODUCT_ERROR_URI ")",
errno, errno );
}
diff --git a/qemu/roms/ipxe/src/hci/tui/login_ui.c b/qemu/roms/ipxe/src/hci/tui/login_ui.c
index 996b68a0a..3c55325d5 100644
--- a/qemu/roms/ipxe/src/hci/tui/login_ui.c
+++ b/qemu/roms/ipxe/src/hci/tui/login_ui.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
diff --git a/qemu/roms/ipxe/src/hci/tui/menu_ui.c b/qemu/roms/ipxe/src/hci/tui/menu_ui.c
index 0a9566def..f9dd9d100 100644
--- a/qemu/roms/ipxe/src/hci/tui/menu_ui.c
+++ b/qemu/roms/ipxe/src/hci/tui/menu_ui.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
/** @file
*
@@ -32,6 +36,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/timer.h>
#include <ipxe/console.h>
#include <ipxe/ansicol.h>
+#include <ipxe/jumpscroll.h>
#include <ipxe/menu.h>
/* Screen layout */
@@ -46,12 +51,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct menu_ui {
/** Menu */
struct menu *menu;
- /** Number of menu items */
- unsigned int count;
- /** Currently selected item */
- int selected;
- /** First visible item */
- int first_visible;
+ /** Jump scroller */
+ struct jump_scroller scroll;
/** Timeout (0=indefinite) */
unsigned long timeout;
};
@@ -80,7 +81,7 @@ static struct menu_item * menu_item ( struct menu *menu, unsigned int index ) {
* @v ui Menu user interface
* @v index Index
*/
-static void draw_menu_item ( struct menu_ui *ui, int index ) {
+static void draw_menu_item ( struct menu_ui *ui, unsigned int index ) {
struct menu_item *item;
unsigned int row_offset;
char buf[ MENU_COLS + 1 /* NUL */ ];
@@ -90,7 +91,7 @@ static void draw_menu_item ( struct menu_ui *ui, int index ) {
size_t len;
/* Move to start of row */
- row_offset = ( index - ui->first_visible );
+ row_offset = ( index - ui->scroll.first );
move ( ( MENU_ROW + row_offset ), MENU_COL );
/* Get menu item */
@@ -102,7 +103,7 @@ static void draw_menu_item ( struct menu_ui *ui, int index ) {
color_set ( CPAIR_SEPARATOR, NULL );
/* Highlight if this is the selected item */
- if ( index == ui->selected ) {
+ if ( index == ui->scroll.current ) {
color_set ( CPAIR_SELECT, NULL );
attron ( A_BOLD );
}
@@ -121,7 +122,7 @@ static void draw_menu_item ( struct menu_ui *ui, int index ) {
snprintf ( timeout_buf, sizeof ( timeout_buf ), "(%ld)",
( ( ui->timeout + TICKS_PER_SEC - 1 ) /
TICKS_PER_SEC ) );
- if ( ( index == ui->selected ) && ( ui->timeout != 0 ) ) {
+ if ( ( index == ui->scroll.current ) && ( ui->timeout != 0 ) ) {
memcpy ( ( buf + MENU_COLS - MENU_PAD - timeout_len ),
timeout_buf, timeout_len );
}
@@ -150,24 +151,17 @@ static void draw_menu_item ( struct menu_ui *ui, int index ) {
static void draw_menu_items ( struct menu_ui *ui ) {
unsigned int i;
- /* Jump scroll to correct point in list */
- while ( ui->first_visible < ui->selected )
- ui->first_visible += MENU_ROWS;
- while ( ui->first_visible > ui->selected )
- ui->first_visible -= MENU_ROWS;
-
/* Draw ellipses before and/or after the list as necessary */
color_set ( CPAIR_SEPARATOR, NULL );
mvaddstr ( ( MENU_ROW - 1 ), ( MENU_COL + MENU_PAD ),
- ( ( ui->first_visible > 0 ) ? "..." : " " ) );
+ ( jump_scroll_is_first ( &ui->scroll ) ? " " : "..." ) );
mvaddstr ( ( MENU_ROW + MENU_ROWS ), ( MENU_COL + MENU_PAD ),
- ( ( ( ui->first_visible + MENU_ROWS ) < ui->count ) ?
- "..." : " " ) );
+ ( jump_scroll_is_last ( &ui->scroll ) ? " " : "..." ) );
color_set ( CPAIR_NORMAL, NULL );
/* Draw visible items */
for ( i = 0 ; i < MENU_ROWS ; i++ )
- draw_menu_item ( ui, ( ui->first_visible + i ) );
+ draw_menu_item ( ui, ( ui->scroll.first + i ) );
}
/**
@@ -180,8 +174,7 @@ static void draw_menu_items ( struct menu_ui *ui ) {
static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
struct menu_item *item;
unsigned long timeout;
- unsigned int delta;
- int current;
+ unsigned int previous;
int key;
int i;
int move;
@@ -190,7 +183,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
do {
/* Record current selection */
- current = ui->selected;
+ previous = ui->scroll.current;
/* Calculate timeout as remainder of current second */
timeout = ( ui->timeout % TICKS_PER_SEC );
@@ -209,27 +202,11 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
/* Cancel any timeout */
ui->timeout = 0;
- /* Handle key */
+ /* Handle scroll keys */
+ move = jump_scroll_key ( &ui->scroll, key );
+
+ /* Handle other keys */
switch ( key ) {
- case KEY_UP:
- move = -1;
- break;
- case KEY_DOWN:
- move = +1;
- break;
- case KEY_PPAGE:
- move = ( ui->first_visible - ui->selected - 1 );
- break;
- case KEY_NPAGE:
- move = ( ui->first_visible - ui->selected
- + MENU_ROWS );
- break;
- case KEY_HOME:
- move = -ui->count;
- break;
- case KEY_END:
- move = +ui->count;
- break;
case ESC:
case CTRL_C:
rc = -ECANCELED;
@@ -247,7 +224,7 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
i++;
continue;
}
- ui->selected = i;
+ ui->scroll.current = i;
if ( item->label ) {
chosen = 1;
} else {
@@ -260,31 +237,22 @@ static int menu_loop ( struct menu_ui *ui, struct menu_item **selected ) {
/* Move selection, if applicable */
while ( move ) {
- ui->selected += move;
- if ( ui->selected < 0 ) {
- ui->selected = 0;
- move = +1;
- } else if ( ui->selected >= ( int ) ui->count ) {
- ui->selected = ( ui->count - 1 );
- move = -1;
- }
- item = menu_item ( ui->menu, ui->selected );
+ move = jump_scroll_move ( &ui->scroll, move );
+ item = menu_item ( ui->menu, ui->scroll.current );
if ( item->label )
break;
- move = ( ( move > 0 ) ? +1 : -1 );
}
/* Redraw selection if necessary */
- if ( ( ui->selected != current ) || ( timeout != 0 ) ) {
- draw_menu_item ( ui, current );
- delta = ( ui->selected - ui->first_visible );
- if ( delta >= MENU_ROWS )
+ if ( ( ui->scroll.current != previous ) || ( timeout != 0 ) ) {
+ draw_menu_item ( ui, previous );
+ if ( jump_scroll ( &ui->scroll ) )
draw_menu_items ( ui );
- draw_menu_item ( ui, ui->selected );
+ draw_menu_item ( ui, ui->scroll.current );
}
/* Record selection */
- item = menu_item ( ui->menu, ui->selected );
+ item = menu_item ( ui->menu, ui->scroll.current );
assert ( item != NULL );
assert ( item->label != NULL );
*selected = item;
@@ -313,21 +281,22 @@ int show_menu ( struct menu *menu, unsigned long timeout,
/* Initialise UI */
memset ( &ui, 0, sizeof ( ui ) );
ui.menu = menu;
+ ui.scroll.rows = MENU_ROWS;
ui.timeout = timeout;
list_for_each_entry ( item, &menu->items, list ) {
if ( item->label ) {
if ( ! labelled_count )
- ui.selected = ui.count;
+ ui.scroll.current = ui.scroll.count;
labelled_count++;
if ( select ) {
if ( strcmp ( select, item->label ) == 0 )
- ui.selected = ui.count;
+ ui.scroll.current = ui.scroll.count;
} else {
if ( item->is_default )
- ui.selected = ui.count;
+ ui.scroll.current = ui.scroll.count;
}
}
- ui.count++;
+ ui.scroll.count++;
}
if ( ! labelled_count ) {
/* Menus with no labelled items cannot be selected
@@ -349,8 +318,9 @@ int show_menu ( struct menu *menu, unsigned long timeout,
snprintf ( buf, sizeof ( buf ), "%s", ui.menu->title );
mvprintw ( TITLE_ROW, ( ( COLS - strlen ( buf ) ) / 2 ), "%s", buf );
attroff ( A_BOLD );
+ jump_scroll ( &ui.scroll );
draw_menu_items ( &ui );
- draw_menu_item ( &ui, ui.selected );
+ draw_menu_item ( &ui, ui.scroll.current );
/* Enter main loop */
rc = menu_loop ( &ui, selected );
diff --git a/qemu/roms/ipxe/src/hci/tui/settings_ui.c b/qemu/roms/ipxe/src/hci/tui/settings_ui.c
index 221839730..be421cc0a 100644
--- a/qemu/roms/ipxe/src/hci/tui/settings_ui.c
+++ b/qemu/roms/ipxe/src/hci/tui/settings_ui.c
@@ -15,9 +15,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
+ *
+ * You can also choose to distribute this program under the terms of
+ * the Unmodified Binary Distribution Licence (as given in the file
+ * COPYING.UBDL), provided that you have satisfied its requirements.
*/
-FILE_LICENCE ( GPL2_OR_LATER );
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdio.h>
#include <stdarg.h>
@@ -29,7 +33,9 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/editbox.h>
#include <ipxe/keys.h>
#include <ipxe/ansicol.h>
+#include <ipxe/jumpscroll.h>
#include <ipxe/settings_ui.h>
+#include <config/branding.h>
/** @file
*
@@ -47,7 +53,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define INSTRUCTION_ROW ( LINES - 2U )
#define INSTRUCTION_PAD " "
-/** Layout of text within a setting widget */
+/** Layout of text within a setting row */
#define SETTING_ROW_TEXT( cols ) struct { \
char start[0]; \
char pad1[1]; \
@@ -63,8 +69,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
char nul; \
} __attribute__ (( packed ))
-/** A setting row widget */
-struct setting_row_widget {
+/** A settings user interface row */
+struct settings_ui_row {
/** Target configuration settings block
*
* Valid only for rows that lead to new settings blocks.
@@ -82,8 +88,6 @@ struct setting_row_widget {
struct setting setting;
/** Screen row */
unsigned int row;
- /** Screen column */
- unsigned int col;
/** Edit box widget used for editing setting */
struct edit_box editbox;
/** Editing in progress flag */
@@ -92,28 +96,24 @@ struct setting_row_widget {
char value[256]; /* enough size for a DHCP string */
};
-/** A settings widget */
-struct setting_widget {
+/** A settings user interface */
+struct settings_ui {
/** Settings block */
struct settings *settings;
- /** Number of rows */
- unsigned int num_rows;
- /** Current row index */
- unsigned int current;
- /** Index of the first visible row, for scrolling. */
- unsigned int first_visible;
- /** Active row */
- struct setting_row_widget row;
+ /** Jump scroller */
+ struct jump_scroller scroll;
+ /** Current row */
+ struct settings_ui_row row;
};
/**
- * Select a setting row
+ * Select a setting
*
- * @v widget Setting widget
+ * @v ui Settings user interface
* @v index Index of setting row
- * @ret count Number of settings rows
+ * @ret count Number of setting rows
*/
-static unsigned int select_setting_row ( struct setting_widget *widget,
+static unsigned int select_setting_row ( struct settings_ui *ui,
unsigned int index ) {
SETTING_ROW_TEXT ( COLS ) *text;
struct settings *settings;
@@ -122,25 +122,22 @@ static unsigned int select_setting_row ( struct setting_widget *widget,
unsigned int count = 0;
/* Initialise structure */
- memset ( &widget->row, 0, sizeof ( widget->row ) );
- widget->current = index;
- widget->row.row = ( SETTINGS_LIST_ROW + index - widget->first_visible );
- widget->row.col = SETTINGS_LIST_COL;
+ memset ( &ui->row, 0, sizeof ( ui->row ) );
+ ui->row.row = ( SETTINGS_LIST_ROW + index - ui->scroll.first );
/* Include parent settings block, if applicable */
- if ( widget->settings->parent && ( count++ == index ) ) {
- widget->row.settings = widget->settings->parent;
- snprintf ( widget->row.value, sizeof ( widget->row.value ),
+ if ( ui->settings->parent && ( count++ == index ) ) {
+ ui->row.settings = ui->settings->parent;
+ snprintf ( ui->row.value, sizeof ( ui->row.value ),
"../" );
}
/* Include any child settings blocks, if applicable */
- list_for_each_entry ( settings, &widget->settings->children, siblings ){
+ list_for_each_entry ( settings, &ui->settings->children, siblings ) {
if ( count++ == index ) {
- widget->row.settings = settings;
- snprintf ( widget->row.value,
- sizeof ( widget->row.value ), "%s/",
- settings->name );
+ ui->row.settings = settings;
+ snprintf ( ui->row.value, sizeof ( ui->row.value ),
+ "%s/", settings->name );
}
}
@@ -148,7 +145,7 @@ static unsigned int select_setting_row ( struct setting_widget *widget,
for_each_table_entry ( setting, SETTINGS ) {
/* Skip inapplicable settings */
- if ( ! setting_applies ( widget->settings, setting ) )
+ if ( ! setting_applies ( ui->settings, setting ) )
continue;
/* Skip duplicate settings */
@@ -158,18 +155,16 @@ static unsigned int select_setting_row ( struct setting_widget *widget,
/* Read current setting value and origin */
if ( count++ == index ) {
- fetchf_setting ( widget->settings, setting,
- &widget->row.origin,
- &widget->row.setting,
- widget->row.value,
- sizeof ( widget->row.value ) );
+ fetchf_setting ( ui->settings, setting, &ui->row.origin,
+ &ui->row.setting, ui->row.value,
+ sizeof ( ui->row.value ) );
}
}
/* Initialise edit box */
- init_editbox ( &widget->row.editbox, widget->row.value,
- sizeof ( widget->row.value ), NULL, widget->row.row,
- ( widget->row.col +
+ init_editbox ( &ui->row.editbox, ui->row.value,
+ sizeof ( ui->row.value ), NULL, ui->row.row,
+ ( SETTINGS_LIST_COL +
offsetof ( typeof ( *text ), u.setting.value ) ),
sizeof ( text->u.setting.value ), 0 );
@@ -197,9 +192,9 @@ static size_t string_copy ( char *dest, const char *src, size_t len ) {
/**
* Draw setting row
*
- * @v widget Setting widget
+ * @v ui Settings UI
*/
-static void draw_setting_row ( struct setting_widget *widget ) {
+static void draw_setting_row ( struct settings_ui *ui ) {
SETTING_ROW_TEXT ( COLS ) text;
unsigned int curs_offset;
char *value;
@@ -209,12 +204,12 @@ static void draw_setting_row ( struct setting_widget *widget ) {
text.nul = '\0';
/* Construct row content */
- if ( widget->row.settings ) {
+ if ( ui->row.settings ) {
/* Construct space-padded name */
curs_offset = ( offsetof ( typeof ( text ), u.settings ) +
string_copy ( text.u.settings,
- widget->row.value,
+ ui->row.value,
sizeof ( text.u.settings ) ) );
} else {
@@ -222,11 +217,11 @@ static void draw_setting_row ( struct setting_widget *widget ) {
/* Construct dot-padded name */
memset ( text.u.setting.name, '.',
sizeof ( text.u.setting.name ) );
- string_copy ( text.u.setting.name, widget->row.setting.name,
+ string_copy ( text.u.setting.name, ui->row.setting.name,
sizeof ( text.u.setting.name ) );
/* Construct space-padded value */
- value = widget->row.value;
+ value = ui->row.value;
if ( ! *value )
value = "<not specified>";
curs_offset = ( offsetof ( typeof ( text ), u.setting.value ) +
@@ -235,37 +230,34 @@ static void draw_setting_row ( struct setting_widget *widget ) {
}
/* Print row */
- if ( ( widget->row.origin == widget->settings ) ||
- ( widget->row.settings != NULL ) ) {
+ if ( ( ui->row.origin == ui->settings ) || ( ui->row.settings != NULL ))
attron ( A_BOLD );
- }
- mvprintw ( widget->row.row, widget->row.col, "%s", text.start );
+ mvprintw ( ui->row.row, SETTINGS_LIST_COL, "%s", text.start );
attroff ( A_BOLD );
- move ( widget->row.row, widget->row.col + curs_offset );
+ move ( ui->row.row, ( SETTINGS_LIST_COL + curs_offset ) );
}
/**
- * Edit setting widget
+ * Edit setting ui
*
- * @v widget Setting widget
+ * @v ui Settings UI
* @v key Key pressed by user
* @ret key Key returned to application, or zero
*/
-static int edit_setting ( struct setting_widget *widget, int key ) {
- assert ( widget->row.setting.name != NULL );
- widget->row.editing = 1;
- return edit_editbox ( &widget->row.editbox, key );
+static int edit_setting ( struct settings_ui *ui, int key ) {
+ assert ( ui->row.setting.name != NULL );
+ ui->row.editing = 1;
+ return edit_editbox ( &ui->row.editbox, key );
}
/**
- * Save setting widget value back to configuration settings
+ * Save setting ui value back to configuration settings
*
- * @v widget Setting widget
+ * @v ui Settings UI
*/
-static int save_setting ( struct setting_widget *widget ) {
- assert ( widget->row.setting.name != NULL );
- return storef_setting ( widget->settings, &widget->row.setting,
- widget->row.value );
+static int save_setting ( struct settings_ui *ui ) {
+ assert ( ui->row.setting.name != NULL );
+ return storef_setting ( ui->settings, &ui->row.setting, ui->row.value );
}
/**
@@ -340,15 +332,15 @@ static void alert ( const char *fmt, ... ) {
/**
* Draw title row
*
- * @v widget Setting widget
+ * @v ui Settings UI
*/
-static void draw_title_row ( struct setting_widget *widget ) {
+static void draw_title_row ( struct settings_ui *ui ) {
const char *name;
clearmsg ( TITLE_ROW );
- name = settings_name ( widget->settings );
+ name = settings_name ( ui->settings );
attron ( A_BOLD );
- msg ( TITLE_ROW, "iPXE configuration settings%s%s",
+ msg ( TITLE_ROW, PRODUCT_SHORT_NAME " configuration settings%s%s",
( name[0] ? " - " : "" ), name );
attroff ( A_BOLD );
}
@@ -356,89 +348,73 @@ static void draw_title_row ( struct setting_widget *widget ) {
/**
* Draw information row
*
- * @v widget Setting widget
+ * @v ui Settings UI
*/
-static void draw_info_row ( struct setting_widget *widget ) {
+static void draw_info_row ( struct settings_ui *ui ) {
char buf[32];
/* Draw nothing unless this row represents a setting */
clearmsg ( INFO_ROW );
clearmsg ( INFO_ROW + 1 );
- if ( ! widget->row.setting.name )
+ if ( ! ui->row.setting.name )
return;
/* Determine a suitable setting name */
- setting_name ( ( widget->row.origin ?
- widget->row.origin : widget->settings ),
- &widget->row.setting, buf, sizeof ( buf ) );
+ setting_name ( ( ui->row.origin ?
+ ui->row.origin : ui->settings ),
+ &ui->row.setting, buf, sizeof ( buf ) );
/* Draw row */
attron ( A_BOLD );
- msg ( INFO_ROW, "%s - %s", buf, widget->row.setting.description );
+ msg ( INFO_ROW, "%s - %s", buf, ui->row.setting.description );
attroff ( A_BOLD );
color_set ( CPAIR_URL, NULL );
- msg ( ( INFO_ROW + 1 ), "http://ipxe.org/cfg/%s",
- widget->row.setting.name );
+ msg ( ( INFO_ROW + 1 ), PRODUCT_SETTING_URI, ui->row.setting.name );
color_set ( CPAIR_NORMAL, NULL );
}
/**
* Draw instruction row
*
- * @v widget Setting widget
+ * @v ui Settings UI
*/
-static void draw_instruction_row ( struct setting_widget *widget ) {
+static void draw_instruction_row ( struct settings_ui *ui ) {
clearmsg ( INSTRUCTION_ROW );
- if ( widget->row.editing ) {
+ if ( ui->row.editing ) {
msg ( INSTRUCTION_ROW,
"Enter - accept changes" INSTRUCTION_PAD
"Ctrl-C - discard changes" );
} else {
msg ( INSTRUCTION_ROW,
"%sCtrl-X - exit configuration utility",
- ( ( widget->row.origin == widget->settings ) ?
+ ( ( ui->row.origin == ui->settings ) ?
"Ctrl-D - delete setting" INSTRUCTION_PAD : "" ) );
}
}
/**
- * Reveal setting row
+ * Draw the current block of setting rows
*
- * @v widget Setting widget
- * @v index Index of setting row
+ * @v ui Settings UI
*/
-static void reveal_setting_row ( struct setting_widget *widget,
- unsigned int index ) {
+static void draw_setting_rows ( struct settings_ui *ui ) {
unsigned int i;
- /* Simply return if setting N is already on-screen. */
- if ( index - widget->first_visible < SETTINGS_LIST_ROWS )
- return;
-
- /* Jump scroll to make the specified setting row visible. */
- while ( widget->first_visible < index )
- widget->first_visible += SETTINGS_LIST_ROWS;
- while ( widget->first_visible > index )
- widget->first_visible -= SETTINGS_LIST_ROWS;
-
- /* Draw ellipses before and/or after the settings list to
- * represent any invisible settings.
- */
- mvaddstr ( SETTINGS_LIST_ROW - 1,
- SETTINGS_LIST_COL + 1,
- widget->first_visible > 0 ? "..." : " " );
- mvaddstr ( SETTINGS_LIST_ROW + SETTINGS_LIST_ROWS,
- SETTINGS_LIST_COL + 1,
- ( ( widget->first_visible + SETTINGS_LIST_ROWS )
- < widget->num_rows ? "..." : " " ) );
+ /* Draw ellipses before and/or after the list as necessary */
+ color_set ( CPAIR_SEPARATOR, NULL );
+ mvaddstr ( ( SETTINGS_LIST_ROW - 1 ), ( SETTINGS_LIST_COL + 1 ),
+ jump_scroll_is_first ( &ui->scroll ) ? " " : "..." );
+ mvaddstr ( ( SETTINGS_LIST_ROW + SETTINGS_LIST_ROWS ),
+ ( SETTINGS_LIST_COL + 1 ),
+ jump_scroll_is_last ( &ui->scroll ) ? " " : "..." );
+ color_set ( CPAIR_NORMAL, NULL );
/* Draw visible settings. */
- for ( i = 0; i < SETTINGS_LIST_ROWS; i++ ) {
- if ( ( widget->first_visible + i ) < widget->num_rows ) {
- select_setting_row ( widget,
- widget->first_visible + i );
- draw_setting_row ( widget );
+ for ( i = 0 ; i < SETTINGS_LIST_ROWS ; i++ ) {
+ if ( ( ui->scroll.first + i ) < ui->scroll.count ) {
+ select_setting_row ( ui, ( ui->scroll.first + i ) );
+ draw_setting_row ( ui );
} else {
clearmsg ( SETTINGS_LIST_ROW + i );
}
@@ -446,69 +422,72 @@ static void reveal_setting_row ( struct setting_widget *widget,
}
/**
- * Reveal setting row
+ * Select settings block
*
- * @v widget Setting widget
+ * @v ui Settings UI
* @v settings Settings block
*/
-static void init_widget ( struct setting_widget *widget,
- struct settings *settings ) {
-
- widget->settings = settings_target ( settings );
- widget->num_rows = select_setting_row ( widget, 0 );
- widget->first_visible = SETTINGS_LIST_ROWS;
- draw_title_row ( widget );
- reveal_setting_row ( widget, 0 );
- select_setting_row ( widget, 0 );
+static void select_settings ( struct settings_ui *ui,
+ struct settings *settings ) {
+
+ ui->settings = settings_target ( settings );
+ ui->scroll.count = select_setting_row ( ui, 0 );
+ ui->scroll.rows = SETTINGS_LIST_ROWS;
+ ui->scroll.current = 0;
+ ui->scroll.first = 0;
+ draw_title_row ( ui );
+ draw_setting_rows ( ui );
+ select_setting_row ( ui, 0 );
}
static int main_loop ( struct settings *settings ) {
- struct setting_widget widget;
+ struct settings_ui ui;
+ unsigned int previous;
int redraw = 1;
int move;
- unsigned int next;
int key;
int rc;
/* Print initial screen content */
color_set ( CPAIR_NORMAL, NULL );
- memset ( &widget, 0, sizeof ( widget ) );
- init_widget ( &widget, settings );
+ memset ( &ui, 0, sizeof ( ui ) );
+ select_settings ( &ui, settings );
while ( 1 ) {
/* Redraw rows if necessary */
if ( redraw ) {
- draw_info_row ( &widget );
- draw_instruction_row ( &widget );
- color_set ( ( widget.row.editing ?
+ draw_info_row ( &ui );
+ draw_instruction_row ( &ui );
+ color_set ( ( ui.row.editing ?
CPAIR_EDIT : CPAIR_SELECT ), NULL );
- draw_setting_row ( &widget );
+ draw_setting_row ( &ui );
color_set ( CPAIR_NORMAL, NULL );
- curs_set ( widget.row.editing );
+ curs_set ( ui.row.editing );
redraw = 0;
}
- if ( widget.row.editing ) {
+ /* Edit setting, if we are currently editing */
+ if ( ui.row.editing ) {
/* Sanity check */
- assert ( widget.row.setting.name != NULL );
+ assert ( ui.row.setting.name != NULL );
/* Redraw edit box */
color_set ( CPAIR_EDIT, NULL );
- draw_editbox ( &widget.row.editbox );
+ draw_editbox ( &ui.row.editbox );
color_set ( CPAIR_NORMAL, NULL );
/* Process keypress */
- key = edit_setting ( &widget, getkey ( 0 ) );
+ key = edit_setting ( &ui, getkey ( 0 ) );
switch ( key ) {
case CR:
case LF:
- if ( ( rc = save_setting ( &widget ) ) != 0 )
+ if ( ( rc = save_setting ( &ui ) ) != 0 )
alert ( " %s ", strerror ( rc ) );
/* Fall through */
case CTRL_C:
- select_setting_row ( &widget, widget.current );
+ select_setting_row ( &ui, ui.scroll.current );
redraw = 1;
break;
default:
@@ -516,72 +495,52 @@ static int main_loop ( struct settings *settings ) {
break;
}
- } else {
+ continue;
+ }
- /* Process keypress */
- key = getkey ( 0 );
- move = 0;
- switch ( key ) {
- case KEY_UP:
- move = -1;
- break;
- case KEY_DOWN:
- move = +1;
- break;
- case KEY_PPAGE:
- move = ( widget.first_visible -
- widget.current - 1 );
- break;
- case KEY_NPAGE:
- move = ( widget.first_visible - widget.current
- + SETTINGS_LIST_ROWS );
- break;
- case KEY_HOME:
- move = -widget.num_rows;
- break;
- case KEY_END:
- move = +widget.num_rows;
- break;
- case CTRL_D:
- if ( ! widget.row.setting.name )
- break;
- if ( ( rc = delete_setting ( widget.settings,
- &widget.row.setting ) ) != 0 ) {
- alert ( " %s ", strerror ( rc ) );
- }
- select_setting_row ( &widget, widget.current );
+ /* Otherwise, navigate through settings */
+ key = getkey ( 0 );
+ move = jump_scroll_key ( &ui.scroll, key );
+ if ( move ) {
+ previous = ui.scroll.current;
+ jump_scroll_move ( &ui.scroll, move );
+ if ( ui.scroll.current != previous ) {
+ draw_setting_row ( &ui );
redraw = 1;
+ if ( jump_scroll ( &ui.scroll ) )
+ draw_setting_rows ( &ui );
+ select_setting_row ( &ui, ui.scroll.current );
+ }
+ continue;
+ }
+
+ /* Handle non-navigation keys */
+ switch ( key ) {
+ case CTRL_D:
+ if ( ! ui.row.setting.name )
break;
- case CTRL_X:
- return 0;
- case CR:
- case LF:
- if ( widget.row.settings ) {
- init_widget ( &widget,
- widget.row.settings );
- redraw = 1;
- }
- /* Fall through */
- default:
- if ( widget.row.setting.name ) {
- edit_setting ( &widget, key );
- redraw = 1;
- }
- break;
+ if ( ( rc = delete_setting ( ui.settings,
+ &ui.row.setting ) ) != 0 ){
+ alert ( " %s ", strerror ( rc ) );
+ }
+ select_setting_row ( &ui, ui.scroll.current );
+ redraw = 1;
+ break;
+ case CTRL_X:
+ return 0;
+ case CR:
+ case LF:
+ if ( ui.row.settings ) {
+ select_settings ( &ui, ui.row.settings );
+ redraw = 1;
}
- if ( move ) {
- next = ( widget.current + move );
- if ( ( int ) next < 0 )
- next = 0;
- if ( next >= widget.num_rows )
- next = ( widget.num_rows - 1 );
- if ( next != widget.current ) {
- draw_setting_row ( &widget );
- redraw = 1;
- reveal_setting_row ( &widget, next );
- select_setting_row ( &widget, next );
- }
+ /* Fall through */
+ default:
+ if ( ui.row.setting.name ) {
+ edit_setting ( &ui, key );
+ redraw = 1;
}
+ break;
}
}
}