wok-current rev 859

Up: busybox (1.10.3)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jun 05 08:00:51 2008 +0000 (2008-06-05)
parents 4b14537dc5b5
children 6e606489151e
files busybox/receipt busybox/stuff/busybox-1.10.3-cpio-mkdir.u busybox/stuff/busybox-1.10.3-cpio-mtime.u busybox/stuff/busybox-1.10.3-cpio.u busybox/stuff/busybox-1.10.3-dhcpc.u busybox/stuff/busybox-1.10.3-header_tar.u busybox/stuff/busybox-1.10.3-patch.u busybox/stuff/busybox-1.10.3-script.u busybox/stuff/busybox-1.10.3-stat.u busybox/stuff/busybox-1.10.3-tar.u busybox/stuff/busybox-1.10.3-tftp.u busybox/stuff/busybox-1.10.3-unlzma.u busybox/stuff/busybox-1.10.3-vcsa2txt.u busybox/stuff/busybox-1.10.3.config
line diff
     1.1 --- a/busybox/receipt	Wed Jun 04 17:21:29 2008 +0000
     1.2 +++ b/busybox/receipt	Thu Jun 05 08:00:51 2008 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="busybox"
     1.7 -VERSION="1.10.1"
     1.8 +VERSION="1.10.3"
     1.9  CATEGORY="base-system"
    1.10  SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities."
    1.11  MAINTAINER="pascal.bellard@slitaz.org"
    1.12 @@ -14,7 +14,7 @@
    1.13  # Rules to configure and make the package.
    1.14  compile_rules()
    1.15  {
    1.16 -    cd $PACKAGE-$VERSION
    1.17 +    cd $src
    1.18      while read file; do
    1.19      	patch -p1 < ../stuff/$file || return 1
    1.20      done <<EOT
    1.21 @@ -29,7 +29,6 @@
    1.22  $PACKAGE-$VERSION-tar.u
    1.23  $PACKAGE-$VERSION-script.u
    1.24  $PACKAGE-$VERSION-header_tar.u
    1.25 -$PACKAGE-$VERSION-fixes-$VERSION.u
    1.26  $PACKAGE-$VERSION-stat.u
    1.27  EOT
    1.28      cp ../stuff/$PACKAGE-$VERSION.config .config
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/busybox-1.10.3-cpio-mkdir.u	Thu Jun 05 08:00:51 2008 +0000
     2.3 @@ -0,0 +1,1 @@
     2.4 +busybox-1.10.1-cpio-mkdir.u
     2.5 \ No newline at end of file
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/busybox/stuff/busybox-1.10.3-cpio-mtime.u	Thu Jun 05 08:00:51 2008 +0000
     3.3 @@ -0,0 +1,1 @@
     3.4 +busybox-1.10.1-cpio-mtime.u
     3.5 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/busybox/stuff/busybox-1.10.3-cpio.u	Thu Jun 05 08:00:51 2008 +0000
     4.3 @@ -0,0 +1,1 @@
     4.4 +busybox-1.10.1-cpio.u
     4.5 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/busybox/stuff/busybox-1.10.3-dhcpc.u	Thu Jun 05 08:00:51 2008 +0000
     5.3 @@ -0,0 +1,1 @@
     5.4 +busybox-1.10.1-dhcpc.u
     5.5 \ No newline at end of file
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/busybox/stuff/busybox-1.10.3-header_tar.u	Thu Jun 05 08:00:51 2008 +0000
     6.3 @@ -0,0 +1,1 @@
     6.4 +busybox-1.10.1-header_tar.u
     6.5 \ No newline at end of file
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/busybox/stuff/busybox-1.10.3-patch.u	Thu Jun 05 08:00:51 2008 +0000
     7.3 @@ -0,0 +1,412 @@
     7.4 +--- busybox-1.10.3/editors/patch.c	2008-03-24 15:46:20.000000000 +0100
     7.5 ++++ busybox-1.10.3/editors/patch.c	2008-03-24 15:46:20.000000000 +0100
     7.6 +@@ -19,15 +19,11 @@
     7.7 +  *   - Reject file isnt saved
     7.8 +  */
     7.9 + 
    7.10 +-#include <getopt.h>
    7.11 +-
    7.12 + #include "libbb.h"
    7.13 + 
    7.14 +-static unsigned int copy_lines(FILE *src_stream, FILE *dest_stream, const unsigned int lines_count)
    7.15 ++static unsigned copy_lines(FILE *src_stream, FILE *dest_stream, unsigned lines_count)
    7.16 + {
    7.17 +-	unsigned int i = 0;
    7.18 +-
    7.19 +-	while (src_stream && (i < lines_count)) {
    7.20 ++	while (src_stream && lines_count) {
    7.21 + 		char *line;
    7.22 + 		line = xmalloc_fgets(src_stream);
    7.23 + 		if (line == NULL) {
    7.24 +@@ -37,60 +33,70 @@
    7.25 + 			bb_perror_msg_and_die("error writing to new file");
    7.26 + 		}
    7.27 + 		free(line);
    7.28 +-
    7.29 +-		i++;
    7.30 ++		lines_count--;
    7.31 + 	}
    7.32 +-	return i;
    7.33 ++	return lines_count;
    7.34 + }
    7.35 + 
    7.36 + /* If patch_level is -1 it will remove all directory names
    7.37 +  * char *line must be greater than 4 chars
    7.38 +  * returns NULL if the file doesnt exist or error
    7.39 +  * returns malloc'ed filename
    7.40 ++ * NB: frees 1st argument!
    7.41 +  */
    7.42 + 
    7.43 +-static char *extract_filename(char *line, int patch_level)
    7.44 ++static char *extract_filename(char *line, unsigned patch_level, const char *pat)
    7.45 + {
    7.46 +-	char *temp, *filename_start_ptr = line + 4;
    7.47 +-	int i;
    7.48 ++	char *temp = NULL, *filename_start_ptr = line + 4;
    7.49 + 
    7.50 +-	/* Terminate string at end of source filename */
    7.51 +-	temp = strchrnul(filename_start_ptr, '\t');
    7.52 +-	*temp = '\0';
    7.53 +-
    7.54 +-	/* Skip over (patch_level) number of leading directories */
    7.55 +-	if (patch_level == -1)
    7.56 +-		patch_level = INT_MAX;
    7.57 +-	for (i = 0; i < patch_level; i++) {
    7.58 +-		temp = strchr(filename_start_ptr, '/');
    7.59 +-		if (!temp)
    7.60 +-			break;
    7.61 +-		filename_start_ptr = temp + 1;
    7.62 ++	if (strncmp(line, pat, 4) == 0) {
    7.63 ++		/* Terminate string at end of source filename */
    7.64 ++		line[strcspn(line,"\t\n\r")] = '\0';
    7.65 ++
    7.66 ++		/* Skip over (patch_level) number of leading directories */
    7.67 ++		while (patch_level--) {
    7.68 ++			temp = strchr(filename_start_ptr, '/');
    7.69 ++			if (!temp)
    7.70 ++				break;
    7.71 ++			filename_start_ptr = temp + 1;
    7.72 ++		}
    7.73 ++		temp = xstrdup(filename_start_ptr);
    7.74 + 	}
    7.75 +-
    7.76 +-	return xstrdup(filename_start_ptr);
    7.77 ++	free(line);
    7.78 ++	return temp;
    7.79 + }
    7.80 + 
    7.81 + int patch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
    7.82 + int patch_main(int argc ATTRIBUTE_UNUSED, char **argv)
    7.83 + {
    7.84 +-	int patch_level = -1;
    7.85 +-	char *patch_line;
    7.86 +-	int ret;
    7.87 +-	FILE *patch_file = NULL;
    7.88 + 	struct stat saved_stat;
    7.89 +-	
    7.90 ++	char *patch_line;
    7.91 ++	FILE *patch_file;
    7.92 ++	int patch_level;
    7.93 ++	int ret = 0;
    7.94 ++#define ENABLE_FEATURE_PATCH_REVERSE 1
    7.95 ++#if ENABLE_FEATURE_PATCH_REVERSE
    7.96 ++	char minus = '-';
    7.97 ++	char plus = '+';
    7.98 ++#else
    7.99 ++	const char minus = '-';
   7.100 ++	const char plus = '+';
   7.101 ++#endif
   7.102 ++
   7.103 ++	xfunc_error_retval = 2;	
   7.104 + 	{
   7.105 +-		char *p, *i;
   7.106 +-		ret = getopt32(argv, "p:i:", &p, &i);
   7.107 +-		if (ret & 1)
   7.108 +-			patch_level = xatol_range(p, -1, USHRT_MAX);
   7.109 +-		if (ret & 2) {
   7.110 +-			patch_file = xfopen(i, "r");
   7.111 +-		} else {
   7.112 +-			patch_file = stdin;
   7.113 +-		}
   7.114 +-		ret = 0;
   7.115 ++		const char *p = "-1";
   7.116 ++		const char *i = "-"; /* compat */
   7.117 ++#if ENABLE_FEATURE_PATCH_REVERSE
   7.118 ++		if (getopt32(argv, "p:i:R", &p, &i) & 4) {
   7.119 ++			minus = '+';
   7.120 ++			plus = '-';
   7.121 ++		}
   7.122 ++#else
   7.123 ++		getopt32(argv, "p:i:", &p, &i);
   7.124 ++#endif
   7.125 ++		patch_level = xatoi(p); /* can be negative! */
   7.126 ++		patch_file = xfopen_stdin(i);
   7.127 + 	}
   7.128 + 
   7.129 + 	patch_line = xmalloc_getline(patch_file);
   7.130 +@@ -100,38 +106,38 @@
   7.131 + 		char *original_filename;
   7.132 + 		char *new_filename;
   7.133 + 		char *backup_filename;
   7.134 +-		unsigned int src_cur_line = 1;
   7.135 +-		unsigned int dest_cur_line = 0;
   7.136 +-		unsigned int dest_beg_line;
   7.137 +-		unsigned int bad_hunk_count = 0;
   7.138 +-		unsigned int hunk_count = 0;
   7.139 +-		char copy_trailing_lines_flag = 0;
   7.140 ++		unsigned src_cur_line = 1;
   7.141 ++		unsigned dest_cur_line = 0;
   7.142 ++		unsigned dest_beg_line;
   7.143 ++		unsigned bad_hunk_count = 0;
   7.144 ++		unsigned hunk_count = 0;
   7.145 ++		smallint copy_trailing_lines_flag = 0;
   7.146 + 
   7.147 + 		/* Skip everything upto the "---" marker
   7.148 + 		 * No need to parse the lines "Only in <dir>", and "diff <args>"
   7.149 + 		 */
   7.150 +-		while (patch_line && strncmp(patch_line, "--- ", 4) != 0) {
   7.151 +-			free(patch_line);
   7.152 ++		do {
   7.153 ++			/* Extract the filename used before the patch was generated */
   7.154 ++			original_filename = extract_filename(patch_line, patch_level, "--- ");
   7.155 + 			patch_line = xmalloc_getline(patch_file);
   7.156 +-		}
   7.157 +-		/* FIXME: patch_line NULL check?? */
   7.158 ++			if (!patch_line) goto quit;
   7.159 ++		} while (!original_filename);
   7.160 + 
   7.161 +-		/* Extract the filename used before the patch was generated */
   7.162 +-		original_filename = extract_filename(patch_line, patch_level);
   7.163 +-		free(patch_line);
   7.164 +-
   7.165 +-		patch_line = xmalloc_getline(patch_file);
   7.166 +-		/* FIXME: NULL check?? */
   7.167 +-		if (strncmp(patch_line, "+++ ", 4) != 0) {
   7.168 +-			ret = 2;
   7.169 +-			bb_error_msg("invalid patch");
   7.170 +-			continue;
   7.171 ++		new_filename = extract_filename(patch_line, patch_level, "+++ ");
   7.172 ++		if (!new_filename) {
   7.173 ++			bb_error_msg_and_die("invalid patch");
   7.174 ++		}
   7.175 ++#if ENABLE_FEATURE_PATCH_REVERSE
   7.176 ++		if (plus != '+') {
   7.177 ++			/* reverse patch */
   7.178 ++			char *tmp = original_filename;
   7.179 ++			original_filename = new_filename;
   7.180 ++			new_filename = tmp;
   7.181 + 		}
   7.182 +-		new_filename = extract_filename(patch_line, patch_level);
   7.183 +-		free(patch_line);
   7.184 ++#endif
   7.185 + 		
   7.186 + 		/* Get access rights from the file to be patched, -1 file does not exist */
   7.187 +-		if (stat(new_filename, &saved_stat)) {
   7.188 ++		if (stat(new_filename, &saved_stat) != 0) {
   7.189 + 			char *line_ptr;
   7.190 + 			/* Create leading directories */
   7.191 + 			line_ptr = strrchr(new_filename, '/');
   7.192 +@@ -140,132 +146,137 @@
   7.193 + 				bb_make_directory(new_filename, -1, FILEUTILS_RECUR);
   7.194 + 				*line_ptr = '/';
   7.195 + 			}
   7.196 +-			dst_stream = xfopen(new_filename, "w+");
   7.197 + 			backup_filename = NULL;
   7.198 ++			saved_stat.st_mode = 0644;
   7.199 + 		} else {
   7.200 +-			backup_filename = xmalloc(strlen(new_filename) + 6);
   7.201 +-			strcpy(backup_filename, new_filename);
   7.202 +-			strcat(backup_filename, ".orig");
   7.203 ++			backup_filename = xasprintf("%s.orig", new_filename);
   7.204 + 			xrename(new_filename, backup_filename);
   7.205 +-			dst_stream = xfopen(new_filename, "w");
   7.206 +-			fchmod(fileno(dst_stream), saved_stat.st_mode);
   7.207 + 		}
   7.208 +-
   7.209 +-		if ((backup_filename == NULL) || stat(original_filename, &saved_stat)) {
   7.210 +-			src_stream = NULL;
   7.211 +-		} else {
   7.212 +-			if (strcmp(original_filename, new_filename) == 0) {
   7.213 +-				src_stream = xfopen(backup_filename, "r");
   7.214 +-			} else {
   7.215 +-				src_stream = xfopen(original_filename, "r");
   7.216 +-			}
   7.217 ++		dst_stream = xfopen(new_filename, "w");
   7.218 ++		fchmod(fileno(dst_stream), saved_stat.st_mode);
   7.219 ++		src_stream = NULL;
   7.220 ++
   7.221 ++		if (backup_filename && !stat(original_filename, &saved_stat)) {
   7.222 ++			src_stream = xfopen((strcmp(original_filename, new_filename)) ? 
   7.223 ++							    original_filename : backup_filename, "r");
   7.224 + 		}
   7.225 + 
   7.226 + 		printf("patching file %s\n", new_filename);
   7.227 + 
   7.228 +-		/* Handle each hunk */
   7.229 ++		/* Handle all hunks for this file */
   7.230 + 		patch_line = xmalloc_fgets(patch_file);
   7.231 + 		while (patch_line) {
   7.232 +-			unsigned int count;
   7.233 +-			unsigned int src_beg_line;
   7.234 +-			unsigned int unused;
   7.235 +-			unsigned int hunk_offset_start = 0;
   7.236 +-			int hunk_error = 0;
   7.237 +-
   7.238 +-			/* This bit should be improved */
   7.239 +-			if ((sscanf(patch_line, "@@ -%d,%d +%d,%d @@", &src_beg_line, &unused, &dest_beg_line, &unused) != 4) &&
   7.240 +-				(sscanf(patch_line, "@@ -%d,%d +%d @@", &src_beg_line, &unused, &dest_beg_line) != 3) &&
   7.241 +-				(sscanf(patch_line, "@@ -%d +%d,%d @@", &src_beg_line, &dest_beg_line, &unused) != 3)) {
   7.242 ++			unsigned count;
   7.243 ++			unsigned src_beg_line;
   7.244 ++			unsigned hunk_offset_start;
   7.245 ++			unsigned src_last_line = 1;
   7.246 ++#if ENABLE_FEATURE_PATCH_REVERSE
   7.247 ++			unsigned dst_last_line = 1;
   7.248 ++
   7.249 ++			if ((sscanf(patch_line, "@@ -%d,%d +%d,%d", &src_beg_line, &src_last_line, &dest_beg_line, &dst_last_line) < 3) &&
   7.250 ++				(sscanf(patch_line, "@@ -%d +%d,%d", &src_beg_line, &dest_beg_line, &dst_last_line) < 2)) {
   7.251 + 				/* No more hunks for this file */
   7.252 + 				break;
   7.253 + 			}
   7.254 +-			free(patch_line);
   7.255 ++			if (plus != '+') { 
   7.256 ++				/* reverse patch */
   7.257 ++				unsigned tmp = src_last_line;
   7.258 ++				src_last_line = dst_last_line;
   7.259 ++				dst_last_line = tmp;
   7.260 ++				tmp = src_beg_line;
   7.261 ++				src_beg_line = dest_beg_line;
   7.262 ++				dest_beg_line = tmp;
   7.263 ++			}
   7.264 ++#else
   7.265 ++
   7.266 ++			if ((sscanf(patch_line, "@@ -%d,%d +%d", &src_beg_line, &src_last_line, &dest_beg_line) != 3) &&
   7.267 ++				(sscanf(patch_line, "@@ -%d +%d", &src_beg_line, &dest_beg_line) != 2)) {
   7.268 ++				/* No more hunks for this file */
   7.269 ++				break;
   7.270 ++			}
   7.271 ++#endif
   7.272 + 			hunk_count++;
   7.273 + 
   7.274 + 			if (src_beg_line && dest_beg_line) {
   7.275 + 				/* Copy unmodified lines upto start of hunk */
   7.276 +-				/* src_beg_line will be 0 if its a new file */
   7.277 ++				/* src_beg_line will be 0 if it's a new file */
   7.278 + 				count = src_beg_line - src_cur_line;
   7.279 +-				if (copy_lines(src_stream, dst_stream, count) != count) {
   7.280 ++				if (copy_lines(src_stream, dst_stream, count)) {
   7.281 + 					bb_error_msg_and_die("bad src file");
   7.282 + 				}
   7.283 + 				src_cur_line += count;
   7.284 + 				dest_cur_line += count;
   7.285 + 				copy_trailing_lines_flag = 1;
   7.286 + 			}
   7.287 +-			hunk_offset_start = src_cur_line;
   7.288 +-
   7.289 +-			while ((patch_line = xmalloc_fgets(patch_file)) != NULL) {
   7.290 +-				if ((*patch_line == '-') || (*patch_line == ' ')) {
   7.291 ++			src_last_line += hunk_offset_start = src_cur_line;
   7.292 ++#if ENABLE_FEATURE_PATCH_REVERSE
   7.293 ++			dst_last_line += dest_cur_line;
   7.294 ++#endif
   7.295 ++			while (1) {
   7.296 ++				free(patch_line);
   7.297 ++			        patch_line = xmalloc_fgets(patch_file);
   7.298 ++				if (patch_line == NULL) break;
   7.299 ++				if ((*patch_line == minus) || (*patch_line == ' ')) {
   7.300 + 					char *src_line = NULL;
   7.301 ++					if (src_cur_line == src_last_line) break;
   7.302 + 					if (src_stream) {
   7.303 + 						src_line = xmalloc_fgets(src_stream);
   7.304 +-						if (!src_line) {
   7.305 +-							hunk_error++;
   7.306 +-							break;
   7.307 +-						} else {
   7.308 ++						if (src_line) {
   7.309 ++							int diff = strcmp(src_line, patch_line + 1);
   7.310 + 							src_cur_line++;
   7.311 ++							free(src_line);
   7.312 ++							if (diff) src_line = NULL;
   7.313 + 						}
   7.314 +-						if (strcmp(src_line, patch_line + 1) != 0) {
   7.315 +-							bb_error_msg("hunk #%d FAILED at %d", hunk_count, hunk_offset_start);
   7.316 +-							hunk_error++;
   7.317 +-							free(patch_line);
   7.318 +-							/* Probably need to find next hunk, etc... */
   7.319 +-							/* but for now we just bail out */
   7.320 +-							patch_line = NULL;
   7.321 +-							break;
   7.322 +-						}
   7.323 +-						free(src_line);
   7.324 + 					}
   7.325 +-					if (*patch_line == ' ') {
   7.326 +-						fputs(patch_line + 1, dst_stream);
   7.327 +-						dest_cur_line++;
   7.328 ++					if (!src_line) {
   7.329 ++						bb_error_msg("hunk #%u FAILED at %u", hunk_count, hunk_offset_start);
   7.330 ++						bad_hunk_count++;
   7.331 ++						break;
   7.332 + 					}
   7.333 +-				} else if (*patch_line == '+') {
   7.334 +-					fputs(patch_line + 1, dst_stream);
   7.335 +-					dest_cur_line++;
   7.336 +-				} else {
   7.337 ++					if (*patch_line != ' ') {
   7.338 ++						continue;
   7.339 ++					}
   7.340 ++				} else if (*patch_line != plus) {
   7.341 + 					break;
   7.342 + 				}
   7.343 +-				free(patch_line);
   7.344 +-			}
   7.345 +-			if (hunk_error) {
   7.346 +-				bad_hunk_count++;
   7.347 +-			}
   7.348 +-		}
   7.349 ++#if ENABLE_FEATURE_PATCH_REVERSE
   7.350 ++				if (dest_cur_line == dst_last_line) break;
   7.351 ++#endif
   7.352 ++				fputs(patch_line + 1, dst_stream);
   7.353 ++				dest_cur_line++;
   7.354 ++			} /* end of while loop handling one hunk */
   7.355 ++		} /* end of while loop handling one file */
   7.356 + 
   7.357 + 		/* Cleanup last patched file */
   7.358 + 		if (copy_trailing_lines_flag) {
   7.359 +-			copy_lines(src_stream, dst_stream, -1);
   7.360 ++			copy_lines(src_stream, dst_stream, (unsigned)(-1));
   7.361 + 		}
   7.362 + 		if (src_stream) {
   7.363 + 			fclose(src_stream);
   7.364 + 		}
   7.365 +-		if (dst_stream) {
   7.366 +-			fclose(dst_stream);
   7.367 +-		}
   7.368 ++		fclose(dst_stream);
   7.369 + 		if (bad_hunk_count) {
   7.370 +-			if (!ret) {
   7.371 +-				ret = 1;
   7.372 +-			}
   7.373 +-			bb_error_msg("%d out of %d hunk FAILED", bad_hunk_count, hunk_count);
   7.374 ++			ret = 1;
   7.375 ++			bb_error_msg("%u out of %u hunk FAILED", bad_hunk_count, hunk_count);
   7.376 + 		} else {
   7.377 + 			/* It worked, we can remove the backup */
   7.378 + 			if (backup_filename) {
   7.379 + 				unlink(backup_filename);
   7.380 ++				free(backup_filename);
   7.381 + 			}
   7.382 + 			if ((dest_cur_line == 0) || (dest_beg_line == 0)) {
   7.383 + 				/* The new patched file is empty, remove it */
   7.384 + 				xunlink(new_filename);
   7.385 +-				if (strcmp(new_filename, original_filename) != 0)
   7.386 +-					xunlink(original_filename);
   7.387 ++				/* original_filename and new_filename may be the same file */
   7.388 ++				unlink(original_filename);
   7.389 + 			}
   7.390 + 		}
   7.391 +-	}
   7.392 ++	} /* end of "while there are patch lines" */
   7.393 ++quit:
   7.394 + 
   7.395 + 	/* 0 = SUCCESS
   7.396 + 	 * 1 = Some hunks failed
   7.397 +-	 * 2 = More serious problems
   7.398 ++	 * 2 = More serious problems (exited earlier)
   7.399 + 	 */
   7.400 + 	return ret;
   7.401 + }
   7.402 +
   7.403 +--- busybox-1.10.3/include/usage.h	2008-03-24 16:20:43.000000000 +0100
   7.404 ++++ busybox-1.10.3/include/usage.h	2008-03-24 16:22:06.000000000 +0100
   7.405 +@@ -2837,8 +2837,9 @@
   7.406 + 	)
   7.407 + 
   7.408 + #define patch_trivial_usage \
   7.409 +-       "[-p NUM] [-i DIFF]"
   7.410 ++       "[-R] [-p NUM] [-i DIFF]"
   7.411 + #define patch_full_usage \
   7.412 ++       "	-R    	Reverse patch\n" \
   7.413 +        "	-p NUM	Strip NUM leading components from file names" \
   7.414 +      "\n	-i DIFF	Read DIFF instead of stdin" \
   7.415 + 
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/busybox/stuff/busybox-1.10.3-script.u	Thu Jun 05 08:00:51 2008 +0000
     8.3 @@ -0,0 +1,1 @@
     8.4 +busybox-1.10.1-script.u
     8.5 \ No newline at end of file
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/busybox/stuff/busybox-1.10.3-stat.u	Thu Jun 05 08:00:51 2008 +0000
     9.3 @@ -0,0 +1,73 @@
     9.4 +--- busybox-1.10.1/coreutils/stat.c
     9.5 ++++ busybox-1.10.1/coreutils/stat.c
     9.6 +@@ -14,12 +14,14 @@
     9.7 +  */
     9.8 + 
     9.9 + #include "libbb.h"
    9.10 ++#include <linux/fs.h>
    9.11 + 
    9.12 + /* vars to control behavior */
    9.13 + #define OPT_FILESYS     (1 << 0)
    9.14 + #define OPT_TERSE       (1 << 1)
    9.15 + #define OPT_DEREFERENCE (1 << 2)
    9.16 +-#define OPT_SELINUX     (1 << 3)
    9.17 ++#define OPT_MAP         (1 << 3)
    9.18 ++#define OPT_SELINUX     (1 << 4)
    9.19 + 
    9.20 + #if ENABLE_FEATURE_STAT_FORMAT
    9.21 + typedef bool (*statfunc_ptr)(const char *, const char *);
    9.22 +@@ -345,6 +347,26 @@
    9.23 + 
    9.24 + /* Stat the file system and print what we find.  */
    9.25 + #if !ENABLE_FEATURE_STAT_FORMAT
    9.26 ++#define do_mapfile(filename, format) do_mapfile(filename)
    9.27 ++#endif
    9.28 ++static bool do_mapfile(const char *filename, const char *format)
    9.29 ++{
    9.30 ++	int i = 0;
    9.31 ++	int fd = xopen(filename, O_RDONLY);
    9.32 ++
    9.33 ++#if ENABLE_FEATURE_STAT_FORMAT
    9.34 ++	(void) format;
    9.35 ++#endif
    9.36 ++	while (1) {
    9.37 ++		int blk = i++;
    9.38 ++		if (ioctl(fd,FIBMAP,&blk) < 0 || blk == 0) break;
    9.39 ++		printf("%u\n",blk);
    9.40 ++	}	
    9.41 ++	return 1;
    9.42 ++}
    9.43 ++
    9.44 ++/* Stat the file system and print what we find.  */
    9.45 ++#if !ENABLE_FEATURE_STAT_FORMAT
    9.46 + #define do_statfs(filename, format) do_statfs(filename)
    9.47 + #endif
    9.48 + static bool do_statfs(const char *filename, const char *format)
    9.49 +@@ -632,13 +654,15 @@
    9.50 + 	int ok = 1;
    9.51 + 	statfunc_ptr statfunc = do_stat;
    9.52 + 
    9.53 +-	getopt32(argv, "ftL"
    9.54 ++	getopt32(argv, "ftLm"
    9.55 + 		USE_SELINUX("Z")
    9.56 + 		USE_FEATURE_STAT_FORMAT("c:", &format)
    9.57 + 	);
    9.58 + 
    9.59 + 	if (option_mask32 & OPT_FILESYS) /* -f */
    9.60 + 		statfunc = do_statfs;
    9.61 ++	if (option_mask32 & OPT_MAP) /* -m */
    9.62 ++		statfunc = do_mapfile;
    9.63 + 	if (argc == optind)           /* files */
    9.64 + 		bb_show_usage();
    9.65 + 
    9.66 +
    9.67 +--- busybox-1.10.1/include/usage.h
    9.68 ++++ busybox-1.10.1/include/usage.h
    9.69 +@@ -3589,6 +3589,7 @@
    9.70 + 	) \
    9.71 +      "\n	-f	Display filesystem status" \
    9.72 +      "\n	-L	Dereference links" \
    9.73 ++     "\n	-m	Display block list" \
    9.74 +      "\n	-t	Display info in terse form" \
    9.75 + 	USE_SELINUX( \
    9.76 +      "\n	-Z	Print security context" \
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/busybox/stuff/busybox-1.10.3-tar.u	Thu Jun 05 08:00:51 2008 +0000
    10.3 @@ -0,0 +1,1 @@
    10.4 +busybox-1.10.1-tar.u
    10.5 \ No newline at end of file
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/busybox/stuff/busybox-1.10.3-tftp.u	Thu Jun 05 08:00:51 2008 +0000
    11.3 @@ -0,0 +1,1 @@
    11.4 +busybox-1.10.1-tftp.u
    11.5 \ No newline at end of file
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/busybox/stuff/busybox-1.10.3-unlzma.u	Thu Jun 05 08:00:51 2008 +0000
    12.3 @@ -0,0 +1,1 @@
    12.4 +busybox-1.10.1-unlzma.u
    12.5 \ No newline at end of file
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/busybox/stuff/busybox-1.10.3-vcsa2txt.u	Thu Jun 05 08:00:51 2008 +0000
    13.3 @@ -0,0 +1,134 @@
    13.4 +--- busybox-1.10.3/include/applets.h	Sat Mar 22 02:31:50 2008
    13.5 ++++ busybox-1.10.3/include/applets.h	Sat Mar 22 02:31:50 2008
    13.6 +@@ -382,6 +382,7 @@
    13.7 + USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    13.8 + USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    13.9 + USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
   13.10 ++USE_VCSA2TXT(APPLET(vcsa2txt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
   13.11 + USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
   13.12 + USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
   13.13 + USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
   13.14 +
   13.15 +--- busybox-1.10.3/include/usage.h	Sat Mar 22 02:31:50 2008
   13.16 ++++ busybox-1.10.3/include/usage.h	Sat Mar 22 02:31:50 2008
   13.17 +@@ -4318,6 +4318,13 @@
   13.18 +      "\n	set_ingress_map	[vlan-name] [skb_priority] [vlan_qos]" \
   13.19 +      "\n	set_name_type	[name-type]" \
   13.20 + 
   13.21 ++#define vcsa2txt_trivial_usage \
   13.22 ++       "stdin"
   13.23 ++#define vcsa2txt_full_usage \
   13.24 ++       "Filter /dev/vcsa* to ansi escape sequences"
   13.25 ++#define vcsa2txt_example_usage \
   13.26 ++       "# vcsa2txt < /dev/vcsa1\n"
   13.27 ++
   13.28 + #define vi_trivial_usage \
   13.29 +        "[OPTION] [FILE]..."
   13.30 + #define vi_full_usage \
   13.31 +
   13.32 +--- busybox-1.10.3/miscutils/Config.in	Sat Mar 22 02:31:50 2008
   13.33 ++++ busybox-1.10.3/miscutils/Config.in	Sat Mar 22 02:31:50 2008
   13.34 +@@ -461,6 +461,12 @@
   13.35 + 	  only height, or both, in any order. It also does not complain on error,
   13.36 + 	  but returns default 80x24. Usage in shell scripts: width=`ttysize w`.
   13.37 + 
   13.38 ++config VCSA2TXT
   13.39 ++	bool "vcsa2txt"
   13.40 ++	default n
   13.41 ++	help
   13.42 ++	  Filter /dev/vcsa* output to ansi escape sequences.
   13.43 ++
   13.44 + config WATCHDOG
   13.45 + 	bool "watchdog"
   13.46 + 	default n
   13.47 +
   13.48 +--- busybox-1.10.3/util-linux/Kbuild	Sat Mar 22 02:31:53 2008
   13.49 ++++ busybox-1.10.3/util-linux/Kbuild	Sat Mar 22 02:31:53 2008
   13.50 +@@ -33,3 +33,4 @@
   13.51 + lib-$(CONFIG_SWAPONOFF)		+= swaponoff.o
   13.52 + lib-$(CONFIG_SWITCH_ROOT)	+= switch_root.o
   13.53 + lib-$(CONFIG_UMOUNT)		+= umount.o
   13.54 ++lib-$(CONFIG_VCSA2TXT)		+= vcsa2txt.o
   13.55 +
   13.56 +--- busybox-1.10.3/util-linux/vcsa2txt.c	Sat Mar 22 19:40:15 2008
   13.57 ++++ busybox-1.10.3/util-linux/vcsa2txt.c	Sat Mar 22 19:40:15 2008
   13.58 +@@ -0,0 +1,79 @@
   13.59 ++/* vi: set sw=4 ts=4: */
   13.60 ++/*
   13.61 ++ * /dev/vcsa* filter for busybox
   13.62 ++ *
   13.63 ++ * pascal.bellard@ads-lu.com
   13.64 ++ *
   13.65 ++ * Licensed under GPLv2 or later, see file License in this tarball for details.
   13.66 ++ */
   13.67 ++ 
   13.68 ++#include "libbb.h"
   13.69 ++
   13.70 ++int vcsa2txt_main(int argc) MAIN_EXTERNALLY_VISIBLE;
   13.71 ++int vcsa2txt_main(int argc)
   13.72 ++{
   13.73 ++    struct {
   13.74 ++	unsigned char l, c, x, y; // man 4 console_codes
   13.75 ++    } scrn;
   13.76 ++    unsigned char last = 0, ch[2];                     // BLGCRMOW
   13.77 ++    static  unsigned char end[5] = "\e[0m\n", color[8] = "04261537";
   13.78 ++    int sp, lf, x;
   13.79 ++    
   13.80 ++    if (safe_read(0, &scrn, 4) < 0) return 1;
   13.81 ++    for (lf = 0; scrn.l; lf++, scrn.l--) {
   13.82 ++	for (sp = x = 0; ++x <= scrn.c;) {
   13.83 ++	    if (safe_read(0, &ch[0], 2) < 0) return 1;
   13.84 ++	    if (argc > 1) ch[1] = 0;
   13.85 ++	    sp++;
   13.86 ++	    if (last == ch[1] && ch[0] == ' ') continue;
   13.87 ++	    for (lf++; --lf;) bb_putchar('\n');
   13.88 ++	    while (--sp) bb_putchar(' ');
   13.89 ++#define ENABLE_VCSA_PACKED 1
   13.90 ++#if ENABLE_VCSA_PACKED
   13.91 ++	    if (last ^= ch[1]) {
   13.92 ++		char esc[16],*s;
   13.93 ++		struct offsets {
   13.94 ++		    char mask, type, shr;
   13.95 ++		} *p;
   13.96 ++		static struct offsets offset[3] = {
   13.97 ++		    {8,0,1}, {0x70,'4',4}, {7,'3',0}
   13.98 ++		};
   13.99 ++		static char init = 0x7F;
  13.100 ++		
  13.101 ++		s = esc+2;
  13.102 ++		*(short *)esc = ntohs(256*'\e'+'[');
  13.103 ++		p = offset;
  13.104 ++		do {
  13.105 ++		    if ((init|last) & p->mask) {
  13.106 ++			int c = (ch[1] & p->mask) >> p->shr;
  13.107 ++		    
  13.108 ++			if ((*s = p->type) != 0) s++;
  13.109 ++			else if (c == 0) {
  13.110 ++			    c = 2;
  13.111 ++			    *s++ = '2'; /* normal */
  13.112 ++			}
  13.113 ++			*s++ = color[c];
  13.114 ++			*s++ = ';'; 
  13.115 ++		    }
  13.116 ++		} while (p++->shr);
  13.117 ++		s[-1] = 'm';
  13.118 ++		init = 0;
  13.119 ++		fwrite(esc,s-esc,1,stdout);
  13.120 ++	    }
  13.121 ++	    last = ch[1];
  13.122 ++#else
  13.123 ++	    if (last != ch[1]) {
  13.124 ++		static char esc[10] = "\e[0;47;37m";
  13.125 ++		
  13.126 ++		esc[2] = ((last = ch[1]) & 8) ? '1' /* bold */ : '0' /* defaults */;
  13.127 ++		esc[sizeof(esc)-5] = color[(ch[1] >> 4) & 7];
  13.128 ++		esc[sizeof(esc)-2] = color[ch[1] & 7];
  13.129 ++		fwrite(esc,sizeof(esc),1,stdout);
  13.130 ++	    }
  13.131 ++#endif
  13.132 ++	    bb_putchar(ch[0]);
  13.133 ++	}
  13.134 ++    }
  13.135 ++    fwrite(end,sizeof(end),1,stdout);
  13.136 ++    return 0;
  13.137 ++}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/busybox/stuff/busybox-1.10.3.config	Thu Jun 05 08:00:51 2008 +0000
    14.3 @@ -0,0 +1,1 @@
    14.4 +busybox-1.10.1.config
    14.5 \ No newline at end of file