wok-6.x diff busybox/stuff/busybox-1.7.3-vcsa2txt.u @ rev 2282

cups: disable pam support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Feb 19 11:09:54 2009 +0000 (2009-02-19)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/busybox/stuff/busybox-1.7.3-vcsa2txt.u	Thu Feb 19 11:09:54 2009 +0000
     1.3 @@ -0,0 +1,104 @@
     1.4 +--- busybox-1.7.3/include/applets.h	2008-03-01 11:20:49.000000000 +0100
     1.5 ++++ busybox-1.7.3/include/applets.h	2008-03-01 11:24:45.000000000 +0100
     1.6 +@@ -357,6 +357,7 @@ USE_USLEEP(APPLET_NOFORK(usleep, usleep,
     1.7 + USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     1.8 + USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     1.9 + USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
    1.10 ++USE_VCSA2TXT(APPLET(vcsa2txt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    1.11 + USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
    1.12 + USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
    1.13 + USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
    1.14 +
    1.15 +--- busybox-1.7.3/include/usage.h	2008-03-01 11:22:06.000000000 +0100
    1.16 ++++ busybox-1.7.3/include/usage.h	2008-03-01 11:32:48.000000000 +0100
    1.17 +@@ -3835,6 +3835,13 @@ USE_FEATURE_RUN_PARTS_FANCY("\n	-l	Print
    1.18 +        "	set_ingress_map	[vlan-name] [skb_priority] [vlan_qos]\n" \
    1.19 +        "	set_name_type	[name-type]"
    1.20 + 
    1.21 ++#define vcsa2txt_trivial_usage \
    1.22 ++       "stdin"
    1.23 ++#define vcsa2txt_full_usage \
    1.24 ++       "Filter /dev/vcsa* to ansi escape sequences"
    1.25 ++#define vcsa2txt_example_usage \
    1.26 ++       "# vcsa2txt < /dev/vcsa1\n"
    1.27 ++
    1.28 + #define vi_trivial_usage \
    1.29 +        "[OPTION] [FILE]..."
    1.30 + #define vi_full_usage \
    1.31 +
    1.32 +--- busybox-1.7.3/miscutils/Config.in	2008-03-01 11:21:44.000000000 +0100
    1.33 ++++ busybox-1.7.3/miscutils/Config.in	2008-03-01 11:32:32.000000000 +0100
    1.34 +@@ -380,6 +380,12 @@ config TTYSIZE
    1.35 + 	  only height, or both, in any order. It also does not complain on error,
    1.36 + 	  but returns default 80x24. Usage in shell scripts: width=`ttysize w`.
    1.37 + 
    1.38 ++config VCSA2TXT
    1.39 ++	bool "vcsa2txt"
    1.40 ++	default n
    1.41 ++	help
    1.42 ++	  Filter /dev/vcsa* output to ansi escape sequences.
    1.43 ++
    1.44 + config WATCHDOG
    1.45 + 	bool "watchdog"
    1.46 + 	default n
    1.47 +
    1.48 +--- busybox-1.7.3/util-linux/Kbuild	2008-03-01 11:21:57.000000000 +0100
    1.49 ++++ busybox-1.7.3/util-linux/Kbuild	2008-03-01 11:32:37.000000000 +0100
    1.50 +@@ -30,4 +30,5 @@ lib-$(CONFIG_SCRIPT)		+=script.o
    1.51 + lib-$(CONFIG_SETARCH)		+=setarch.o
    1.52 + lib-$(CONFIG_SWAPONOFF)		+=swaponoff.o
    1.53 + lib-$(CONFIG_SWITCH_ROOT)	+=switch_root.o
    1.54 ++lib-$(CONFIG_VCSA2TXT)		+=vcsa2txt.o
    1.55 + lib-$(CONFIG_UMOUNT)		+=umount.o
    1.56 +
    1.57 +--- busybox-1.7.3/util-linux/vcsa2txt.c	1970-01-01 01:00:00.000000000 +0100
    1.58 ++++ busybox-1.7.3/util-linux/vcsa2txt.c	2008-03-01 11:36:13.000000000 +0100
    1.59 +@@ -0,0 +1,48 @@
    1.60 ++#include "libbb.h"
    1.61 ++
    1.62 ++static void writechar(int c) { (void)write(1,&c,1); }
    1.63 ++
    1.64 ++int vcsa2txt_main(int argc, char *argv[]);
    1.65 ++int vcsa2txt_main(int argc, char *argv[])
    1.66 ++{
    1.67 ++  struct {unsigned char l, c, x, y;} scrn; // man 4 console_codes   BLGCRMOW
    1.68 ++  static unsigned char last, ch[2], end[5] = "\e[0m\n", color[8] = "04261537";
    1.69 ++  int sp, lf, x;
    1.70 ++  if (read(0, &scrn, 4) < 0) return 1;
    1.71 ++  for (lf = 0; scrn.l; lf++, scrn.l--) for (sp = x = 0; ++x <= scrn.c;) {
    1.72 ++    if (read(0, &ch[0], 2) < 0) return 1;
    1.73 ++    if (argc > 1) ch[1] = 0;
    1.74 ++    sp++; if (last == ch[1] && ch[0] == ' ') continue;
    1.75 ++    for (lf++; --lf;) writechar('\n'); while (--sp) writechar(' ');
    1.76 ++#define PACKED
    1.77 ++#ifdef PACKED
    1.78 ++    if (last ^= ch[1]) {
    1.79 ++      char esc[16],*s;
    1.80 ++      struct offsets { char mask, type, shr; } *p;
    1.81 ++      static struct offsets offset[3] = {{8,0,1},{0x70,'4',4},{7,'3',0}};
    1.82 ++      static char init = 0x7F;
    1.83 ++      s = esc+2; *(short *)esc = '\e'+256*'[';
    1.84 ++      p = offset; do if ((init|last) & p->mask) {
    1.85 ++	int c = (ch[1] & p->mask) >> p->shr;
    1.86 ++	if ((*s = p->type) != 0) s++;
    1.87 ++	else if (c == 0) { c = 2; *s++ = '2'; /* normal */}
    1.88 ++	*s++ = color[c]; *s++ = ';'; 
    1.89 ++      } while (p++->shr); s[-1] = 'm';
    1.90 ++      init = 0;
    1.91 ++      (void)write(1,esc,s-esc);
    1.92 ++    }
    1.93 ++    last = ch[1];
    1.94 ++#else
    1.95 ++    if (last != ch[1]) {
    1.96 ++      static char esc[10] = "\e[0;47;37m";
    1.97 ++      esc[2] = ((last = ch[1]) & 8) ? '1' /* bold */ : '0' /* defaults */;
    1.98 ++      esc[sizeof(esc)-5] = color[(ch[1] >> 4) & 7];
    1.99 ++      esc[sizeof(esc)-2] = color[ch[1] & 7];
   1.100 ++      (void)write(1,esc,sizeof(esc));
   1.101 ++    }
   1.102 ++#endif
   1.103 ++    writechar(ch[0]);
   1.104 ++  }
   1.105 ++  (void)write(1,end,sizeof(end));
   1.106 ++  return 0;
   1.107 ++}