summaryrefslogtreecommitdiff
path: root/usr.sbin/rmt/rmt.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-03 07:48:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-03 07:48:28 +0000
commitdb2b64176c0a04f45fbc3afe1cb22f16ca0211f0 (patch)
treec186d57d85fb4f973c0ddc4e330f4bcd8f56158b /usr.sbin/rmt/rmt.c
parentcfb8dd20c353de74cf76f8d6108bf88886e2f149 (diff)
fix a bunch of sloppy c uses
Diffstat (limited to 'usr.sbin/rmt/rmt.c')
-rw-r--r--usr.sbin/rmt/rmt.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c
index 133b180b3ad..f5f21b1d47c 100644
--- a/usr.sbin/rmt/rmt.c
+++ b/usr.sbin/rmt/rmt.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)rmt.c 5.6 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: rmt.c,v 1.4 1997/06/30 05:54:31 millert Exp $";
+static char rcsid[] = "$Id: rmt.c,v 1.5 1998/06/03 07:48:27 deraadt Exp $";
#endif /* not lint */
/*
@@ -61,7 +61,6 @@ int tape = -1;
char *record;
int maxrecsize = -1;
-char *checkbuf();
#define SSIZE 64
char device[SSIZE];
@@ -74,6 +73,7 @@ FILE *debug;
#define DEBUG1(f,a) if (debug) fprintf(debug, f, a)
#define DEBUG2(f,a1,a2) if (debug) fprintf(debug, f, a1, a2)
+char *checkbuf __P((char *, int));
void getstring __P((char *));
void error __P((int));
@@ -82,6 +82,7 @@ main(argc, argv)
int argc;
char **argv;
{
+ off_t orval;
int rval;
char c;
int n, i, cc;
@@ -107,14 +108,14 @@ top:
DEBUG2("rmtd: O %s %s\n", device, mode);
tape = open(device, atoi(mode),
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
- if (tape < 0)
+ if (tape == -1)
goto ioerror;
goto respond;
case 'C':
DEBUG("rmtd: C\n");
getstring(device); /* discard */
- if (close(tape) < 0)
+ if (close(tape) == -1)
goto ioerror;
tape = -1;
goto respond;
@@ -122,8 +123,8 @@ top:
case 'L':
getstring(count); getstring(pos);
DEBUG2("rmtd: L %s %s\n", count, pos);
- rval = lseek(tape, strtoq(count, NULL, 0), atoi(pos));
- if (rval < 0)
+ orval = lseek(tape, strtoq(count, NULL, 0), atoi(pos));
+ if (orval == -1)
goto ioerror;
goto respond;
@@ -163,7 +164,7 @@ top:
{ struct mtop mtop;
mtop.mt_op = atoi(op);
mtop.mt_count = atoi(count);
- if (ioctl(tape, MTIOCTOP, (char *)&mtop) < 0)
+ if (ioctl(tape, MTIOCTOP, (char *)&mtop) == -1)
goto ioerror;
rval = mtop.mt_count;
}
@@ -172,7 +173,7 @@ top:
case 'S': /* status */
DEBUG("rmtd: S\n");
{ struct mtget mtget;
- if (ioctl(tape, MTIOCGET, (char *)&mtget) < 0)
+ if (ioctl(tape, MTIOCGET, (char *)&mtget) == -1)
goto ioerror;
rval = sizeof (mtget);
(void) sprintf(resp, "A%d\n", rval);
@@ -216,8 +217,6 @@ checkbuf(record, size)
char *record;
int size;
{
- extern char *malloc();
-
if (size <= maxrecsize)
return (record);
if (record != 0)
@@ -229,7 +228,7 @@ checkbuf(record, size)
}
maxrecsize = size;
while (size > 1024 &&
- setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) < 0)
+ setsockopt(0, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)) == -1)
size -= 1024;
return (record);
}