wok-4.x rev 308

Busybox: add vcsa2txt
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 01 11:31:53 2008 +0000 (2008-03-01)
parents cd72bbc8d9c4
children 3a5e92c048e0
files busybox/receipt busybox/stuff/busybox-1.7.3-vcsa2txt.u busybox/stuff/busybox-1.7.3.config
line diff
     1.1 --- a/busybox/receipt	Sat Mar 01 00:38:44 2008 +0000
     1.2 +++ b/busybox/receipt	Sat Mar 01 11:31:53 2008 +0000
     1.3 @@ -19,6 +19,7 @@
     1.4      #patch -p0 < stuff/$PACKAGE-$VERSION-patch.u
     1.5      patch -p0 < stuff/$PACKAGE-$VERSION-script.u
     1.6      patch -p0 < stuff/$PACKAGE-$VERSION-usage-df.u
     1.7 +    patch -p0 < stuff/$PACKAGE-$VERSION-vcsa2txt.u
     1.8      cp stuff/$PACKAGE-$VERSION.config $PACKAGE-$VERSION/.config
     1.9      cd $PACKAGE-$VERSION
    1.10      make oldconfig
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/busybox-1.7.3-vcsa2txt.u	Sat Mar 01 11:31:53 2008 +0000
     2.3 @@ -0,0 +1,104 @@
     2.4 +--- busybox-1.7.3/include/applets.h	2008-03-01 11:20:49.000000000 +0100
     2.5 ++++ busybox-1.7.3/include/applets.h	2008-03-01 11:24:45.000000000 +0100
     2.6 +@@ -357,6 +357,7 @@ USE_USLEEP(APPLET_NOFORK(usleep, usleep,
     2.7 + USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     2.8 + USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     2.9 + USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
    2.10 ++USE_VCSA2TXT(APPLET(vcsa2txt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    2.11 + USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
    2.12 + USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
    2.13 + USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
    2.14 +
    2.15 +--- busybox-1.7.3/include/usage.h	2008-03-01 11:22:06.000000000 +0100
    2.16 ++++ busybox-1.7.3/include/usage.h	2008-03-01 11:32:48.000000000 +0100
    2.17 +@@ -3835,6 +3835,13 @@ USE_FEATURE_RUN_PARTS_FANCY("\n	-l	Print
    2.18 +        "	set_ingress_map	[vlan-name] [skb_priority] [vlan_qos]\n" \
    2.19 +        "	set_name_type	[name-type]"
    2.20 + 
    2.21 ++#define vcsa2txt_trivial_usage \
    2.22 ++       "stdin"
    2.23 ++#define vcsa2txt_full_usage \
    2.24 ++       "Filter /dev/vcsa* to ansi escape sequences"
    2.25 ++#define vcsa2txt_example_usage \
    2.26 ++       "# vcsa2txt < /dev/vcsa1\n"
    2.27 ++
    2.28 + #define vi_trivial_usage \
    2.29 +        "[OPTION] [FILE]..."
    2.30 + #define vi_full_usage \
    2.31 +
    2.32 +--- busybox-1.7.3/miscutils/Config.in	2008-03-01 11:21:44.000000000 +0100
    2.33 ++++ busybox-1.7.3/miscutils/Config.in	2008-03-01 11:32:32.000000000 +0100
    2.34 +@@ -380,6 +380,12 @@ config TTYSIZE
    2.35 + 	  only height, or both, in any order. It also does not complain on error,
    2.36 + 	  but returns default 80x24. Usage in shell scripts: width=`ttysize w`.
    2.37 + 
    2.38 ++config VCSA2TXT
    2.39 ++	bool "vcsa2txt"
    2.40 ++	default n
    2.41 ++	help
    2.42 ++	  Filter /dev/vcsa* output to ansi escape sequences.
    2.43 ++
    2.44 + config WATCHDOG
    2.45 + 	bool "watchdog"
    2.46 + 	default n
    2.47 +
    2.48 +--- busybox-1.7.3/util-linux/Kbuild	2008-03-01 11:21:57.000000000 +0100
    2.49 ++++ busybox-1.7.3/util-linux/Kbuild	2008-03-01 11:32:37.000000000 +0100
    2.50 +@@ -30,4 +30,5 @@ lib-$(CONFIG_SCRIPT)		+=script.o
    2.51 + lib-$(CONFIG_SETARCH)		+=setarch.o
    2.52 + lib-$(CONFIG_SWAPONOFF)		+=swaponoff.o
    2.53 + lib-$(CONFIG_SWITCH_ROOT)	+=switch_root.o
    2.54 ++lib-$(CONFIG_VCSA2TXT)		+=vcsa2txt.o
    2.55 + lib-$(CONFIG_UMOUNT)		+=umount.o
    2.56 +
    2.57 +--- busybox-1.7.3/util-linux/vcsa2txt.c	1970-01-01 01:00:00.000000000 +0100
    2.58 ++++ busybox-1.7.3/util-linux/vcsa2txt.c	2008-03-01 11:36:13.000000000 +0100
    2.59 +@@ -0,0 +1,48 @@
    2.60 ++#include "libbb.h"
    2.61 ++
    2.62 ++static void writechar(int c) { (void)write(1,&c,1); }
    2.63 ++
    2.64 ++int vcsa2txt_main(int argc, char *argv[]);
    2.65 ++int vcsa2txt_main(int argc, char *argv[])
    2.66 ++{
    2.67 ++  struct {unsigned char l, c, x, y;} scrn; // man 4 console_codes   BLGCRMOW
    2.68 ++  static unsigned char last, ch[2], end[5] = "\e[0m\n", color[8] = "04261537";
    2.69 ++  int sp, lf, x;
    2.70 ++  if (read(0, &scrn, 4) < 0) return 1;
    2.71 ++  for (lf = 0; scrn.l; lf++, scrn.l--) for (sp = x = 0; ++x <= scrn.c;) {
    2.72 ++    if (read(0, &ch[0], 2) < 0) return 1;
    2.73 ++    if (argc > 1) ch[1] = 0;
    2.74 ++    sp++; if (last == ch[1] && ch[0] == ' ') continue;
    2.75 ++    for (lf++; --lf;) writechar('\n'); while (--sp) writechar(' ');
    2.76 ++#define PACKED
    2.77 ++#ifdef PACKED
    2.78 ++    if (last ^= ch[1]) {
    2.79 ++      char esc[16],*s;
    2.80 ++      struct offsets { char mask, type, shr; } *p;
    2.81 ++      static struct offsets offset[3] = {{8,0,1},{0x70,'4',4},{7,'3',0}};
    2.82 ++      static char init = 0x7F;
    2.83 ++      s = esc+2; *(short *)esc = '\e'+256*'[';
    2.84 ++      p = offset; do if ((init|last) & p->mask) {
    2.85 ++	int c = (ch[1] & p->mask) >> p->shr;
    2.86 ++	if ((*s = p->type) != 0) s++;
    2.87 ++	else if (c == 0) { c = 2; *s++ = '2'; /* normal */}
    2.88 ++	*s++ = color[c]; *s++ = ';'; 
    2.89 ++      } while (p++->shr); s[-1] = 'm';
    2.90 ++      init = 0;
    2.91 ++      (void)write(1,esc,s-esc);
    2.92 ++    }
    2.93 ++    last = ch[1];
    2.94 ++#else
    2.95 ++    if (last != ch[1]) {
    2.96 ++      static char esc[10] = "\e[0;47;37m";
    2.97 ++      esc[2] = ((last = ch[1]) & 8) ? '1' /* bold */ : '0' /* defaults */;
    2.98 ++      esc[sizeof(esc)-5] = color[(ch[1] >> 4) & 7];
    2.99 ++      esc[sizeof(esc)-2] = color[ch[1] & 7];
   2.100 ++      (void)write(1,esc,sizeof(esc));
   2.101 ++    }
   2.102 ++#endif
   2.103 ++    writechar(ch[0]);
   2.104 ++  }
   2.105 ++  (void)write(1,end,sizeof(end));
   2.106 ++  return 0;
   2.107 ++}
     3.1 --- a/busybox/stuff/busybox-1.7.3.config	Sat Mar 01 00:38:44 2008 +0000
     3.2 +++ b/busybox/stuff/busybox-1.7.3.config	Sat Mar 01 11:31:53 2008 +0000
     3.3 @@ -1,7 +1,7 @@
     3.4  #
     3.5  # Automatically generated make config: don't edit
     3.6  # Busybox version: 1.7.3
     3.7 -# Wed Feb 27 00:11:33 2008
     3.8 +# Sat Mar  1 11:50:42 2008
     3.9  #
    3.10  CONFIG_HAVE_DOT_CONFIG=y
    3.11  
    3.12 @@ -531,6 +531,7 @@
    3.13  # CONFIG_FEATURE_TASKSET_FANCY is not set
    3.14  CONFIG_TIME=y
    3.15  # CONFIG_TTYSIZE is not set
    3.16 +CONFIG_VCSA2TXT=y
    3.17  CONFIG_WATCHDOG=y
    3.18  
    3.19  #