--- fileunix.c.orig	2005-10-16 11:34:27.000000000 -0400
+++ fileunix.c	2007-03-01 02:19:05.000000000 -0500
@@ -94,7 +94,6 @@
 #	 define __AR_SMALL__
 #	 define __AR_BIG__
 # endif
-
 # include <ar.h>
 # endif	
 
@@ -317,6 +316,27 @@
 	    sscanf( ar_hdr.ar_date, "%ld", &lar_date );
 	    sscanf( ar_hdr.ar_size, "%ld", &lar_size );
 
+#ifdef AR_EFMT1
+            if (!memcmp(ar_hdr.ar_name,AR_EFMT1,sizeof(AR_EFMT1)-1))
+            {
+              long bsd_name_length;
+              sscanf(ar_hdr.ar_name+3,"%ld",&bsd_name_length);
+              if (bsd_name_length > 255)
+              {
+                printf("BSD extended filename too long");
+              }
+              else if (read(fd,lar_name,bsd_name_length) == bsd_name_length)
+              {
+                lar_name[bsd_name_length] = '\0';
+              }
+              else
+              {
+                printf("error reading BSD extended file name");
+              }
+
+            }
+            else
+#endif
 	    if (ar_hdr.ar_name[0] == '/')
 	    {
 		if (ar_hdr.ar_name[1] == '/')
@@ -349,7 +369,7 @@
 	    }
 
 	    c = lar_name - 1;
-	    while( *++c != ' ' && *c != '/' )
+	    while( *++c != ' ' && *c != '/' && *c != '\0')
 		;
 	    *c = '\0';
 
