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.
This commit is contained in:
msmith 1998-10-31 02:48:29 +00:00
parent 02030ba04b
commit e6108119c4
3 changed files with 19 additions and 2 deletions

View File

@ -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,8 +83,19 @@ 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.

View File

@ -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;

View File

@ -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;