[BusyBox-cvs] busybox/archival rpm.c,NONE,1.1 Config.in,1.3,1.4 Makefile.in,1.2,1.3 cpio.c,1.10,1.11

Glenn McGrath bug1 at busybox.net
Tue Dec 10 00:17:24 UTC 2002


Update of /var/cvs/busybox/archival
In directory winder:/tmp/cvs-serv20172/archival

Modified Files:
	Config.in Makefile.in cpio.c 
Added Files:
	rpm.c 
Log Message:
rpm applet by Laurence Anderson


--- NEW FILE: rpm.c ---
/* vi: set sw=4 ts=4: */
/*
 * Mini rpm applet for busybox
 *
 * Copyright (C) 2001,2002 by Laurence Anderson
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[...312 lines suppressed...]

void fileaction_list(char *filename, int fileref)
{
	printf("%s\n", filename);
}

void loop_through_files(int filetag, void (*fileaction)(char *filename, int fileref))
{
	int count = 0;
	char *filename, *tmp_dirname, *tmp_basename;
	while (rpm_getstring(filetag, count)) {
		tmp_dirname = rpm_getstring(RPMTAG_DIRNAMES, rpm_getint(RPMTAG_DIRINDEXES, count)); /* 1st put on the directory */
		tmp_basename = rpm_getstring(RPMTAG_BASENAMES, count);
		filename = xmalloc(strlen(tmp_basename) + strlen(tmp_dirname) + 1);
		strcpy(filename, tmp_dirname); /* First the directory name */
		strcat(filename, tmp_basename); /* then the filename */
		fileaction(filename, count++);
		free(filename);
	}
}

Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/archival/Config.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Config.in	6 Dec 2002 22:40:54 -0000	1.3
+++ Config.in	10 Dec 2002 00:17:20 -0000	1.4
@@ -139,7 +139,13 @@
 	bool "rpm2cpio"
 	default n
 	help
-	  Please submit a patch to add help text for this item.
+	  Converts an RPM file into a CPIO archive.
+
+config CONFIG_RPM
+	bool "rpm"
+	default n
+	help
+	  Mini RPM applet - querys and extracts
 
 config CONFIG_TAR
 	bool "tar"

Index: Makefile.in
===================================================================
RCS file: /var/cvs/busybox/archival/Makefile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.in	1 Nov 2002 23:38:50 -0000	1.2
+++ Makefile.in	10 Dec 2002 00:17:20 -0000	1.3
@@ -32,6 +32,7 @@
 ARCHIVAL-$(CONFIG_GUNZIP)	+= gunzip.o
 ARCHIVAL-$(CONFIG_GZIP)		+= gzip.o
 ARCHIVAL-$(CONFIG_RPM2CPIO)	+= rpm2cpio.o
+ARCHIVAL-$(CONFIG_RPM)		+= rpm.o
 ARCHIVAL-$(CONFIG_TAR)		+= tar.o
 ARCHIVAL-$(CONFIG_UNCOMPRESS)	+= uncompress.o
 ARCHIVAL-$(CONFIG_UNZIP)	+= unzip.o

Index: cpio.c
===================================================================
RCS file: /var/cvs/busybox/archival/cpio.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cpio.c	8 Dec 2002 00:54:29 -0000	1.10
+++ cpio.c	10 Dec 2002 00:17:20 -0000	1.11
@@ -31,12 +31,6 @@
 #include "unarchive.h"
 #include "busybox.h"
 
-typedef struct hardlinks_s {
-	file_header_t *entry;
-	int inode;
-	struct hardlinks_s *next;
-} hardlinks_t;
-
 extern int cpio_main(int argc, char **argv)
 {
[...142 lines suppressed...]
-						error_msg("%s not created: newer or same age file exists", file_header->name);
-					}
-					extract_flag = FALSE;
-				}
-			}
-			archive_handle->action_header(file_header);
-		}
-
-		archive_handle->action_header(file_header);
-		if (extract_flag) {
-			archive_handle->action_data(archive_handle);
-		} else {
-			data_skip(archive_handle);
-		}
-		archive_handle->offset += file_header->size;
-	}
+	while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
 
 	return(EXIT_SUCCESS);
 }




More information about the busybox-cvs mailing list