type cast lseek calls
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 25 May 1994 08:16:40 +0000 (00:16 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 25 May 1994 08:16:40 +0000 (00:16 -0800)
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
usr/src/usr.bin/pascal/src/put.c
usr/src/usr.bin/pascal/src/savenl.c
usr/src/usr.bin/pascal/src/yymain.c

index 935ea31..45cdd9f 100644 (file)
@@ -12,7 +12,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #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"
 #endif /* not lint */
 
 #include "whoami.h"
@@ -80,7 +80,6 @@ main(argc, argv)
        register c;
        FILE *fopen();
        extern char *myctime();
        register c;
        FILE *fopen();
        extern char *myctime();
-       extern long lseek();
        int i;
 
        if (argv[0][0] == 'a')
        int i;
 
        if (argv[0][0] == 'a')
@@ -419,7 +418,8 @@ geterr(seekpt, buf)
        char *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);
 }
        if (read(efil, buf, 256) <= 0)
                perror(err_file), pexit(DIED);
 }
index aa66cd4..2aed2b5 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 #include "whoami.h"
@@ -697,7 +697,6 @@ patchfil(loc, jmploc, words)
        int words;
 {
        register i;
        int words;
 {
        register i;
-       extern long lseek();
        short val;
 
        if ( !CGENNING )
        short val;
 
        if ( !CGENNING )
@@ -720,9 +719,12 @@ patchfil(loc, jmploc, words)
                if (i >= 0 && i < 1024) {
                        obuf[i] = val;
                } else {
                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
                }
                loc += 2;
 #              ifdef DEC11
index fd759ec..66ad055 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savenl.c   8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)savenl.c   8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -106,7 +106,6 @@ startnlfile()
 copynlfile()
 {
        register int n;
 copynlfile()
 {
        register int n;
-       extern long lseek();
        int symfd, strfd, filesfd, linesfd;
        char buff[BUFSIZ];
 
        int symfd, strfd, filesfd, linesfd;
        char buff[BUFSIZ];
 
@@ -126,7 +125,8 @@ copynlfile()
                fprintf(stderr, "sync error on /tmp/obj");
                pexit(ERRS);
        }
                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);
        write(ofil, (char *) (&nlhdr), sizeof(nlhdr));
        n = read(strfd, buff, BUFSIZ - sizeof(nlhdr));
        write(ofil, buff, n);
index 1275299..fa7eb5a 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 #include "whoami.h"
@@ -115,7 +115,8 @@ copyfile()
                perror(firstname);
                pexit(ERRS);
        }
                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);
        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;
 magic2()
 {
        struct pxhdr pxhd;
-       extern long lseek();
 
        if  (magichdr.a_magic != 0407)
                panic ( "magic2" );
 
        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;
        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));
        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
        write(ofil, (char *) (&pxhd), sizeof (pxhd));
 }
 #endif OBJ