diff options
author | msmith <msmith@FreeBSD.org> | 1998-10-31 02:48:29 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-10-31 02:48:29 +0000 |
commit | e6108119c4a18c3dd11e5fda0bbd6b84a63a923f (patch) | |
tree | 77ffcdb32b212aed315a6b8b4ea9e120a4452dff /lib/libstand | |
parent | 02030ba04b7d957e3218848bb30779ab2dbd82b1 (diff) | |
download | FreeBSD-src-e6108119c4a18c3dd11e5fda0bbd6b84a63a923f.zip FreeBSD-src-e6108119c4a18c3dd11e5fda0bbd6b84a63a923f.tar.gz |
Add a new field to the devsw structure; dv_print, to print all valid units
etc. associated with the device entry.
Consider EOF an 'error' for fgetstr if we haven't read anything yet.
You *MUST* recompile and reinstall libstand before rebuilding the bootstrap.
Diffstat (limited to 'lib/libstand')
-rw-r--r-- | lib/libstand/dev_net.c | 13 | ||||
-rw-r--r-- | lib/libstand/gets.c | 5 | ||||
-rw-r--r-- | lib/libstand/stand.h | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/lib/libstand/dev_net.c b/lib/libstand/dev_net.c index 8d09e4f..cfa9fbf 100644 --- a/lib/libstand/dev_net.c +++ b/lib/libstand/dev_net.c @@ -73,6 +73,8 @@ static int netdev_opens; static int net_getparams(int sock); +static void net_print(int verbose); + struct devsw netdev = { "net", DEVT_NET, @@ -81,9 +83,20 @@ struct devsw netdev = { net_open, net_close, noioctl + net_print, }; /* + * Print stuff about our net 'device'. + */ +static void +net_print(int verbose) +{ + pager_output(" net: network interface"); + /* XXX much more verbose stuff here */ +} + +/* * Called by devopen after it sets f->f_dev to our devsw entry. * This opens the low-level device and sets f->f_devdata. * This is declared with variable arguments... diff --git a/lib/libstand/gets.c b/lib/libstand/gets.c index 3fbe9b4..dc26a99 100644 --- a/lib/libstand/gets.c +++ b/lib/libstand/gets.c @@ -95,8 +95,11 @@ fgetstr(char *buf, int size, int fd) err = read(fd, &c, sizeof(c)); if (err < 0) /* read error */ return(-1); - if (err == 0) /* EOF */ + if (err == 0) { /* EOF */ + if (len == 0) + return(-1); /* nothing to read */ break; + } if ((c == '\r') || /* line terminators */ (c == '\n')) break; diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index 251e7e8..3a05490 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: stand.h,v 1.7 1998/10/06 19:23:57 msmith Exp $ + * $Id: stand.h,v 1.8 1998/10/19 09:08:40 dfr Exp $ * From $NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $ */ @@ -137,6 +137,7 @@ struct devsw { int (*dv_open)(struct open_file *f, ...); int (*dv_close)(struct open_file *f); int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data); + void (*dv_print)(int verbose); /* print device information */ }; extern int errno; |