Minor cleanups and clarifications.
[oweals/busybox.git] / ar.c
diff --git a/ar.c b/ar.c
index bd54bb6b869b5806cb2ab710d8cfc1ab70a9f49c..5aba30de0fe5bffa017afaa13ab1d09bb12502e6 100644 (file)
--- a/ar.c
+++ b/ar.c
  *
  */
 #include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
 #include "busybox.h"
 
 typedef struct ar_headers_s {
@@ -39,7 +43,7 @@ typedef struct ar_headers_s {
 /*
  * return the headerL_t struct for the filename descriptor
  */
-static ar_headers_t get_headers(int srcFd)
+extern ar_headers_t get_headers(int srcFd)
 {
        typedef struct raw_ar_header_s {        /* Byte Offset */
                char name[16];  /*  0-15 */
@@ -61,9 +65,9 @@ static ar_headers_t get_headers(int srcFd)
        
        /* check ar magic */
        if (full_read(srcFd, ar_magic, 8) != 8)
-               error_msg_and_die("cannot read magic\n");
+               error_msg_and_die("cannot read magic");
        if (strncmp(ar_magic,"!<arch>",7) != 0)
-               error_msg_and_die("invalid magic\n");
+               error_msg_and_die("invalid magic");
 
        while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) {
                /* check the end of header markers are valid */
@@ -164,7 +168,7 @@ extern int ar_main(int argc, char **argv)
                usage(ar_usage);
        
        if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
-               error_msg_and_die("Cannot read %s\n", argv[optind]);
+               error_msg_and_die("Cannot read %s", argv[optind]);
 
        optind++;       
        head = get_headers(srcFd);