From 83c553e35215fba26c75fc6a0f7fdd2eb6e510e2 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Wed, 25 May 1994 00:16:40 -0800 Subject: [PATCH] type cast lseek calls SCCS-vsn: usr.bin/pascal/src/main.c 8.2 SCCS-vsn: usr.bin/pascal/src/yymain.c 8.2 SCCS-vsn: usr.bin/pascal/src/put.c 8.2 SCCS-vsn: usr.bin/pascal/src/savenl.c 8.2 --- usr/src/usr.bin/pascal/src/main.c | 6 +++--- usr/src/usr.bin/pascal/src/put.c | 12 +++++++----- usr/src/usr.bin/pascal/src/savenl.c | 6 +++--- usr/src/usr.bin/pascal/src/yymain.c | 12 +++++++----- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/usr/src/usr.bin/pascal/src/main.c b/usr/src/usr.bin/pascal/src/main.c index 935ea31287..45cdd9f486 100644 --- a/usr/src/usr.bin/pascal/src/main.c +++ b/usr/src/usr.bin/pascal/src/main.c @@ -12,7 +12,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 8.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 8.2 (Berkeley) %G%"; #endif /* not lint */ #include "whoami.h" @@ -80,7 +80,6 @@ main(argc, argv) register c; FILE *fopen(); extern char *myctime(); - extern long lseek(); int i; if (argv[0][0] == 'a') @@ -419,7 +418,8 @@ geterr(seekpt, buf) char *buf; { - (void) lseek(efil, (long) seekpt, 0); + if (lseek(efil, (off_t) seekpt, 0) == -1) + perror(err_file), pexit(DIED); if (read(efil, buf, 256) <= 0) perror(err_file), pexit(DIED); } diff --git a/usr/src/usr.bin/pascal/src/put.c b/usr/src/usr.bin/pascal/src/put.c index aa66cd4024..2aed2b57fe 100644 --- a/usr/src/usr.bin/pascal/src/put.c +++ b/usr/src/usr.bin/pascal/src/put.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)put.c 8.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)put.c 8.2 (Berkeley) %G%"; #endif /* not lint */ #include "whoami.h" @@ -697,7 +697,6 @@ patchfil(loc, jmploc, words) int words; { register i; - extern long lseek(); short val; if ( !CGENNING ) @@ -720,9 +719,12 @@ patchfil(loc, jmploc, words) if (i >= 0 && i < 1024) { obuf[i] = val; } else { - (void) lseek(ofil, (long) loc+2, 0); - write(ofil, (char *) (&val), 2); - (void) lseek(ofil, (long) 0, 2); + if (lseek(ofil, (off_t) loc+2, 0) == -1) + perror("patchfil: lseek1"), panic("patchfil"); + if (write(ofil, (char *) (&val), 2) != 2) + perror("patchfil: write"), panic("patchfil"); + if (lseek(ofil, (off_t) 0, 2) == -1) + perror("patchfil: lseek2"), panic("patchfil"); } loc += 2; # ifdef DEC11 diff --git a/usr/src/usr.bin/pascal/src/savenl.c b/usr/src/usr.bin/pascal/src/savenl.c index fd759eca2c..66ad055d92 100644 --- a/usr/src/usr.bin/pascal/src/savenl.c +++ b/usr/src/usr.bin/pascal/src/savenl.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)savenl.c 8.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)savenl.c 8.2 (Berkeley) %G%"; #endif /* not lint */ /* @@ -106,7 +106,6 @@ startnlfile() copynlfile() { register int n; - extern long lseek(); int symfd, strfd, filesfd, linesfd; char buff[BUFSIZ]; @@ -126,7 +125,8 @@ copynlfile() fprintf(stderr, "sync error on /tmp/obj"); pexit(ERRS); } - (void) lseek(ofil, 0L, 2); + if (lseek(ofil, (off_t)0, 2) == -1) + perror("copynlfile: lseek"), panic("copynlfile"); write(ofil, (char *) (&nlhdr), sizeof(nlhdr)); n = read(strfd, buff, BUFSIZ - sizeof(nlhdr)); write(ofil, buff, n); diff --git a/usr/src/usr.bin/pascal/src/yymain.c b/usr/src/usr.bin/pascal/src/yymain.c index 127529978b..fa7eb5ac77 100644 --- a/usr/src/usr.bin/pascal/src/yymain.c +++ b/usr/src/usr.bin/pascal/src/yymain.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)yymain.c 8.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)yymain.c 8.2 (Berkeley) %G%"; #endif /* not lint */ #include "whoami.h" @@ -115,7 +115,8 @@ copyfile() perror(firstname); pexit(ERRS); } - (void) lseek(fout[0], 0l, 0); + if (lseek(fout[0], (off_t)0, 0) == -1) + perror("copyfile: lseek"), panic("copyfile"); while ((c = read(fout[0], &fout[3], 512)) > 0) { if (write(1, &fout[3], c) != c) { perror(firstname); @@ -160,7 +161,6 @@ magic() magic2() { struct pxhdr pxhd; - extern long lseek(); if (magichdr.a_magic != 0407) panic ( "magic2" ); @@ -172,9 +172,11 @@ magic2() magichdr.a_data += pxhd.symtabsize; (void) time((long *) (&pxhd.maketime)); pxhd.magicnum = MAGICNUM; - (void) lseek(ofil, 0l, 0); + if (lseek(ofil, (off_t)0, 0) == -1) + perror("magic2: lseek1"), panic("magic2"); write(ofil, (char *) (&magichdr), sizeof(struct exec)); - (void) lseek(ofil, ( long ) ( HEADER_BYTES - sizeof ( pxhd ) ) , 0); + if (lseek(ofil, (off_t)(HEADER_BYTES - sizeof(pxhd)), 0) == -1) + perror("magic2: lseek2"), panic("magic2"); write(ofil, (char *) (&pxhd), sizeof (pxhd)); } #endif OBJ -- 2.20.1