Applied patch from Gennady Feldman to use single-thread instead of forking.
[oweals/busybox.git] / rpmunpack.c
index 512d6383922ea898126635b6f16c93c9021ade4e..12e9c71de33e0fd21d008dfec3f24f0add9d3083 100644 (file)
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  */
  
-#include "busybox.h" 
 #include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include "busybox.h" 
 
 /*
  * Some general definitions
@@ -41,7 +44,7 @@ static void myread(int num, char *buffer)
        if (err < 0)
                perror_msg_and_die(progname);
        else
-               error_msg_and_die("Unexpected end of input file!\n");
+               error_msg_and_die("Unexpected end of input file!");
   }
 }
 
@@ -51,7 +54,7 @@ static void myread(int num, char *buffer)
 int rpmunpack_main(int argc, char **argv)
 {
   int len, status = 0;
-  char buffer[BUFSIZ];
+  RESERVE_BB_BUFFER(buffer, BUFSIZ);
 
   /* Get our own program name */
   if ((progname = strrchr(argv[0], '/')) == NULL)
@@ -61,7 +64,7 @@ int rpmunpack_main(int argc, char **argv)
 
   /* Check for command line parameters */
        if (argc>=2 && *argv[1]=='-') {
-           usage(rpmunpack_usage);
+           show_usage();
        }
 
   /* Open input file */