1
0
mirror of https://github.com/brouhaha/tapeutils.git synced 2026-01-11 23:53:18 +00:00

Fix build errors and warnings.

This commit is contained in:
Lars Brinkhoff 2016-10-27 11:29:45 +02:00
parent 8a6704c84e
commit fe77ac2e79
5 changed files with 10 additions and 14 deletions

View File

@ -25,6 +25,7 @@
#include <utime.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define _REGEX_RE_COMP
#include <regex.h>
@ -98,18 +99,13 @@ extern char *re_comp();
void punt (int prterrno, char *fmt, ...)
{
extern int errno, sys_nerr;
va_list ap;
va_start (ap, fmt);
vfprintf(stderr, fmt, ap);
va_end (ap);
if (prterrno) {
fprintf(stderr, ": ");
if (errno >= 0 && errno < sys_nerr)
perror("");
else
fprintf(stderr, "ERRNO = %d\n", errno);
fprintf(stderr, ": %s\n", strerror(errno));
}
else
fprintf(stderr, "\n");

View File

@ -98,7 +98,7 @@ int main (int argc, char *argv[])
if (! srcfn)
fatal (1, NULL);
buf = (char *) malloc (MAX_REC_LEN);
buf = malloc (MAX_REC_LEN);
if (! buf)
fatal (2, "can't allocate buffer\n");

View File

@ -326,7 +326,7 @@ int main (int argc, char *argv[])
len = getrec (src, buf, MAX_REC_LEN);
if (len == 0)
{
printf ("total length of file %d = %d records, %d bytes\n",
printf ("total length of file %d = %d records, %u bytes\n",
file, record, filebytes);
tapebytes += filebytes;
file++;

View File

@ -105,7 +105,7 @@ static struct mtop mt_setden={ MTSETDENSITY, 0x02 }; /* density = 1600 */
/* do a write and check the return status, punt on error */
static void dowrite (int handle, char *buf, int len)
static void dowrite (int handle, void *buf, int len)
{
if (write (handle, buf, len) != len)
{
@ -116,7 +116,7 @@ static void dowrite (int handle, char *buf, int len)
/* do a read and keep trying until we get all bytes */
static void doread (int handle, char *buf, int len)
static void doread (int handle, void *buf, int len)
{
int n;
while(len)
@ -408,7 +408,7 @@ void posneot (tape_handle_t mtape)
/* read a tape record, return actual length (0=tape mark) */
int getrec (tape_handle_t mtape, char *buf, int len)
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 */
@ -465,7 +465,7 @@ int getrec (tape_handle_t mtape, char *buf, int len)
/* write a tape record */
void putrec (tape_handle_t mtape, char *buf, int len)
void putrec (tape_handle_t mtape, void *buf, int len)
{
unsigned char l [4];

View File

@ -37,10 +37,10 @@ void posnbot (tape_handle_t h);
void posneot (tape_handle_t h);
/* read a tape record, return actual length (0=tape mark) */
int getrec (tape_handle_t h, char *buf, int len);
int getrec (tape_handle_t h, void *buf, int len);
/* write a tape record */
void putrec (tape_handle_t h, char *buf, int len);
void putrec (tape_handle_t h, void *buf, int len);
/* write a tape mark */
void tapemark (tape_handle_t h);