wok-6.x rev 282
Busybox: add df -i & hexdump -R
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 26 12:00:01 2008 +0000 (2008-02-26) |
parents | dce74a419f98 |
children | e72b1ad76cb1 |
files | busybox/receipt busybox/stuff/busybox-1.7.3-df.u busybox/stuff/busybox-1.7.3-hexdump.u |
line diff
1.1 --- a/busybox/receipt Tue Feb 26 11:58:04 2008 +0000 1.2 +++ b/busybox/receipt Tue Feb 26 12:00:01 2008 +0000 1.3 @@ -6,6 +6,7 @@ 1.4 SHORT_DESC="Busybox combines tiny versions of many common UNIX utilities." 1.5 MAINTAINER="pankso@slitaz.org" 1.6 DEPENDS="slitaz-base-files" 1.7 +BUILD_DEPENDS="bzip2" 1.8 TARBALL="$PACKAGE-$VERSION.tar.bz2" 1.9 WEB_SITE="http://www.busybox.net/" 1.10 WGET_URL="http://www.busybox.net/downloads/$TARBALL" 1.11 @@ -13,6 +14,8 @@ 1.12 # Rules to configure and make the package. 1.13 compile_rules() 1.14 { 1.15 + patch -p0 < stuff/$PACKAGE-$VERSION-hexdump.u 1.16 + patch -p0 < stuff/$PACKAGE-$VERSION-df.u 1.17 cp stuff/$PACKAGE-$VERSION.config $PACKAGE-$VERSION/.config 1.18 cd $PACKAGE-$VERSION 1.19 make oldconfig
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/busybox/stuff/busybox-1.7.3-df.u Tue Feb 26 12:00:01 2008 +0000 2.3 @@ -0,0 +1,42 @@ 2.4 +--- busybox-1.7.3/coreutils/df.c 2.5 ++++ busybox-1.7.3/coreutils/df.c 2.6 +@@ -47,7 +47,7 @@ 2.7 + 2.8 + #if ENABLE_FEATURE_HUMAN_READABLE 2.9 + opt_complementary = "h-km:k-hm:m-hk"; 2.10 +- opt = getopt32(argv, "hmk"); 2.11 ++ opt = getopt32(argv, "hmik"); 2.12 + if (opt & 1) { 2.13 + df_disp_hr = 0; 2.14 + disp_units_hdr = " Size"; 2.15 +@@ -56,9 +56,14 @@ 2.16 + df_disp_hr = 1024*1024; 2.17 + disp_units_hdr = "1M-blocks"; 2.18 + } 2.19 ++#define OPT_INODE 4 2.20 + #else 2.21 ++#define OPT_INODE 1 2.22 + opt = getopt32(argv, "k"); 2.23 + #endif 2.24 ++ if (opt & OPT_INODE) { 2.25 ++ disp_units_hdr = " Inodes"; 2.26 ++ } 2.27 + 2.28 + printf("Filesystem%11s%-15sUsed Available Use%% Mounted on\n", 2.29 + "", disp_units_hdr); 2.30 +@@ -105,6 +110,15 @@ 2.31 + } 2.32 + 2.33 + if ((s.f_blocks > 0) || !mount_table){ 2.34 ++ if (opt & OPT_INODE) { 2.35 ++ s.f_blocks = s.f_files; 2.36 ++ s.f_bavail = s.f_bfree = s.f_ffree; 2.37 ++ s.f_bsize = 1; 2.38 ++#if ENABLE_FEATURE_HUMAN_READABLE 2.39 ++ if (df_disp_hr) 2.40 ++ df_disp_hr = 1; 2.41 ++#endif 2.42 ++ } 2.43 + blocks_used = s.f_blocks - s.f_bfree; 2.44 + blocks_percent_used = 0; 2.45 + if (blocks_used + s.f_bavail) {
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/busybox/stuff/busybox-1.7.3-hexdump.u Tue Feb 26 12:00:01 2008 +0000 3.3 @@ -0,0 +1,77 @@ 3.4 +--- busybox-1.7.3/util-linux/hexdump.c 3.5 ++++ busybox-1.7.3/util-linux/hexdump.c 3.6 +@@ -45,7 +45,7 @@ 3.7 + 3.8 + static const char add_first[] ALIGN1 = "\"%07.7_Ax\n\""; 3.9 + 3.10 +-static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:v"; 3.11 ++static const char hexdump_opts[] ALIGN1 = "bcdoxCe:f:n:s:vR"; 3.12 + 3.13 + static const struct suffix_mult suffixes[] = { 3.14 + { "b", 512 }, 3.15 +@@ -59,6 +59,8 @@ 3.16 + { 3.17 + const char *p; 3.18 + int ch; 3.19 ++ FILE *fp; 3.20 ++ smallint rdump = 0; 3.21 + 3.22 + bb_dump_vflag = FIRST; 3.23 + bb_dump_length = -1; 3.24 +@@ -70,7 +72,7 @@ 3.25 + if ((p - hexdump_opts) < 5) { 3.26 + bb_dump_add(add_first); 3.27 + bb_dump_add(add_strings[(int)(p - hexdump_opts)]); 3.28 +- } else if (ch == 'C') { 3.29 ++ } if (ch == 'C') { 3.30 + bb_dump_add("\"%08.8_Ax\n\""); 3.31 + bb_dump_add("\"%08.8_ax \" 8/1 \"%02x \" \" \" 8/1 \"%02x \" "); 3.32 + bb_dump_add("\" |\" 16/1 \"%_p\" \"|\\n\""); 3.33 +@@ -90,6 +92,9 @@ 3.34 + } /* else */ 3.35 + if (ch == 'v') { 3.36 + bb_dump_vflag = ALL; 3.37 ++ } /* else */ 3.38 ++ if (ch == 'R') { 3.39 ++ rdump = 1; 3.40 + } 3.41 + } 3.42 + } 3.43 +@@ -101,5 +106,36 @@ 3.44 + 3.45 + argv += optind; 3.46 + 3.47 +- return bb_dump_dump(argv); 3.48 ++ if (!rdump) { 3.49 ++ return bb_dump_dump(argv); 3.50 ++ } 3.51 ++ 3.52 ++ /* -R: reverse of 'hexdump -Cv' */ 3.53 ++ fp = stdin; 3.54 ++ if (!*argv) { 3.55 ++ argv--; 3.56 ++ goto jump_in; 3.57 ++ } 3.58 ++ 3.59 ++ do { 3.60 ++ char *buf; 3.61 ++ fp = xfopen(*argv, "r"); 3.62 ++ jump_in: 3.63 ++ while ((buf = xmalloc_getline(fp)) != NULL) { 3.64 ++ p = buf; 3.65 ++ while (1) { 3.66 ++ /* skip address or previous byte */ 3.67 ++ while (isxdigit(*p)) p++; 3.68 ++ while (*p == ' ') p++; 3.69 ++ /* '|' char will break the line */ 3.70 ++ if (!isxdigit(*p) || sscanf(p, "%x ", &ch) != 1) 3.71 ++ break; 3.72 ++ putchar(ch); 3.73 ++ } 3.74 ++ free(buf); 3.75 ++ } 3.76 ++ fclose(fp); 3.77 ++ } while (*++argv); 3.78 ++ 3.79 ++ fflush_stdout_and_exit(EXIT_SUCCESS); 3.80 + }