Made it compile under FreeBSD and fixed a small bug
This commit is contained in:
parent
19d644a821
commit
fc2b9b93f4
20
Makefile
20
Makefile
@ -19,12 +19,18 @@
|
||||
# options
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
UNAME != uname
|
||||
|
||||
# CFLAGS = -O2 -Wall
|
||||
# LDFLAGS =
|
||||
|
||||
CFLAGS = -g -Wall
|
||||
LDFLAGS = -g
|
||||
|
||||
ifeq ($(UNAME),FreeBSD)
|
||||
LIBS=-lcompat
|
||||
endif
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# You shouldn't have to change anything below this point, but if you do please
|
||||
# let me know why so I can improve this Makefile.
|
||||
@ -55,19 +61,19 @@ clean:
|
||||
rm -f $(PROGRAMS) $(MISC_TARGETS) *.o
|
||||
|
||||
|
||||
tapecopy: tapecopy.o tapeio.o
|
||||
tapecopy: tapecopy.o tapeio.o $(LIBS)
|
||||
|
||||
tapedump: tapedump.o tapeio.o
|
||||
tapedump: tapedump.o tapeio.o $(LIBS)
|
||||
|
||||
taperead: taperead.o tapeio.o
|
||||
taperead: taperead.o tapeio.o $(LIBS)
|
||||
|
||||
tapewrite: tapewrite.o tapeio.o
|
||||
tapewrite: tapewrite.o tapeio.o $(LIBS)
|
||||
|
||||
t10backup: t10backup.o tapeio.o
|
||||
t10backup: t10backup.o tapeio.o $(LIBS)
|
||||
|
||||
read20: read20.o tapeio.o
|
||||
read20: read20.o tapeio.o $(LIBS)
|
||||
|
||||
tapex: tapex.o tapeio.o
|
||||
tapex: tapex.o tapeio.o $(LIBS)
|
||||
|
||||
|
||||
include $(SOURCES:.c=.d)
|
||||
|
||||
11
tapeio.c
11
tapeio.c
@ -64,6 +64,10 @@
|
||||
struct mtop { int mt_op; int mt_count; };
|
||||
#else
|
||||
#include <sys/mtio.h>
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#define MTSETBLK MTSETBSIZ
|
||||
#define MTSETDENSITY MTSETDNSTY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "tapeio.h"
|
||||
@ -424,6 +428,7 @@ int getrec (tape_handle_t mtape, void *buf, int len)
|
||||
{
|
||||
unsigned char byte [4]; /* 32 bits for length field(s) */
|
||||
unsigned long l; /* at least 32 bits */
|
||||
int i;
|
||||
|
||||
if (mtape->tape_type == TT_IMAGE)
|
||||
{ /* image file */
|
||||
@ -454,21 +459,23 @@ int getrec (tape_handle_t mtape, void *buf, int len)
|
||||
{ /* rmt tape server */
|
||||
len = sprintf (mtape->netbuf, "R%d\n", len);
|
||||
dowrite (mtape->tapefd, mtape->netbuf, len);
|
||||
if ((l = response (mtape)) < 0)
|
||||
if ((i = response (mtape)) < 0)
|
||||
{
|
||||
perror("?Error reading tape");
|
||||
exit(1);
|
||||
}
|
||||
l = i;
|
||||
if (l)
|
||||
doread (mtape->tapefd, buf, l);
|
||||
}
|
||||
else
|
||||
{ /* local tape drive */
|
||||
if ((l = read (mtape->tapefd, buf, len)) < 0)
|
||||
if ((i = read (mtape->tapefd, buf, len)) < 0)
|
||||
{
|
||||
perror("?Error reading tape");
|
||||
exit(1);
|
||||
}
|
||||
l = i;
|
||||
}
|
||||
return(l);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user