Major coreutils update.
diff --git a/archival/ar.c b/archival/ar.c
index 87968f7..57ec927 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -40,7 +40,7 @@
 
 static void header_verbose_list_ar(const file_header_t *file_header)
 {
-	const char *mode = mode_string(file_header->mode);
+	const char *mode = bb_mode_string(file_header->mode);
 	char *mtime;
 
 	mtime = ctime(&file_header->mtime);
@@ -58,7 +58,7 @@
 	int dst_fd;
 
 	file_header = archive_handle->file_header;
-	dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT);
+	dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT);
 	archive_copy_file(archive_handle, dst_fd);	
 	close(dst_fd);
 
@@ -110,16 +110,16 @@
 			archive_handle->action_header = header_verbose_list_ar;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
  
 	/* check the src filename was specified */
 	if (optind == argc) {
-		show_usage();
+		bb_show_usage();
 	}
 
-	archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
+	archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
 
 	/* TODO: This is the same as in tar, seperate function ? */
 	while (optind < argc) {
@@ -133,7 +133,7 @@
 #else
 	archive_xread_all(archive_handle, magic, 7);
 	if (strncmp(magic, "!<arch>", 7) != 0) {
-		error_msg_and_die("Invalid ar magic");
+		bb_error_msg_and_die("Invalid ar magic");
 	}
 	archive_handle->offset += 7;
 
diff --git a/archival/bunzip2.c b/archival/bunzip2.c
index d5c06f4..eb5238c 100644
--- a/archival/bunzip2.c
+++ b/archival/bunzip2.c
@@ -41,7 +41,7 @@
 	char *delete_name = NULL;
 
 	/* if called as bzcat */
-	if (strcmp(applet_name, "bzcat") == 0)
+	if (strcmp(bb_applet_name, "bzcat") == 0)
 		flags |= bunzip_to_stdout;
 
 	while ((opt = getopt(argc, argv, "cfh")) != -1) {
@@ -54,7 +54,7 @@
 			break;
 		case 'h':
 		default:
-			show_usage(); /* exit's inside usage */
+			bb_show_usage(); /* exit's inside usage */
 		}
 	}
 
@@ -64,23 +64,23 @@
 		src_fd = fileno(stdin);
 	} else {
 		/* Open input file */
-		src_fd = xopen(argv[optind], O_RDONLY);
+		src_fd = bb_xopen(argv[optind], O_RDONLY);
 
-		save_name = xstrdup(argv[optind]);
+		save_name = bb_xstrdup(argv[optind]);
 		if (strcmp(save_name + strlen(save_name) - 4, ".bz2") != 0)
-			error_msg_and_die("Invalid extension");
+			bb_error_msg_and_die("Invalid extension");
 		save_name[strlen(save_name) - 4] = '\0';
 	}
 
 	/* Check that the input is sane.  */
 	if (isatty(src_fd) && (flags & bunzip_force) == 0) {
-		error_msg_and_die("compressed data not read from terminal.  Use -f to force it.");
+		bb_error_msg_and_die("compressed data not read from terminal.  Use -f to force it.");
 	}
 
 	if (flags & bunzip_to_stdout) {
 		dst_fd = fileno(stdout);
 	} else {
-		dst_fd = xopen(save_name, O_WRONLY | O_CREAT);
+		dst_fd = bb_xopen(save_name, O_WRONLY | O_CREAT);
 	}
 
 	if (uncompressStream(src_fd, dst_fd)) {
@@ -96,7 +96,7 @@
 	}
 
 	if ((delete_name) && (unlink(delete_name) < 0)) {
-		error_msg_and_die("Couldn't remove %s", delete_name);
+		bb_error_msg_and_die("Couldn't remove %s", delete_name);
 	}
 
 	return status;
diff --git a/archival/cpio.c b/archival/cpio.c
index 49f3f88..111807c 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -63,11 +63,11 @@
 			archive_handle->action_header = header_list;
 			break;
 		case 'F':
-			archive_handle->src_fd = xopen(optarg, O_RDONLY);
+			archive_handle->src_fd = bb_xopen(optarg, O_RDONLY);
 			archive_handle->seek = seek_by_jump;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 
diff --git a/archival/dpkg.c b/archival/dpkg.c
index 6925922..3288f7e 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -177,7 +177,7 @@
 			}
 		}
 	}
-	name_hashtable[probe_address] = xstrdup(key);
+	name_hashtable[probe_address] = bb_xstrdup(key);
 	return(probe_address);
 }
 
@@ -218,10 +218,10 @@
 	int ret;
 
 	if (version1 == NULL) {
-		version1 = xstrdup("");
+		version1 = bb_xstrdup("");
 	}
 	if (version2 == NULL) {
-		version2 = xstrdup("");
+		version2 = bb_xstrdup("");
 	}
 	upstream_len1 = strlen(version1);
 	upstream_len2 = strlen(version2);
@@ -229,10 +229,10 @@
 	while ((len1 < upstream_len1) || (len2 < upstream_len2)) {
 		/* Compare non-digit section */
 		tmp_int = strcspn(&version1[len1], "0123456789");
-		name1_char = xstrndup(&version1[len1], tmp_int);
+		name1_char = bb_xstrndup(&version1[len1], tmp_int);
 		len1 += tmp_int;
 		tmp_int = strcspn(&version2[len2], "0123456789");
-		name2_char = xstrndup(&version2[len2], tmp_int);
+		name2_char = bb_xstrndup(&version2[len2], tmp_int);
 		len2 += tmp_int;
 		tmp_int = strcmp(name1_char, name2_char);
 		free(name1_char);
@@ -244,10 +244,10 @@
 
 		/* Compare digits */
 		tmp_int = strspn(&version1[len1], "0123456789");
-		name1_char = xstrndup(&version1[len1], tmp_int);
+		name1_char = bb_xstrndup(&version1[len1], tmp_int);
 		len1 += tmp_int;
 		tmp_int = strspn(&version2[len2], "0123456789");
-		name2_char = xstrndup(&version2[len2], tmp_int);
+		name2_char = bb_xstrndup(&version2[len2], tmp_int);
 		len2 += tmp_int;
 		ver_num1 = atoi(name1_char);
 		ver_num2 = atoi(name2_char);
@@ -306,8 +306,8 @@
 	}
 
 	/* Compare upstream version */
-	upstream_ver1 = xstrdup(ver1_ptr);
-	upstream_ver2 = xstrdup(ver2_ptr);
+	upstream_ver1 = bb_xstrdup(ver1_ptr);
+	upstream_ver2 = bb_xstrdup(ver2_ptr);
 
 	/* Chop off debian version, and store for later use */
 	deb_ver1 = strrchr(upstream_ver1, '-');
@@ -397,7 +397,7 @@
  */
 void add_split_dependencies(common_node_t *parent_node, const char *whole_line, unsigned int edge_type)
 {
-	char *line = xstrdup(whole_line);
+	char *line = bb_xstrdup(whole_line);
 	char *line2;
 	char *line_ptr1 = NULL;
 	char *line_ptr2 = NULL;
@@ -410,7 +410,7 @@
 
 	field = strtok_r(line, ",", &line_ptr1);
 	do {
-		line2 = xstrdup(field);
+		line2 = bb_xstrdup(field);
 		field2 = strtok_r(line2, "|", &line_ptr2);
 		if ((edge_type == EDGE_DEPENDS) && (strcmp(field, field2) != 0)) {
 			type = EDGE_OR_DEPENDS;
@@ -457,7 +457,7 @@
 					else if (strncmp(version, ">=", offset_ch) == 0) {
 						edge->operator = VER_MORE_EQUAL;
 					} else {
-						error_msg_and_die("Illegal operator\n");
+						bb_error_msg_and_die("Illegal operator\n");
 					}
 				}
 				/* skip to start of version numbers */
@@ -588,7 +588,7 @@
 		status_string += strspn(status_string, " ");
 	}
 	len = strcspn(status_string, " \n\0");
-	state_sub_string = xstrndup(status_string, len);
+	state_sub_string = bb_xstrndup(status_string, len);
 	state_sub_num = search_name_hashtable(state_sub_string);
 	free(state_sub_string);
 	return(state_sub_num);
@@ -620,7 +620,7 @@
 			status_len = new_value_len;
 			break;
 		default:
-			error_msg_and_die("DEBUG ONLY: this shouldnt happen");
+			bb_error_msg_and_die("DEBUG ONLY: this shouldnt happen");
 	}
 
 	new_status = (char *) xmalloc(want_len + flag_len + status_len + 3);
@@ -638,7 +638,7 @@
 	status_node_t *status_node = NULL;
 	unsigned int status_num;
 
-	status_file = xfopen(filename, "r");
+	status_file = bb_xfopen(filename, "r");
 	while ((control_buffer = fgets_str(status_file, "\n\n")) != NULL) {
 		const unsigned int package_num = fill_package_struct(control_buffer);
 		if (package_num != -1) {
@@ -648,7 +648,7 @@
 			if (status_line != NULL) {
 				status_line += 7;
 				status_line += strspn(status_line, " \n\t");
-				status_line = xstrndup(status_line, strcspn(status_line, "\n\0"));
+				status_line = bb_xstrndup(status_line, strcspn(status_line, "\n\0"));
 				status_node->status = search_name_hashtable(status_line);
 				free(status_line);
 			}
@@ -754,8 +754,8 @@
 /* This could do with a cleanup */
 void write_status_file(deb_file_t **deb_file)
 {
-	FILE *old_status_file = xfopen("/var/lib/dpkg/status", "r");
-	FILE *new_status_file = xfopen("/var/lib/dpkg/status.udeb", "w");
+	FILE *old_status_file = bb_xfopen("/var/lib/dpkg/status", "r");
+	FILE *new_status_file = bb_xfopen("/var/lib/dpkg/status.udeb", "w");
 	char *package_name;
 	char *status_from_file;
 	char *control_buffer = NULL;
@@ -773,14 +773,14 @@
 
 		tmp_string += 8;
  		tmp_string += strspn(tmp_string, " \n\t");
-		package_name = xstrndup(tmp_string, strcspn(tmp_string, "\n\0"));
+		package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0"));
 		write_flag = FALSE;
 		tmp_string = strstr(control_buffer, "Status:");
 		if (tmp_string != NULL) {
 			/* Seperate the status value from the control buffer */
 			tmp_string += 7;
 			tmp_string += strspn(tmp_string, " \n\t");
-			status_from_file = xstrndup(tmp_string, strcspn(tmp_string, "\n"));
+			status_from_file = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n"));
 		} else {
 			status_from_file = NULL;
 		}
@@ -810,7 +810,7 @@
 					}
 					/* This is temperary, debugging only */
 					if (deb_file[i] == NULL) {
-						error_msg_and_die("ALERT: Couldnt find a control file, your status file may be broken, status may be incorrect for %s", package_name);
+						bb_error_msg_and_die("ALERT: Couldnt find a control file, your status file may be broken, status may be incorrect for %s", package_name);
 					}
 				}
 				else if (strcmp("not-installed", name_hashtable[state_status]) == 0) {
@@ -881,15 +881,15 @@
 	if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
 		struct stat stat_buf;	
 		if (stat("/var/lib/dpkg/status", &stat_buf) == 0) {
-			error_msg_and_die("Couldnt create backup status file");
+			bb_error_msg_and_die("Couldnt create backup status file");
 		}
 		/* Its ok if renaming the status file fails becasue status 
 		 * file doesnt exist, maybe we are starting from scratch */
-		error_msg("No status file found, creating new one");
+		bb_error_msg("No status file found, creating new one");
 	}
 
 	if (rename("/var/lib/dpkg/status.udeb", "/var/lib/dpkg/status") == -1) {
-		error_msg_and_die("DANGER: Couldnt create status file, you need to manually repair your status file");
+		bb_error_msg_and_die("DANGER: Couldnt create status file, you need to manually repair your status file");
 	}
 }
 
@@ -976,7 +976,7 @@
 				}
 
 				if (result) {
-					error_msg_and_die("Package %s conflicts with %s",
+					bb_error_msg_and_die("Package %s conflicts with %s",
 						name_hashtable[package_node->name],
 						name_hashtable[package_edge->name]);
 				}
@@ -1021,7 +1021,7 @@
 					}
 
 					if (result) {
-						error_msg_and_die("Package %s pre-depends on %s, but it is not installed",
+						bb_error_msg_and_die("Package %s pre-depends on %s, but it is not installed",
 							name_hashtable[package_node->name],
 							name_hashtable[package_edge->name]);
 					}
@@ -1038,7 +1038,7 @@
 					}
 					/* It must be already installed, or to be installed */
 					if (result) {
-						error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed",
+						bb_error_msg_and_die("Package %s depends on %s, but it is not installed, or flaged to be installed",
 							name_hashtable[package_node->name],
 							name_hashtable[package_edge->name]);
 					}
@@ -1065,9 +1065,8 @@
 		return(NULL);
 	}
 
-	while ((line = get_line_from_file(list_stream)) != NULL) {
+	while ((line = bb_get_chomped_line_from_file(list_stream)) != NULL) {
 		file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
-		chomp(line);
 		file_list[count] = line;
 		count++;
 	}
@@ -1228,7 +1227,7 @@
 	/* run prerm script */
 	return_value = run_package_script(package_name, "prerm");
 	if (return_value == -1) {
-		error_msg_and_die("script failed, prerm failure");
+		bb_error_msg_and_die("script failed, prerm failure");
 	}
 
 	/* Create a list of files to remove, and a seperate list of those to keep */
@@ -1245,7 +1244,7 @@
 
 	/* Create a list of files in /var/lib/dpkg/info/<package>.* to keep  */
 	exclude_files = xmalloc(sizeof(char*) * 3);
-	exclude_files[0] = xstrdup(conffile_name);
+	exclude_files[0] = bb_xstrdup(conffile_name);
 	exclude_files[1] = xmalloc(package_name_length + 27);
 	sprintf(exclude_files[1], "/var/lib/dpkg/info/%s.postrm", package_name);
 	exclude_files[2] = NULL;
@@ -1275,7 +1274,7 @@
 
 	/* run prerm script */
 	if (run_package_script(package_name, "prerm") != 0) {
-		error_msg_and_die("script failed, prerm failure");
+		bb_error_msg_and_die("script failed, prerm failure");
 	}
 
 	/* Create a list of files to remove */
@@ -1297,7 +1296,7 @@
 
 	/* run postrm script */
 	if (run_package_script(package_name, "postrm") == -1) {
-		error_msg_and_die("postrm fialure.. set status to what?");
+		bb_error_msg_and_die("postrm fialure.. set status to what?");
 	}
 
 	/* Change package status */
@@ -1312,7 +1311,7 @@
 	/* Setup an ar archive handle that refers to the gzip sub archive */	
 	ar_handle = init_handle();
 	ar_handle->filter = filter_accept_list_reassign;
-	ar_handle->src_fd = xopen(filename, O_RDONLY);
+	ar_handle->src_fd = bb_xopen(filename, O_RDONLY);
 
 	return(ar_handle);	
 }
@@ -1420,7 +1419,7 @@
 	/* Run the preinst prior to extracting */
 	if (run_package_script(package_name, "preinst") != 0) {
 		/* when preinst returns exit code != 0 then quit installation process */
-		error_msg_and_die("subprocess pre-installation script returned error.");
+		bb_error_msg_and_die("subprocess pre-installation script returned error.");
 	}	
 
 	/* Extract data.tar.gz to the root directory */
@@ -1430,7 +1429,7 @@
 
 	/* Create the list file */
 	strcat(info_prefix, "list");
-	out_stream = xfopen(info_prefix, "w");			
+	out_stream = bb_xfopen(info_prefix, "w");			
 	while (archive_handle->passed) {
 		/* blindly skip over the leading '.' */
 		fputs(archive_handle->passed->data + 1, out_stream);
@@ -1457,7 +1456,7 @@
 	/* Run the postinst script */
 	if (run_package_script(package_name, "postinst") != 0) {
 		/* TODO: handle failure gracefully */
-		error_msg_and_die("postrm failure.. set status to what?");
+		bb_error_msg_and_die("postrm failure.. set status to what?");
 	}
 	/* Change status to reflect success */
 	set_status(status_num, "install", 1);
@@ -1506,12 +1505,12 @@
 				dpkg_opt |= dpkg_opt_filename;
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 	/* check for non-otion argument if expected  */
 	if ((dpkg_opt == 0) || ((argc == optind) && !(dpkg_opt && dpkg_opt_list_installed))) {
-		show_usage();
+		bb_show_usage();
 	}
 
 /*	puts("(Reading database ... xxxxx files and directories installed.)"); */
@@ -1538,13 +1537,13 @@
 			init_archive_deb_control(archive_handle);
 			deb_file[deb_count]->control_file = deb_extract_control_file_to_buffer(archive_handle, control_list);
 			if (deb_file[deb_count]->control_file == NULL) {
-				error_msg_and_die("Couldnt extract control file");
+				bb_error_msg_and_die("Couldnt extract control file");
 			}
-			deb_file[deb_count]->filename = xstrdup(argv[optind]);
+			deb_file[deb_count]->filename = bb_xstrdup(argv[optind]);
 			package_num = fill_package_struct(deb_file[deb_count]->control_file);
 
 			if (package_num == -1) {
-				error_msg("Invalid control file in %s", argv[optind]);
+				bb_error_msg("Invalid control file in %s", argv[optind]);
 				continue;
 			}
 			deb_file[deb_count]->package = (unsigned int) package_num;
@@ -1574,7 +1573,7 @@
 				search_name_hashtable(argv[optind]),
 				search_name_hashtable("ANY"), VER_ANY);
 			if (package_hashtable[deb_file[deb_count]->package] == NULL) {
-				error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]);
+				bb_error_msg_and_die("Package %s is uninstalled or unknown\n", argv[optind]);
 			}
 			state_status = get_status(search_status_hashtable(name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]), 3);
 
@@ -1582,13 +1581,13 @@
 			if (dpkg_opt & dpkg_opt_remove) {
 				if ((strcmp(name_hashtable[state_status], "not-installed") == 0) ||
 					(strcmp(name_hashtable[state_status], "config-files") == 0)) {
-					error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
+					bb_error_msg_and_die("%s is already removed.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
 				}
 			}
 			else if (dpkg_opt & dpkg_opt_purge) {
 				/* if package status is "conf-files" then its ok */
 				if (strcmp(name_hashtable[state_status], "not-installed") == 0) {
-					error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
+					bb_error_msg_and_die("%s is already purged.", name_hashtable[package_hashtable[deb_file[deb_count]->package]->name]);
 				}
 			}
 		}
@@ -1601,7 +1600,7 @@
 	/* TODO: check dependencies before removing */
 	if ((dpkg_opt & dpkg_opt_force_ignore_depends) != dpkg_opt_force_ignore_depends) {
 		if (!check_deps(deb_file, 0, deb_count)) {
-			error_msg_and_die("Dependency check failed");
+			bb_error_msg_and_die("Dependency check failed");
 		}
 	}
 
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 2c33822..2d7383f 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -82,15 +82,15 @@
 				tar_archive->action_data = data_extract_all;
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
 	if (optind + 2 < argc)  {
-		show_usage();
+		bb_show_usage();
 	}
 
-	tar_archive->src_fd = ar_archive->src_fd = xopen(argv[optind++], O_RDONLY);
+	tar_archive->src_fd = ar_archive->src_fd = bb_xopen(argv[optind++], O_RDONLY);
 
 	/* Workout where to extract the files */
 	/* 2nd argument is a dir name */
diff --git a/archival/gunzip.c b/archival/gunzip.c
index e9963a8..3350da0 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -82,7 +82,7 @@
 	int opt;
 
 	/* if called as zcat */
-	if (strcmp(applet_name, "zcat") == 0) {
+	if (strcmp(bb_applet_name, "zcat") == 0) {
 		flags |= gunzip_to_stdout;
 	}
 
@@ -100,7 +100,7 @@
 		case 'd':		/* Used to convert gzip to gunzip. */
 			break;
 		default:
-			show_usage();	/* exit's inside usage */
+			bb_show_usage();	/* exit's inside usage */
 		}
 	}
 
@@ -118,29 +118,29 @@
 			src_fd = fileno(stdin);
 			flags |= gunzip_to_stdout;
 		} else {
-			src_fd = xopen(old_path, O_RDONLY);
+			src_fd = bb_xopen(old_path, O_RDONLY);
 
 			/* Get the time stamp on the input file. */
 			if (stat(old_path, &stat_buf) < 0) {
-				error_msg_and_die("Couldn't stat file %s", old_path);
+				bb_error_msg_and_die("Couldn't stat file %s", old_path);
 			}
 		}
 
 		/* Check that the input is sane.  */
 		if (isatty(src_fd) && ((flags & gunzip_force) == 0)) {
-			error_msg_and_die
+			bb_error_msg_and_die
 				("compressed data not read from terminal.  Use -f to force it.");
 		}
 
 		/* Set output filename and number */
 		if (flags & gunzip_test) {
-			dst_fd = xopen("/dev/null", O_WRONLY);	/* why does test use filenum 2 ? */
+			dst_fd = bb_xopen("/dev/null", O_WRONLY);	/* why does test use filenum 2 ? */
 		} else if (flags & gunzip_to_stdout) {
 			dst_fd = fileno(stdout);
 		} else {
 			char *extension;
 
-			new_path = xstrdup(old_path);
+			new_path = bb_xstrdup(old_path);
 
 			extension = strrchr(new_path, '.');
 #ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
@@ -154,11 +154,11 @@
 				extension[2] = 'a';
 				extension[3] = 'r';
 			} else {
-				error_msg_and_die("Invalid extension");
+				bb_error_msg_and_die("Invalid extension");
 			}
 
 			/* Open output file */
-			dst_fd = xopen(new_path, O_WRONLY | O_CREAT);
+			dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
 
 			/* Set permissions on the file */
 			chmod(new_path, stat_buf.st_mode);
@@ -168,10 +168,10 @@
 		}
 
 		/* do the decompression, and cleanup */
-		if (xread_char(src_fd) == 0x1f) {
+		if (bb_xread_char(src_fd) == 0x1f) {
 			unsigned char magic2;
 			
-			magic2 = xread_char(src_fd);
+			magic2 = bb_xread_char(src_fd);
 #ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
 			if (magic2 == 0x9d) {
 				status = uncompress(src_fd, dst_fd);
@@ -181,14 +181,14 @@
 					check_header_gzip(src_fd);
 					status = inflate(src_fd, dst_fd);
 					if (status != 0) {
-						error_msg_and_die("Error inflating");
+						bb_error_msg_and_die("Error inflating");
 					}
 					check_trailer_gzip(src_fd);
 				} else {
-					error_msg_and_die("Invalid magic");
+					bb_error_msg_and_die("Invalid magic");
 				}
 		} else {
-			error_msg_and_die("Invalid magic");
+			bb_error_msg_and_die("Invalid magic");
 		}
 
 		if ((status != EXIT_SUCCESS) && (new_path)) {
@@ -205,7 +205,7 @@
 
 		/* delete_path will be NULL if in test mode or from stdin */
 		if (delete_path && (unlink(delete_path) == -1)) {
-			error_msg_and_die("Couldn't remove %s", delete_path);
+			bb_error_msg_and_die("Couldn't remove %s", delete_path);
 		}
 
 		free(new_path);
diff --git a/archival/gzip.c b/archival/gzip.c
index 971724d..cabc4aa 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -187,7 +187,7 @@
 
 /* Diagnostic functions */
 #ifdef DEBUG
-#  define Assert(cond,msg) {if(!(cond)) error_msg(msg);}
+#  define Assert(cond,msg) {if(!(cond)) bb_error_msg(msg);}
 #  define Trace(x) fprintf x
 #  define Tracev(x) {if (verbose) fprintf x ;}
 #  define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -352,10 +352,10 @@
 	bytes_in = 0L;
 }
 
-static void write_error_msg(void)
+static void write_bb_error_msg(void)
 {
 	fputc('\n', stderr);
-	perror_msg("");
+	bb_perror_nomsg();
 	abort_gzip();
 }
 
@@ -369,7 +369,7 @@
 
 	while ((n = write(fd, buf, cnt)) != cnt) {
 		if (n == (unsigned) (-1)) {
-			write_error_msg();
+			write_bb_error_msg();
 		}
 		cnt -= n;
 		buf = (void *) ((char *) buf + n);
@@ -977,11 +977,11 @@
 	/* check that the match is indeed a match */
 	if (memcmp((char *) window + match,
 			   (char *) window + start, length) != EQUAL) {
-		error_msg(" start %d, match %d, length %d", start, match, length);
-		error_msg("invalid match");
+		bb_error_msg(" start %d, match %d, length %d", start, match, length);
+		bb_error_msg("invalid match");
 	}
 	if (verbose > 1) {
-		error_msg("\\[%d,%d]", start - match, length);
+		bb_error_msg("\\[%d,%d]", start - match, length);
 		do {
 			putc(window[start++], stderr);
 		} while (--length != 0);
@@ -1232,7 +1232,7 @@
 			return gunzip_main(argc, argv);
 #endif
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 
@@ -1282,7 +1282,7 @@
 			} else {
 				inFileNum = open(argv[i], O_RDONLY);
 				if (inFileNum < 0 || fstat(inFileNum, &statBuf) < 0)
-					perror_msg_and_die("%s", argv[i]);
+					bb_perror_msg_and_die("%s", argv[i]);
 				time_stamp = statBuf.st_ctime;
 				ifile_size = statBuf.st_size;
 
@@ -1299,7 +1299,7 @@
 					outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL);
 #endif
 					if (outFileNum < 0) {
-						perror_msg("%s", path);
+						bb_perror_msg("%s", path);
 						free(path);
 						continue;
 					}
@@ -1311,7 +1311,7 @@
 			}
 
 			if (path == NULL && isatty(outFileNum) && force == 0) {
-				error_msg
+				bb_error_msg
 					("compressed data not written to a terminal. Use -f to force compression.");
 				free(path);
 				continue;
@@ -1330,7 +1330,7 @@
 					delFileName = path;
 
 				if (unlink(delFileName) < 0)
-					perror_msg("%s", delFileName);
+					bb_perror_msg("%s", delFileName);
 			}
 
 			free(path);
@@ -1655,7 +1655,7 @@
 
 #else							/* DEBUG */
 #  define send_code(c, tree) \
-     { if (verbose>1) error_msg("\ncd %3d ",(c)); \
+     { if (verbose>1) bb_error_msg("\ncd %3d ",(c)); \
        send_bits(tree[c].Code, tree[c].Len); }
 #endif
 
@@ -2035,7 +2035,7 @@
 		tree[n].Dad = tree[m].Dad = (ush) node;
 #ifdef DUMP_BL_TREE
 		if (tree == bl_tree) {
-			error_msg("\nnode %d(%d), sons %d(%d) %d(%d)",
+			bb_error_msg("\nnode %d(%d), sons %d(%d) %d(%d)",
 					node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
 		}
 #endif
@@ -2273,7 +2273,7 @@
 	if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
 		/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
 		if (buf == (char *) 0)
-			error_msg("block vanished");
+			bb_error_msg("block vanished");
 
 		copy_block(buf, (unsigned) stored_len, 0);	/* without header */
 		compressed_len = stored_len << 3;
@@ -2442,7 +2442,7 @@
 		bin_freq += dyn_ltree[n++].Freq;
 	*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
 	if (*file_type == BINARY && translate_eol) {
-		error_msg("-l used on binary file");
+		bb_error_msg("-l used on binary file");
 	}
 }
 
diff --git a/archival/libunarchive/archive_copy_file.c b/archival/libunarchive/archive_copy_file.c
index faa8059..675bc6f 100644
--- a/archival/libunarchive/archive_copy_file.c
+++ b/archival/libunarchive/archive_copy_file.c
@@ -35,7 +35,7 @@
 		size = archive_xread(archive_handle, buffer, size);
 
 		if (write(dst_fd, buffer, size) != size) {
-			error_msg_and_die ("Short write");
+			bb_error_msg_and_die ("Short write");
 		}
 		chunksize -= size;
 	}
diff --git a/archival/libunarchive/archive_xread.c b/archival/libunarchive/archive_xread.c
index 7fde4c0..0b29dbf 100644
--- a/archival/libunarchive/archive_xread.c
+++ b/archival/libunarchive/archive_xread.c
@@ -26,7 +26,7 @@
 
 	size = archive_handle->read(archive_handle->src_fd, buf, count);
 	if (size == -1) {
-		perror_msg_and_die("Read error");
+		bb_perror_msg_and_die("Read error");
 	}
 
 	return(size);
diff --git a/archival/libunarchive/archive_xread_all.c b/archival/libunarchive/archive_xread_all.c
index ef8cc01..cfe046b 100644
--- a/archival/libunarchive/archive_xread_all.c
+++ b/archival/libunarchive/archive_xread_all.c
@@ -26,7 +26,7 @@
 
 	size = archive_xread(archive_handle, buf, count);
 	if (size != count) {
-		error_msg_and_die("Short read");
+		bb_error_msg_and_die("Short read");
 	}
 	return;
 }
diff --git a/archival/libunarchive/archive_xread_all_eof.c b/archival/libunarchive/archive_xread_all_eof.c
index 3cfbbd8..23719cd 100644
--- a/archival/libunarchive/archive_xread_all_eof.c
+++ b/archival/libunarchive/archive_xread_all_eof.c
@@ -26,7 +26,7 @@
 
 	size = archive_xread(archive_handle, buf, count);
 	if ((size != 0) && (size != count)) {
-		perror_msg_and_die("Short read, read %d of %d", size, count);
+		bb_perror_msg_and_die("Short read, read %d of %d", size, count);
 	}
 	return(size);
 }
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c
index d661df7..13832c2 100644
--- a/archival/libunarchive/check_header_gzip.c
+++ b/archival/libunarchive/check_header_gzip.c
@@ -15,11 +15,11 @@
 		} formated;
 	} header;
 
-	xread_all(src_fd, header.raw, 8);
+	bb_xread_all(src_fd, header.raw, 8);
 
 	/* Check the compression method */
 	if (header.formated.method != 8) {
-		error_msg_and_die("Unknown compression method %d",
+		bb_error_msg_and_die("Unknown compression method %d",
 						  header.formated.method);
 	}
 
@@ -27,10 +27,10 @@
 		/* bit 2 set: extra field present */
 		unsigned char extra_short;
 
-		extra_short = xread_char(src_fd) + (xread_char(src_fd) << 8);
+		extra_short = bb_xread_char(src_fd) + (bb_xread_char(src_fd) << 8);
 		while (extra_short > 0) {
 			/* Ignore extra field */
-			xread_char(src_fd);
+			bb_xread_char(src_fd);
 			extra_short--;
 		}
 	}
@@ -38,19 +38,19 @@
 	/* Discard original name if any */
 	if (header.formated.flags & 0x08) {
 		/* bit 3 set: original file name present */
-		while(xread_char(src_fd) != 0);
+		while(bb_xread_char(src_fd) != 0);
 	}
 
 	/* Discard file comment if any */
 	if (header.formated.flags & 0x10) {
 		/* bit 4 set: file comment present */
-		while(xread_char(src_fd) != 0);
+		while(bb_xread_char(src_fd) != 0);
 	}
 
 	/* Read the header checksum */
 	if (header.formated.flags & 0x02) {
-		xread_char(src_fd);
-		xread_char(src_fd);
+		bb_xread_char(src_fd);
+		bb_xread_char(src_fd);
 	}
 
 	return;
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 1eb8bb3..77b4de5 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -34,8 +34,8 @@
 	int res;
 
 	if (archive_handle->flags & ARCHIVE_CREATE_LEADING_DIRS) {
-		char *name = xstrdup(file_header->name);
-		make_directory (dirname(name), 0777, FILEUTILS_RECUR);
+		char *name = bb_xstrdup(file_header->name);
+		bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR);
 		free(name);
 	}                  
 
@@ -47,13 +47,13 @@
 				/* hard link */
 				res = link(file_header->link_name, file_header->name);
 				if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
-					perror_msg("Couldnt create hard link");
+					bb_perror_msg("Couldnt create hard link");
 				}
 			} else
 #endif
 			{
 				/* Regular file */
-				dst_fd = xopen(file_header->name, O_WRONLY | O_CREAT);
+				dst_fd = bb_xopen(file_header->name, O_WRONLY | O_CREAT);
 				archive_copy_file(archive_handle, dst_fd);
 				close(dst_fd);
 			}
@@ -63,7 +63,7 @@
 			unlink(file_header->name);
 			res = mkdir(file_header->name, file_header->mode);
 			if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
-				perror_msg("extract_archive: %s", file_header->name);
+				bb_perror_msg("extract_archive: %s", file_header->name);
 			}
 			break;
 		case S_IFLNK:
@@ -71,7 +71,7 @@
 			unlink(file_header->name);
 			res = symlink(file_header->link_name, file_header->name);
 			if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
-				perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
+				bb_perror_msg("Cannot create symlink from %s to '%s'", file_header->name, file_header->link_name);
 			}
 			break;
 		case S_IFSOCK:
@@ -81,11 +81,11 @@
 			unlink(file_header->name);
 			res = mknod(file_header->name, file_header->mode, file_header->device);
 			if ((res == -1) && !(archive_handle->flags & ARCHIVE_EXTRACT_QUIET)) {
-				perror_msg("Cannot create node %s", file_header->name);
+				bb_perror_msg("Cannot create node %s", file_header->name);
 			}
 			break;
 		default:
-			error_msg_and_die("Unrecognised file type");
+			bb_error_msg_and_die("Unrecognised file type");
 	}
 
 	chmod(file_header->name, file_header->mode);
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index 4b611b8..0164b77 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -1548,7 +1548,7 @@
 
 	while (1) {
 		if (bzf->strm.avail_in == 0) {
-			n = xread(bzf->fd, bzf->buf, BZ_MAX_UNUSED);
+			n = bb_xread(bzf->fd, bzf->buf, BZ_MAX_UNUSED);
 			if (n == 0) {
 				break;
 			}
@@ -1560,7 +1560,7 @@
 		ret = BZ2_bzDecompress(&(bzf->strm));
 
 		if ((ret != BZ_OK) && (ret != BZ_STREAM_END)) {
-			error_msg_and_die("Error decompressing");
+			bb_error_msg_and_die("Error decompressing");
 		}
 
 		if (ret == BZ_STREAM_END) {
@@ -1628,12 +1628,12 @@
 		while (bzerr == BZ_OK) {
 			nread = read_bz2(src_fd, obuf, 5000);
 			if (bzerr == BZ_DATA_ERROR_MAGIC) {
-				error_msg_and_die("invalid magic");
+				bb_error_msg_and_die("invalid magic");
 			}
 			if (((bzerr == BZ_OK) || (bzerr == BZ_STREAM_END)) && (nread > 0)) {
 				if (write(dst_fd, obuf, nread) != nread) {
 					BZ2_bzReadClose();
-					perror_msg_and_die("Couldnt write to file");
+					bb_perror_msg_and_die("Couldnt write to file");
 				}
 			}
 		}
diff --git a/archival/libunarchive/decompress_uncompress.c b/archival/libunarchive/decompress_uncompress.c
index 192e981..9851ca3 100644
--- a/archival/libunarchive/decompress_uncompress.c
+++ b/archival/libunarchive/decompress_uncompress.c
@@ -121,14 +121,14 @@
 
 	insize = 0;
 
-	inbuf[0] = xread_char(fd_in);
+	inbuf[0] = bb_xread_char(fd_in);
 
 	maxbits = inbuf[0] & BIT_MASK;
 	block_mode = inbuf[0] & BLOCK_MODE;
 	maxmaxcode = MAXCODE(maxbits);
 
 	if (maxbits > BITS) {
-		error_msg("compressed with %d bits, can only handle %d bits", maxbits,
+		bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits,
 				  BITS);
 		return -1;
 	}
@@ -227,11 +227,11 @@
 					posbits -= n_bits;
 					p = &inbuf[posbits >> 3];
 
-					error_msg
+					bb_error_msg
 						("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)",
 						 insize, posbits, p[-1], p[0], p[1], p[2], p[3],
 						 (posbits & 07));
-					error_msg("uncompress: corrupt input");
+					bb_error_msg("uncompress: corrupt input");
 					return -1;
 				}
 
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 3a7334c..2401cf8 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -150,7 +150,7 @@
 		/* Leave the first 4 bytes empty so we can always unwind the bitbuffer 
 		 * to the front of the bytebuffer, leave 4 bytes free at end of tail
 		 * so we can easily top up buffer in check_trailer_gzip() */
-		bytebuffer_size = 4 + xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
+		bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
 		bytebuffer_offset = 4;
 	}
 }
@@ -448,7 +448,7 @@
 		if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
 			do {
 				if (e == 99) {
-					error_msg_and_die("inflate_codes error 1");;
+					bb_error_msg_and_die("inflate_codes error 1");;
 				}
 				b >>= t->b;
 				k -= t->b;
@@ -484,7 +484,7 @@
 			if ((e = (t = td + ((unsigned) b & md))->e) > 16)
 				do {
 					if (e == 99)
-						error_msg_and_die("inflate_codes error 2");;
+						bb_error_msg_and_die("inflate_codes error 2");;
 					b >>= t->b;
 					k -= t->b;
 					e -= 16;
@@ -821,7 +821,7 @@
 
 		if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
 			if (i == 1) {
-				error_msg_and_die("Incomplete literal tree");
+				bb_error_msg_and_die("Incomplete literal tree");
 				huft_free(tl);
 			}
 			return i;	/* incomplete code set */
@@ -830,7 +830,7 @@
 		bd = dbits;
 		if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
 			if (i == 1) {
-				error_msg_and_die("incomplete distance tree");
+				bb_error_msg_and_die("incomplete distance tree");
 				huft_free(td);
 			}
 			huft_free(tl);
@@ -846,7 +846,7 @@
 	}
 	default:
 		/* bad block type */
-		error_msg_and_die("bad block type %d\n", t);
+		bb_error_msg_and_die("bad block type %d\n", t);
 	}
 }
 
@@ -884,7 +884,7 @@
 					break;
 			case -2:	ret = inflate_codes(0,0,0,0,0);
 					break;
-			default:	error_msg_and_die("inflate error %d", method);
+			default:	bb_error_msg_and_die("inflate error %d", method);
 		}
 
 		if (ret == 1) {
@@ -975,16 +975,16 @@
 	ssize_t nread, nwrote;
 
 	GZ_gzReadOpen(in, 0, 0);
-	while(1) { // Robbed from copyfd.c
+	while(1) { // Robbed from bb_copyfd.c
 		nread = read_gz(in, buf, sizeof(buf));
 		if (nread == 0) break; // no data to write
 		else if (nread == -1) {
-			perror_msg("read");
+			bb_perror_msg("read");
 			return -1;
 		}
-		nwrote = full_write(out, buf, nread);
+		nwrote = bb_full_write(out, buf, nread);
 		if (nwrote == -1) {
-			perror_msg("write");
+			bb_perror_msg("write");
 			return -1;
 		}
 	}
@@ -998,9 +998,9 @@
 	GZ_gzReadOpen(in, 0, 0);
 	while(1) {
 		int ret = inflate_get_next_window();
-		nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
+		nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
 		if (nwrote == -1) {
-			perror_msg("write");
+			bb_perror_msg("write");
 			return -1;
 		}
 		if (ret == 0) break;
@@ -1017,7 +1017,7 @@
 	/* top up the input buffer with the rest of the trailer */
 	count = bytebuffer_size - bytebuffer_offset;
 	if (count < 8) {
-		xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
+		bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
 		bytebuffer_size += 8 - count;
 	}
 	for (count = 0; count != 4; count++) {
@@ -1027,14 +1027,14 @@
 
 	/* Validate decompression - crc */
 	if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
-		error_msg_and_die("crc error");
+		bb_error_msg_and_die("crc error");
 	}
 
 	/* Validate decompression - size */
 	if (gunzip_bytes_out !=
 		(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
 		(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
-		error_msg_and_die("Incorrect length, but crc is correct");
+		bb_error_msg_and_die("Incorrect length, but crc is correct");
 	}
 
 }
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index 1e0e6c1..6c576a8 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -41,7 +41,7 @@
 	static unsigned int ar_long_name_size;
 #endif
 
-	/* dont use xread as we want to handle the error ourself */
+	/* dont use bb_xread as we want to handle the error ourself */
 	if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
 		/* End Of File */
 		return(EXIT_FAILURE);
@@ -51,14 +51,14 @@
 	if (ar.raw[0] == '\n') {
 		/* fix up the header, we started reading 1 byte too early */
 		memmove(ar.raw, &ar.raw[1], 59);
-		ar.raw[59] = xread_char(archive_handle->src_fd);
+		ar.raw[59] = bb_xread_char(archive_handle->src_fd);
 		archive_handle->offset++;
 	}
 	archive_handle->offset += 60;
 		
 	/* align the headers based on the header magic */
 	if ((ar.formated.magic[0] != '`') || (ar.formated.magic[1] != '\n')) {
-		error_msg_and_die("Invalid ar header");
+		bb_error_msg_and_die("Invalid ar header");
 	}
 
 	typed->mode = strtol(ar.formated.mode, NULL, 8);
@@ -76,7 +76,7 @@
 			 * in static variable long_names for use in future entries */
 			ar_long_name_size = typed->size;
 			ar_long_names = xmalloc(ar_long_name_size);
-			xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
+			bb_xread_all(archive_handle->src_fd, ar_long_names, ar_long_name_size);
 			archive_handle->offset += ar_long_name_size;
 			/* This ar entries data section only contained filenames for other records
 			 * they are stored in the static ar_long_names for future reference */
@@ -90,16 +90,16 @@
 			(saved in variable long_name) that conatains the real filename */
 			const unsigned int long_offset = atoi(&ar.formated.name[1]);
 			if (long_offset >= ar_long_name_size) {
-				error_msg_and_die("Cant resolve long filename");
+				bb_error_msg_and_die("Cant resolve long filename");
 			}
-			typed->name = xstrdup(ar_long_names + long_offset);
+			typed->name = bb_xstrdup(ar_long_names + long_offset);
 		}
 #else
-		error_msg_and_die("long filenames not supported");
+		bb_error_msg_and_die("long filenames not supported");
 #endif
 	} else {
 		/* short filenames */
-               typed->name = xstrndup(ar.formated.name, 16);
+               typed->name = bb_xstrndup(ar.formated.name, 16);
 	}
 
 	typed->name[strcspn(typed->name, " /")] = '\0';
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index ea08578..975e2a4 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -46,7 +46,7 @@
 		oldtmp = NULL;
 
 		while (tmp) {
-			error_msg_and_die("need to fix this\n");
+			bb_error_msg_and_die("need to fix this\n");
 			if (tmp->entry->link_name) { /* Found a hardlink ready to be extracted */
 				file_header = tmp->entry;
 				if (oldtmp) {
@@ -78,11 +78,11 @@
 			cpio_header[2],
 			cpio_header[3],
 			cpio_header[4]);
-		error_msg_and_die("Unsupported cpio format");
+		bb_error_msg_and_die("Unsupported cpio format");
 	}
 		
 	if ((cpio_header[5] != '1') && (cpio_header[5] != '2')) {
-		error_msg_and_die("Unsupported cpio format, use newc or crc");
+		bb_error_msg_and_die("Unsupported cpio format, use newc or crc");
 	}
 
 	{
@@ -109,7 +109,7 @@
 			hardlinks_t *tmp = saved_hardlinks;
 			hardlinks_t *oldtmp = NULL;
 			while (tmp) {
-				error_msg("%s not created: cannot resolve hardlink", tmp->entry->name);
+				bb_error_msg("%s not created: cannot resolve hardlink", tmp->entry->name);
 				oldtmp = tmp;
 				tmp = tmp->next;
 				free (oldtmp->entry->name);
@@ -142,13 +142,13 @@
 			pending_hardlinks = 1;
 			while (tmp) {
 				if (tmp->inode == inode) {
-					tmp->entry->link_name = xstrdup(file_header->name);
+					tmp->entry->link_name = bb_xstrdup(file_header->name);
 					nlink--;
 				}
 				tmp = tmp->next;
 			}
 			if (nlink > 1) {
-				error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?");
+				bb_error_msg("error resolving hardlink: did you create the archive with GNU cpio 2.0-2.2?");
 			}
 		}
 	}
@@ -165,11 +165,11 @@
 			if ((archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) || (statbuf.st_mtime < file_header->mtime)) {
 				/* Remove file if flag set or its older than the file to be extracted */
 				if (unlink(file_header->name) == -1) {
-					perror_msg_and_die("Couldnt remove old file");
+					bb_perror_msg_and_die("Couldnt remove old file");
 				}
 			} else {
 				if (! archive_handle->flags & ARCHIVE_EXTRACT_QUIET) {
-					error_msg("%s not created: newer or same age file exists", file_header->name);
+					bb_error_msg("%s not created: newer or same age file exists", file_header->name);
 				}
 				extract_flag = FALSE;
 			}
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 2cb141e..365f464 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -75,7 +75,7 @@
 #ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
 		if (strncmp(tar.formated.magic, "\0\0\0\0\0", 5) != 0)
 #endif
-			error_msg_and_die("Invalid tar magic");
+			bb_error_msg_and_die("Invalid tar magic");
 	}
 	/* Do checksum on headers */
 	for (i =  0; i < 148 ; i++) {
@@ -86,7 +86,7 @@
 		sum += tar.raw[i];
 	}
 	if (sum != strtol(tar.formated.chksum, NULL, 8)) {
-		error_msg("Invalid tar header checksum");
+		bb_error_msg("Invalid tar header checksum");
 		return(EXIT_FAILURE);
 	}
 
@@ -116,7 +116,7 @@
 	file_header->size = strtol(tar.formated.size, NULL, 8);
 	file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
 	file_header->link_name = (tar.formated.linkname[0] != '\0') ? 
-	    xstrdup(tar.formated.linkname) : NULL;
+	    bb_xstrdup(tar.formated.linkname) : NULL;
 	file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
 				 strtol(tar.formated.devminor, NULL, 8));
 
@@ -129,7 +129,7 @@
 		file_header->mode |= S_IFREG;
 		break;
 	case '1':
-		error_msg("Internal hard link not supported");
+		bb_error_msg("Internal hard link not supported");
 		break;
 	case '2':
 		file_header->mode |= S_IFLNK;
@@ -170,7 +170,7 @@
 	case 'N':
 	case 'S':
 	case 'V':
-		error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
+		bb_error_msg("Ignoring GNU extension type %c", tar.formated.typeflag);
 # endif
 	}
 #endif
diff --git a/archival/libunarchive/get_header_tar_gz.c b/archival/libunarchive/get_header_tar_gz.c
index a4355d2..7792432 100644
--- a/archival/libunarchive/get_header_tar_gz.c
+++ b/archival/libunarchive/get_header_tar_gz.c
@@ -25,7 +25,7 @@
 
 	archive_xread_all(archive_handle, &magic, 2);
 	if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
-		error_msg_and_die("Invalid gzip magic");
+		bb_error_msg_and_die("Invalid gzip magic");
 	}
 
 	check_header_gzip(archive_handle->src_fd);
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c
index ff7b3bc..6739dd3 100644
--- a/archival/libunarchive/header_verbose_list.c
+++ b/archival/libunarchive/header_verbose_list.c
@@ -9,7 +9,7 @@
 	struct tm *mtime = localtime(&file_header->mtime);
 
 	printf("%s %d/%d%10u %4u-%02u-%02u %02u:%02u:%02u %s",
-		mode_string(file_header->mode),
+		bb_mode_string(file_header->mode),
 		file_header->uid,
 		file_header->gid,
 		(unsigned int) file_header->size,
diff --git a/archival/libunarchive/seek_by_jump.c b/archival/libunarchive/seek_by_jump.c
index 2823976..578870d 100644
--- a/archival/libunarchive/seek_by_jump.c
+++ b/archival/libunarchive/seek_by_jump.c
@@ -30,6 +30,6 @@
 			seek_by_char(archive_handle, amount);
 		} else
 #endif
-			perror_msg_and_die("Seek failure");
+			bb_perror_msg_and_die("Seek failure");
 	}
 }
diff --git a/archival/libunarchive/uncompress.c b/archival/libunarchive/uncompress.c
index 192e981..9851ca3 100644
--- a/archival/libunarchive/uncompress.c
+++ b/archival/libunarchive/uncompress.c
@@ -121,14 +121,14 @@
 
 	insize = 0;
 
-	inbuf[0] = xread_char(fd_in);
+	inbuf[0] = bb_xread_char(fd_in);
 
 	maxbits = inbuf[0] & BIT_MASK;
 	block_mode = inbuf[0] & BLOCK_MODE;
 	maxmaxcode = MAXCODE(maxbits);
 
 	if (maxbits > BITS) {
-		error_msg("compressed with %d bits, can only handle %d bits", maxbits,
+		bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits,
 				  BITS);
 		return -1;
 	}
@@ -227,11 +227,11 @@
 					posbits -= n_bits;
 					p = &inbuf[posbits >> 3];
 
-					error_msg
+					bb_error_msg
 						("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)",
 						 insize, posbits, p[-1], p[0], p[1], p[2], p[3],
 						 (posbits & 07));
-					error_msg("uncompress: corrupt input");
+					bb_error_msg("uncompress: corrupt input");
 					return -1;
 				}
 
diff --git a/archival/libunarchive/unpack_ar_archive.c b/archival/libunarchive/unpack_ar_archive.c
index afa3672..e8f113b 100644
--- a/archival/libunarchive/unpack_ar_archive.c
+++ b/archival/libunarchive/unpack_ar_archive.c
@@ -26,7 +26,7 @@
 
 	archive_xread_all(ar_archive, magic, 7);
 	if (strncmp(magic, "!<arch>", 7) != 0) {
-		error_msg_and_die("Invalid ar magic");
+		bb_error_msg_and_die("Invalid ar magic");
 	}
 	ar_archive->offset += 7;
 
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index 3a7334c..2401cf8 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -150,7 +150,7 @@
 		/* Leave the first 4 bytes empty so we can always unwind the bitbuffer 
 		 * to the front of the bytebuffer, leave 4 bytes free at end of tail
 		 * so we can easily top up buffer in check_trailer_gzip() */
-		bytebuffer_size = 4 + xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
+		bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], BYTEBUFFER_MAX - 8);
 		bytebuffer_offset = 4;
 	}
 }
@@ -448,7 +448,7 @@
 		if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
 			do {
 				if (e == 99) {
-					error_msg_and_die("inflate_codes error 1");;
+					bb_error_msg_and_die("inflate_codes error 1");;
 				}
 				b >>= t->b;
 				k -= t->b;
@@ -484,7 +484,7 @@
 			if ((e = (t = td + ((unsigned) b & md))->e) > 16)
 				do {
 					if (e == 99)
-						error_msg_and_die("inflate_codes error 2");;
+						bb_error_msg_and_die("inflate_codes error 2");;
 					b >>= t->b;
 					k -= t->b;
 					e -= 16;
@@ -821,7 +821,7 @@
 
 		if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
 			if (i == 1) {
-				error_msg_and_die("Incomplete literal tree");
+				bb_error_msg_and_die("Incomplete literal tree");
 				huft_free(tl);
 			}
 			return i;	/* incomplete code set */
@@ -830,7 +830,7 @@
 		bd = dbits;
 		if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
 			if (i == 1) {
-				error_msg_and_die("incomplete distance tree");
+				bb_error_msg_and_die("incomplete distance tree");
 				huft_free(td);
 			}
 			huft_free(tl);
@@ -846,7 +846,7 @@
 	}
 	default:
 		/* bad block type */
-		error_msg_and_die("bad block type %d\n", t);
+		bb_error_msg_and_die("bad block type %d\n", t);
 	}
 }
 
@@ -884,7 +884,7 @@
 					break;
 			case -2:	ret = inflate_codes(0,0,0,0,0);
 					break;
-			default:	error_msg_and_die("inflate error %d", method);
+			default:	bb_error_msg_and_die("inflate error %d", method);
 		}
 
 		if (ret == 1) {
@@ -975,16 +975,16 @@
 	ssize_t nread, nwrote;
 
 	GZ_gzReadOpen(in, 0, 0);
-	while(1) { // Robbed from copyfd.c
+	while(1) { // Robbed from bb_copyfd.c
 		nread = read_gz(in, buf, sizeof(buf));
 		if (nread == 0) break; // no data to write
 		else if (nread == -1) {
-			perror_msg("read");
+			bb_perror_msg("read");
 			return -1;
 		}
-		nwrote = full_write(out, buf, nread);
+		nwrote = bb_full_write(out, buf, nread);
 		if (nwrote == -1) {
-			perror_msg("write");
+			bb_perror_msg("write");
 			return -1;
 		}
 	}
@@ -998,9 +998,9 @@
 	GZ_gzReadOpen(in, 0, 0);
 	while(1) {
 		int ret = inflate_get_next_window();
-		nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
+		nwrote = bb_full_write(out, gunzip_window, gunzip_outbuf_count);
 		if (nwrote == -1) {
-			perror_msg("write");
+			bb_perror_msg("write");
 			return -1;
 		}
 		if (ret == 0) break;
@@ -1017,7 +1017,7 @@
 	/* top up the input buffer with the rest of the trailer */
 	count = bytebuffer_size - bytebuffer_offset;
 	if (count < 8) {
-		xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
+		bb_xread_all(src_fd, &bytebuffer[bytebuffer_size], 8 - count);
 		bytebuffer_size += 8 - count;
 	}
 	for (count = 0; count != 4; count++) {
@@ -1027,14 +1027,14 @@
 
 	/* Validate decompression - crc */
 	if (stored_crc != (gunzip_crc ^ 0xffffffffL)) {
-		error_msg_and_die("crc error");
+		bb_error_msg_and_die("crc error");
 	}
 
 	/* Validate decompression - size */
 	if (gunzip_bytes_out !=
 		(bytebuffer[bytebuffer_offset] | (bytebuffer[bytebuffer_offset+1] << 8) |
 		(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
-		error_msg_and_die("Incorrect length, but crc is correct");
+		bb_error_msg_and_die("Incorrect length, but crc is correct");
 	}
 
 }
diff --git a/archival/rpm.c b/archival/rpm.c
index 61486cb..5bde532 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -116,7 +116,7 @@
 			break;
 		case 'q': // First arg: Query mode
 			if (!func) func |= rpm_query;
-			else show_usage();
+			else bb_show_usage();
 			break;
 		case 'p': // Query a package
 			func |= rpm_query_package;
@@ -133,13 +133,13 @@
 			func |= rpm_query_list_config;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 
-	if (optind == argc) show_usage();
+	if (optind == argc) bb_show_usage();
 	while (optind < argc) {
-		rpm_fd = xopen(argv[optind], O_RDONLY);
+		rpm_fd = bb_xopen(argv[optind], O_RDONLY);
 		mytags = rpm_gettags(rpm_fd, (int *) &tagcount);
 		offset = lseek(rpm_fd, 0, SEEK_CUR);
 		if (!mytags) { printf("Error reading rpm header\n"); exit(-1); }
@@ -206,9 +206,9 @@
 	archive_handle->src_fd = fd;
 	archive_handle->offset = 0;
 	
-	xread_all(archive_handle->src_fd, &magic, 2);
+	bb_xread_all(archive_handle->src_fd, &magic, 2);
 	if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
-		error_msg_and_die("Invalid gzip magic");
+		bb_error_msg_and_die("Invalid gzip magic");
 	}
 	check_header_gzip(archive_handle->src_fd);	
 	chdir("/"); // Install RPM's to root
@@ -314,7 +314,7 @@
 	if (rpm_getint(RPMTAG_FILEFLAGS, fileref) & RPMFILE_CONFIG) { /* Only need to backup config files */
 		stat_res = lstat (filename, &oldfile);
 		if (stat_res == 0 && S_ISREG(oldfile.st_mode)) { /* File already exists  - really should check MD5's etc to see if different */
-			newname = xstrdup(filename);
+			newname = bb_xstrdup(filename);
 			newname = strcat(newname, ".rpmorig");
 			copy_file(filename, newname, FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS);
 			remove_file(filename, FILEUTILS_RECUR | FILEUTILS_FORCE);
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 66f6808..bb9f695 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -52,12 +52,12 @@
 {
 	struct rpm_header header;
 
-	xread_all(rpm_fd, &header, sizeof(struct rpm_header));
+	bb_xread_all(rpm_fd, &header, sizeof(struct rpm_header));
 	if (strncmp((char *) &header.magic, RPM_HEADER_MAGIC, 3) != 0) {
-		error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
+		bb_error_msg_and_die("Invalid RPM header magic"); /* Invalid magic */
 	}
 	if (header.version != 1) {
-		error_msg_and_die("Unsupported RPM header version"); /* This program only supports v1 headers */
+		bb_error_msg_and_die("Unsupported RPM header version"); /* This program only supports v1 headers */
 	}
 	header.entries = ntohl(header.entries);
 	header.size = ntohl(header.size);
@@ -75,12 +75,12 @@
 	if (argc == 1) {
 		rpm_fd = fileno(stdin);
 	} else {
-		rpm_fd = xopen(argv[1], O_RDONLY);
+		rpm_fd = bb_xopen(argv[1], O_RDONLY);
 	}
 
-	xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
+	bb_xread_all(rpm_fd, &lead, sizeof(struct rpm_lead));
 	if (strncmp((char *) &lead.magic, RPM_MAGIC, 4) != 0) {
-		error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
+		bb_error_msg_and_die("Invalid RPM magic"); /* Just check the magic, the rest is irrelevant */
 	}
 
 	/* Skip the signature header */
@@ -90,14 +90,14 @@
 	/* Skip the main header */
 	skip_header(rpm_fd);
 	
-	xread_all(rpm_fd, &magic, 2);
+	bb_xread_all(rpm_fd, &magic, 2);
 	if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
-		error_msg_and_die("Invalid gzip magic");
+		bb_error_msg_and_die("Invalid gzip magic");
 	}
 
 	check_header_gzip(rpm_fd);
 	if (inflate(rpm_fd, fileno(stdout)) != 0) {
-		error_msg("Error inflating");
+		bb_error_msg("Error inflating");
 	}
 	check_trailer_gzip(rpm_fd);
 
diff --git a/archival/tar.c b/archival/tar.c
index fa1c575..c39d578 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -278,7 +278,7 @@
 		header.typeflag = REGTYPE;
 		putOctal(header.size, sizeof(header.size), statbuf->st_size);
 	} else {
-		error_msg("%s: Unknown file type", real_name);
+		bb_error_msg("%s: Unknown file type", real_name);
 		return (FALSE);
 	}
 
@@ -295,9 +295,9 @@
 
 	/* Now write the header out to disk */
 	if ((size =
-		 full_write(tbInfo->tarFd, (char *) &header,
+		 bb_full_write(tbInfo->tarFd, (char *) &header,
 					sizeof(struct TarHeader))) < 0) {
-		error_msg(io_error, real_name);
+		bb_error_msg(bb_msg_io_error, real_name);
 		return (FALSE);
 	}
 	/* Pad the header up to the tar block size */
@@ -368,7 +368,7 @@
 
 	/* It is against the rules to archive a socket */
 	if (S_ISSOCK(statbuf->st_mode)) {
-		error_msg("%s: socket ignored", fileName);
+		bb_error_msg("%s: socket ignored", fileName);
 		return (TRUE);
 	}
 
@@ -377,7 +377,7 @@
 	 * the new tarball */
 	if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
 		tbInfo->statBuf.st_ino == statbuf->st_ino) {
-		error_msg("%s: file is the archive; skipping", fileName);
+		bb_error_msg("%s: file is the archive; skipping", fileName);
 		return (TRUE);
 	}
 
@@ -386,14 +386,14 @@
 		static int alreadyWarned = FALSE;
 
 		if (alreadyWarned == FALSE) {
-			error_msg("Removing leading '/' from member names");
+			bb_error_msg("Removing leading '/' from member names");
 			alreadyWarned = TRUE;
 		}
 		header_name++;
 	}
 
 	if (strlen(fileName) >= NAME_SIZE) {
-		error_msg(name_longer_than_foo, NAME_SIZE);
+		bb_error_msg(bb_msg_name_longer_than_foo, NAME_SIZE);
 		return (TRUE);
 	}
 
@@ -419,21 +419,21 @@
 
 		/* open the file we want to archive, and make sure all is well */
 		if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
-			perror_msg("%s: Cannot open", fileName);
+			bb_perror_msg("%s: Cannot open", fileName);
 			return (FALSE);
 		}
 
 		/* write the file to the archive */
-		while ((size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0) {
-			if (full_write(tbInfo->tarFd, buffer, size) != size) {
+		while ((size = bb_full_read(inputFileFd, buffer, sizeof(buffer))) > 0) {
+			if (bb_full_write(tbInfo->tarFd, buffer, size) != size) {
 				/* Output file seems to have a problem */
-				error_msg(io_error, fileName);
+				bb_error_msg(bb_msg_io_error, fileName);
 				return (FALSE);
 			}
 			readSize += size;
 		}
 		if (size == -1) {
-			error_msg(io_error, fileName);
+			bb_error_msg(bb_msg_io_error, fileName);
 			return (FALSE);
 		}
 		/* Pad the file up to the tar block size */
@@ -464,7 +464,7 @@
 
 	/* Make sure there is at least one file to tar up.  */
 	if (include == NULL) {
-		error_msg_and_die("Cowardly refusing to create an empty archive");
+		bb_error_msg_and_die("Cowardly refusing to create an empty archive");
 	}
 
 	/* Open the tar file for writing.  */
@@ -477,7 +477,7 @@
 	}
 
 	if (tbInfo.tarFd < 0) {
-		perror_msg("%s: Cannot open", tarName);
+		bb_perror_msg("%s: Cannot open", tarName);
 		freeHardLinkInfo(&tbInfo.hlInfoHead);
 		return (FALSE);
 	}
@@ -485,12 +485,12 @@
 	/* Store the stat info for the tarball's file, so
 	 * can avoid including the tarball into itself....  */
 	if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
-		error_msg_and_die(io_error, tarName);
+		bb_error_msg_and_die(bb_msg_io_error, tarName);
 
 #ifdef CONFIG_FEATURE_TAR_GZIP
 	if (gzip) {
 		if (pipe(gzipDataPipe) < 0 || pipe(gzipStatusPipe) < 0) {
-			perror_msg_and_die("Failed to create gzip pipe");
+			bb_perror_msg_and_die("Failed to create gzip pipe");
 		}
 
 		signal(SIGPIPE, SIG_IGN);	/* we only want EPIPE on errors */
@@ -529,7 +529,7 @@
 
 				if (n == 0 && vfork_exec_errno != 0) {
 					errno = vfork_exec_errno;
-					perror_msg_and_die("Could not exec gzip process");
+					bb_perror_msg_and_die("Could not exec gzip process");
 				} else if ((n < 0) && (errno == EAGAIN || errno == EINTR))
 					continue;	/* try it again */
 				break;
@@ -538,7 +538,7 @@
 
 			tbInfo.tarFd = gzipDataPipe[1];
 		} else {
-			perror_msg_and_die("Failed to vfork gzip process");
+			bb_perror_msg_and_die("Failed to vfork gzip process");
 		}
 	}
 #endif
@@ -567,7 +567,7 @@
 	/* Hang up the tools, close up shop, head home */
 	close(tbInfo.tarFd);
 	if (errorFlag)
-		error_msg("Error exit delayed from previous errors");
+		bb_error_msg("Error exit delayed from previous errors");
 
 	freeHardLinkInfo(&tbInfo.hlInfoHead);
 
@@ -585,10 +585,9 @@
 #ifdef CONFIG_FEATURE_TAR_EXCLUDE
 static llist_t *append_file_list_to_list(const char *filename, llist_t *list)
 {
-	FILE *src_stream = xfopen(filename, "r");
+	FILE *src_stream = bb_xfopen(filename, "r");
 	char *line;
-	while((line = get_line_from_file(src_stream)) != NULL) {
-		chomp(line);
+	while((line = bb_get_chomped_line_from_file(src_stream)) != NULL) {
 		list = llist_add_to(list, line);
 	}
 	fclose(src_stream);
@@ -611,7 +610,7 @@
 	unsigned char ctx_flag = 0;
 
 	if (argc < 2) {
-		show_usage();
+		bb_show_usage();
 	}
 
 	/* Prepend '-' to the first argument if required */
@@ -690,13 +689,13 @@
 			break;
 #endif
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 
 	/* Check one and only one context option was given */
 	if ((ctx_flag != CTX_CREATE) && (ctx_flag != CTX_TEST) && (ctx_flag != CTX_EXTRACT)) {
-		show_usage();
+		bb_show_usage();
 	}
 
 	/* Check if we are reading from stdin */
@@ -740,11 +739,11 @@
 			tar_handle->src_fd = fileno(stdin);
 			tar_handle->seek = seek_by_char;
 		} else {
-			tar_handle->src_fd = xopen(tar_filename, O_RDONLY);
+			tar_handle->src_fd = bb_xopen(tar_filename, O_RDONLY);
 		}
 
 		if ((base_dir) && (chdir(base_dir))) {
-			perror_msg_and_die("Couldnt chdir");
+			bb_perror_msg_and_die("Couldnt chdir");
 		}
 
 		while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
@@ -753,7 +752,7 @@
 		while (tar_handle->accept) {
 			if (find_list_entry(tar_handle->reject, tar_handle->accept->data) == NULL) {
 				if (find_list_entry(tar_handle->passed, tar_handle->accept->data) == NULL) {
-					error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
+					bb_error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
 				}
 			}
 			tar_handle->accept = tar_handle->accept->link;
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 877bcc7..2d2145d 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -45,7 +45,7 @@
 			flags |= gunzip_force;
 			break;
 		default:
-			show_usage();	/* exit's inside usage */
+			bb_show_usage();	/* exit's inside usage */
 		}
 	}
 
@@ -63,17 +63,17 @@
 			src_fd = fileno(stdin);
 			flags |= gunzip_to_stdout;
 		} else {
-			src_fd = xopen(old_path, O_RDONLY);
+			src_fd = bb_xopen(old_path, O_RDONLY);
 
 			/* Get the time stamp on the input file. */
 			if (stat(old_path, &stat_buf) < 0) {
-				error_msg_and_die("Couldn't stat file %s", old_path);
+				bb_error_msg_and_die("Couldn't stat file %s", old_path);
 			}
 		}
 
 		/* Check that the input is sane.  */
 		if (isatty(src_fd) && ((flags & gunzip_force) == 0)) {
-			error_msg_and_die
+			bb_error_msg_and_die
 				("compressed data not read from terminal.  Use -f to force it.");
 		}
 
@@ -83,16 +83,16 @@
 		} else {
 			char *extension;
 
-			new_path = xstrdup(old_path);
+			new_path = bb_xstrdup(old_path);
 
 			extension = strrchr(new_path, '.');
 			if (!extension || (strcmp(extension, ".Z") != 0)) {
-				error_msg_and_die("Invalid extension");
+				bb_error_msg_and_die("Invalid extension");
 			}
 			*extension = '\0';
 
 			/* Open output file */
-			dst_fd = xopen(new_path, O_WRONLY | O_CREAT);
+			dst_fd = bb_xopen(new_path, O_WRONLY | O_CREAT);
 
 			/* Set permissions on the file */
 			chmod(new_path, stat_buf.st_mode);
@@ -102,10 +102,10 @@
 		}
 
 		/* do the decompression, and cleanup */
-		if ((xread_char(src_fd) == 0x1f) && (xread_char(src_fd) == 0x9d)) {
+		if ((bb_xread_char(src_fd) == 0x1f) && (bb_xread_char(src_fd) == 0x9d)) {
 			status = uncompress(src_fd, dst_fd);
 		} else {
-			error_msg_and_die("Invalid magic");
+			bb_error_msg_and_die("Invalid magic");
 		}
 
 		if ((status != EXIT_SUCCESS) && (new_path)) {
@@ -122,7 +122,7 @@
 
 		/* delete_path will be NULL if in test mode or from stdin */
 		if (delete_path && (unlink(delete_path) == -1)) {
-			error_msg_and_die("Couldn't remove %s", delete_path);
+			bb_error_msg_and_die("Couldn't remove %s", delete_path);
 		}
 
 		free(new_path);
diff --git a/archival/unzip.c b/archival/unzip.c
index 86416d3..f2d7f49 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -120,12 +120,12 @@
 				break;
 #endif
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
 	if (argc == optind) {
-		show_usage();
+		bb_show_usage();
 	}
 
 	printf("Archive:  %s\n", argv[optind]);
@@ -138,11 +138,11 @@
 		archive_handle->src_fd = fileno(stdin);
 		archive_handle->seek = seek_by_char;
 	} else {
-		archive_handle->src_fd = xopen(argv[optind++], O_RDONLY);
+		archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
 	}
 
 	if ((base_dir) && (chdir(base_dir))) {
-		perror_msg_and_die("Couldnt chdir");
+		bb_perror_msg_and_die("Couldnt chdir");
 	}
 
 	while (optind < argc) {
@@ -163,7 +163,7 @@
 			break;
 		}
 		else if (magic != ZIP_FILEHEADER_MAGIC) {
-			error_msg_and_die("Invlaide zip magic");
+			bb_error_msg_and_die("Invlaide zip magic");
 		}
 
 		/* Read the file header */
@@ -172,7 +172,7 @@
 		archive_handle->file_header->mode = S_IFREG | 0777;
 
 		if (zip_header.formated.method != 8) {
-			error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
+			bb_error_msg_and_die("Unsupported compression method %d\n", zip_header.formated.method);
 		}
 
 		/* Read filename */
@@ -198,19 +198,19 @@
 		if (archive_handle->action_data) {
 			archive_handle->action_data(archive_handle);
 		} else {
-			dst_fd = xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
+			dst_fd = bb_xopen(archive_handle->file_header->name, O_WRONLY | O_CREAT);
 			inflate(archive_handle->src_fd, dst_fd);
 			close(dst_fd);
 			chmod(archive_handle->file_header->name, archive_handle->file_header->mode);
 
 			/* Validate decompression - crc */
 			if (zip_header.formated.crc32 != (gunzip_crc ^ 0xffffffffL)) {
-				error_msg("Invalid compressed data--crc error");
+				bb_error_msg("Invalid compressed data--crc error");
 			}
 
 			/* Validate decompression - size */
 			if (gunzip_bytes_out != zip_header.formated.ucmpsize) {
-				error_msg("Invalid compressed data--length error");
+				bb_error_msg("Invalid compressed data--length error");
 			}
 		}