diff options
author | Michael Brown | 2009-01-27 21:09:50 +0100 |
---|---|---|
committer | Michael Brown | 2009-01-27 21:09:50 +0100 |
commit | 52c596bafb6b8367010db190efca386c03b4c04c (patch) | |
tree | 1083d9782e141602b4c0c863b58d59bdcabfcbf2 /src/usr/ifmgmt.c | |
parent | [dns] Append local domain to relative names (diff) | |
download | ipxe-52c596bafb6b8367010db190efca386c03b4c04c.tar.gz ipxe-52c596bafb6b8367010db190efca386c03b4c04c.tar.xz ipxe-52c596bafb6b8367010db190efca386c03b4c04c.zip |
[ui] Allow Ctrl-C to cancel wait for net device link-up
This really ought to be handled via monojob.c and the usual Ctrl-C
mechanism that handles cancelling DHCP or file downloads.
Diffstat (limited to 'src/usr/ifmgmt.c')
-rw-r--r-- | src/usr/ifmgmt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/usr/ifmgmt.c b/src/usr/ifmgmt.c index 72d86137..0ebf5615 100644 --- a/src/usr/ifmgmt.c +++ b/src/usr/ifmgmt.c @@ -20,9 +20,11 @@ #include <stdio.h> #include <unistd.h> #include <errno.h> +#include <console.h> #include <gpxe/netdevice.h> #include <gpxe/device.h> #include <gpxe/process.h> +#include <gpxe/keys.h> #include <usr/ifmgmt.h> /** @file @@ -101,12 +103,19 @@ void ifstat ( struct net_device *netdev ) { * @v max_wait_ms Maximum time to wait, in ms */ int iflinkwait ( struct net_device *netdev, unsigned int max_wait_ms ) { + int key; + while ( 1 ) { if ( netdev_link_ok ( netdev ) ) return 0; if ( max_wait_ms-- == 0 ) return -ETIMEDOUT; step(); + if ( iskey() ) { + key = getchar(); + if ( key == CTRL_C ) + return -ECANCELED; + } mdelay ( 1 ); } } |