+ if ((file_size = stbuf.st_size) == 0)
+ file_size = LONG_MAX;
+ return(f);
+}
+
+/*
+ * magic --
+ * check for file magic numbers. This code would best be shared with
+ * the file(1) program or, perhaps, more should not try and be so smart?
+ */
+static
+magic(f, fs)
+ FILE *f;
+ char *fs;
+{
+ struct exec ex;
+
+ if (fread(&ex, sizeof(ex), 1, f) == 1)
+ switch(ex.a_magic) {
+ case OMAGIC:
+ case NMAGIC:
+ case ZMAGIC:
+ case 0405:
+ case 0411:
+ case 0177545:
+ printf("\n******** %s: Not a text file ********\n\n", fs);
+ (void)fclose(f);
+ return(1);
+ }
+ (void)fseek(f, 0L, L_SET); /* rewind() not necessary */
+ return(0);