* Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
"@(#) Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass.\n\
static char sccsid
[] = "@(#)npdump.c 6.2 (Berkeley) %G%";
#define IMAGESIZE (1024 * 256)
int totalread
; /* Total byte count of device reads */
int ed
; /* Device's file descriptor */
int fd
; /* Dumpfile device descriptor */
int nread
; /* Value returned from read() call */
int nwritten
; /* Value returned from write() call */
char *devname
= "/dev/np00";
/* Pathname for device to be dumped */
/* Name of the dump file */
printf("usage: npdump dumpfile [device]\n");
/* Open the device to be dumped */
if ((ed
= open(devname
, O_RDWR
)) == -1) {
(void) sprintf(fullpath
, "/dev/%s", devname
);
if ((ed
= open(devname
,O_RDWR
)) == -1) {
"%s unable to open device %s errno = %d\n",
argv
[0], devname
, errno
);
/* Open/create the dump file */
if ((fd
= open(fname
, O_RDWR
| O_CREAT
)) == -1) {
fprintf(stderr
,"%s: unable to open file %s errno = %d\n",
/* Read from the device and write to the dump file */
while (totalread
< IMAGESIZE
) {
if ((nread
= read(ed
,ibuf
,1024)) > 0) {
nwritten
= write(fd
,ibuf
,nread
);
fprintf(stderr
,"Bad write to %s errno = %d\n",
fprintf(stderr
,"Bad read from %s errno = %d\n", argv
[0],errno
);