This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / usr.bin / file / is_tar.c
index e0c32d7..2b8eb10 100644 (file)
@@ -5,18 +5,24 @@
  * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
  *
  * @(#)list.c 1.18 9/23/86 Public Domain - gnu
  * Pubic Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).
  *
  * @(#)list.c 1.18 9/23/86 Public Domain - gnu
+ * is_tar.c,v 1.2 1993/06/10 00:38:12 jtc Exp
  *
  * Comments changed and some code/comments reformatted
  * for file command by Ian Darwin.
  */
 
  *
  * Comments changed and some code/comments reformatted
  * for file command by Ian Darwin.
  */
 
+#include <string.h>
 #include <ctype.h>
 #include <sys/types.h>
 #include "tar.h"
 
 #define        isodigit(c)     ( ((c) >= '0') && ((c) <= '7') )
 
 #include <ctype.h>
 #include <sys/types.h>
 #include "tar.h"
 
 #define        isodigit(c)     ( ((c) >= '0') && ((c) <= '7') )
 
-long from_oct();                       /* Decode octal number */
+#if    defined(__STDC__) || defined(__cplusplus)
+static long from_oct(int, char*);      /* Decode octal number */
+#else
+static long from_oct();
+#endif
 
 /*
  * Return 
 
 /*
  * Return 
@@ -25,9 +31,10 @@ long from_oct();                     /* Decode octal number */
  *     2 for Unix Std (POSIX) tar file.
  */
 int
  *     2 for Unix Std (POSIX) tar file.
  */
 int
-is_tar(header)
-       register union record *header;
+is_tar(buf)
+unsigned char *buf;
 {
 {
+       register union record *header = (union record *)buf;
        register int    i;
        register long   sum, recsum;
        register char   *p;
        register int    i;
        register long   sum, recsum;
        register char   *p;
@@ -36,7 +43,7 @@ is_tar(header)
 
        sum = 0;
        p = header->charptr;
 
        sum = 0;
        p = header->charptr;
-       for (i = sizeof(*header); --i >= 0;) {
+       for (i = sizeof(union record); --i >= 0;) {
                /*
                 * We can't use unsigned char here because of old compilers,
                 * e.g. V7.
                /*
                 * We can't use unsigned char here because of old compilers,
                 * e.g. V7.
@@ -64,7 +71,7 @@ is_tar(header)
  *
  * Result is -1 if the field is invalid (all blank, or nonoctal).
  */
  *
  * Result is -1 if the field is invalid (all blank, or nonoctal).
  */
-long
+static long
 from_oct(digs, where)
        register int    digs;
        register char   *where;
 from_oct(digs, where)
        register int    digs;
        register char   *where;