wok-stable view busybox/stuff/busybox-1.7.3-vcsa2txt.u @ rev 490

Up: slitaz-base-files (1.4) + slitaz-doc (1.2) to change slitaz release string
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 22 16:58:02 2008 +0100 (2008-03-22)
parents
children
line source
1 --- busybox-1.7.3/include/applets.h 2008-03-01 11:20:49.000000000 +0100
2 +++ busybox-1.7.3/include/applets.h 2008-03-01 11:24:45.000000000 +0100
3 @@ -357,6 +357,7 @@ USE_USLEEP(APPLET_NOFORK(usleep, usleep,
4 USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
5 USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
6 USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
7 +USE_VCSA2TXT(APPLET(vcsa2txt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
8 USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
9 USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
10 USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
12 --- busybox-1.7.3/include/usage.h 2008-03-01 11:22:06.000000000 +0100
13 +++ busybox-1.7.3/include/usage.h 2008-03-01 11:32:48.000000000 +0100
14 @@ -3835,6 +3835,13 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Print
15 " set_ingress_map [vlan-name] [skb_priority] [vlan_qos]\n" \
16 " set_name_type [name-type]"
18 +#define vcsa2txt_trivial_usage \
19 + "stdin"
20 +#define vcsa2txt_full_usage \
21 + "Filter /dev/vcsa* to ansi escape sequences"
22 +#define vcsa2txt_example_usage \
23 + "# vcsa2txt < /dev/vcsa1\n"
24 +
25 #define vi_trivial_usage \
26 "[OPTION] [FILE]..."
27 #define vi_full_usage \
29 --- busybox-1.7.3/miscutils/Config.in 2008-03-01 11:21:44.000000000 +0100
30 +++ busybox-1.7.3/miscutils/Config.in 2008-03-01 11:32:32.000000000 +0100
31 @@ -380,6 +380,12 @@ config TTYSIZE
32 only height, or both, in any order. It also does not complain on error,
33 but returns default 80x24. Usage in shell scripts: width=`ttysize w`.
35 +config VCSA2TXT
36 + bool "vcsa2txt"
37 + default n
38 + help
39 + Filter /dev/vcsa* output to ansi escape sequences.
40 +
41 config WATCHDOG
42 bool "watchdog"
43 default n
45 --- busybox-1.7.3/util-linux/Kbuild 2008-03-01 11:21:57.000000000 +0100
46 +++ busybox-1.7.3/util-linux/Kbuild 2008-03-01 11:32:37.000000000 +0100
47 @@ -30,4 +30,5 @@ lib-$(CONFIG_SCRIPT) +=script.o
48 lib-$(CONFIG_SETARCH) +=setarch.o
49 lib-$(CONFIG_SWAPONOFF) +=swaponoff.o
50 lib-$(CONFIG_SWITCH_ROOT) +=switch_root.o
51 +lib-$(CONFIG_VCSA2TXT) +=vcsa2txt.o
52 lib-$(CONFIG_UMOUNT) +=umount.o
54 --- busybox-1.7.3/util-linux/vcsa2txt.c 1970-01-01 01:00:00.000000000 +0100
55 +++ busybox-1.7.3/util-linux/vcsa2txt.c 2008-03-01 11:36:13.000000000 +0100
56 @@ -0,0 +1,48 @@
57 +#include "libbb.h"
58 +
59 +static void writechar(int c) { (void)write(1,&c,1); }
60 +
61 +int vcsa2txt_main(int argc, char *argv[]);
62 +int vcsa2txt_main(int argc, char *argv[])
63 +{
64 + struct {unsigned char l, c, x, y;} scrn; // man 4 console_codes BLGCRMOW
65 + static unsigned char last, ch[2], end[5] = "\e[0m\n", color[8] = "04261537";
66 + int sp, lf, x;
67 + if (read(0, &scrn, 4) < 0) return 1;
68 + for (lf = 0; scrn.l; lf++, scrn.l--) for (sp = x = 0; ++x <= scrn.c;) {
69 + if (read(0, &ch[0], 2) < 0) return 1;
70 + if (argc > 1) ch[1] = 0;
71 + sp++; if (last == ch[1] && ch[0] == ' ') continue;
72 + for (lf++; --lf;) writechar('\n'); while (--sp) writechar(' ');
73 +#define PACKED
74 +#ifdef PACKED
75 + if (last ^= ch[1]) {
76 + char esc[16],*s;
77 + struct offsets { char mask, type, shr; } *p;
78 + static struct offsets offset[3] = {{8,0,1},{0x70,'4',4},{7,'3',0}};
79 + static char init = 0x7F;
80 + s = esc+2; *(short *)esc = '\e'+256*'[';
81 + p = offset; do if ((init|last) & p->mask) {
82 + int c = (ch[1] & p->mask) >> p->shr;
83 + if ((*s = p->type) != 0) s++;
84 + else if (c == 0) { c = 2; *s++ = '2'; /* normal */}
85 + *s++ = color[c]; *s++ = ';';
86 + } while (p++->shr); s[-1] = 'm';
87 + init = 0;
88 + (void)write(1,esc,s-esc);
89 + }
90 + last = ch[1];
91 +#else
92 + if (last != ch[1]) {
93 + static char esc[10] = "\e[0;47;37m";
94 + esc[2] = ((last = ch[1]) & 8) ? '1' /* bold */ : '0' /* defaults */;
95 + esc[sizeof(esc)-5] = color[(ch[1] >> 4) & 7];
96 + esc[sizeof(esc)-2] = color[ch[1] & 7];
97 + (void)write(1,esc,sizeof(esc));
98 + }
99 +#endif
100 + writechar(ch[0]);
101 + }
102 + (void)write(1,end,sizeof(end));
103 + return 0;
104 +}