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