recognize PRESS files
authorBill Joy <root@ucbvax.Berkeley.EDU>
Sun, 21 Feb 1982 03:15:39 +0000 (19:15 -0800)
committerBill Joy <root@ucbvax.Berkeley.EDU>
Sun, 21 Feb 1982 03:15:39 +0000 (19:15 -0800)
SCCS-vsn: usr.bin/file/file.c 4.2

usr/src/usr.bin/file/file.c

index 6a0848f..dbe5061 100644 (file)
@@ -1,4 +1,4 @@
-static char sccsid[] = "@(#)file.c 4.1 %G%";
+static char sccsid[] = "@(#)file.c 4.1 10/1/80";
 /*
  * file - determine type of file
  */
 /*
  * file - determine type of file
  */
@@ -153,6 +153,14 @@ exec:
                printf("archive\n");
                goto out;
        }
                printf("archive\n");
                goto out;
        }
+       if (mbuf.st_size % 512 == 0) {  /* it may be a PRESS file */
+               lseek(ifile, -512L, 2); /* last block */
+               if (read(ifile, buf, BUFSIZ) > 0
+                && *(short int *)buf == 12138) {
+                       printf("PRESS file\n");
+                       goto out;
+               }
+       }
        i = 0;
        if(ccom() == 0)goto notc;
        while(buf[i] == '#'){
        i = 0;
        if(ccom() == 0)goto notc;
        while(buf[i] == '#'){