wok annotate busybox/stuff/busybox-1.10.0-vcsa2txt.u @ rev 1345

Add: GPA, Gnupg GUI.
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Sep 04 21:21:45 2008 +0200 (2008-09-04)
parents 28948d3430a1
children
rev   line source
pascal@493 1 --- busybox-1.10.0/include/applets.h Sat Mar 22 02:31:50 2008
pascal@493 2 +++ busybox-1.10.0/include/applets.h Sat Mar 22 02:31:50 2008
pascal@493 3 @@ -382,6 +382,7 @@
pascal@493 4 USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
pascal@493 5 USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
pascal@493 6 USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER))
pascal@493 7 +USE_VCSA2TXT(APPLET(vcsa2txt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
pascal@493 8 USE_VI(APPLET(vi, _BB_DIR_BIN, _BB_SUID_NEVER))
pascal@493 9 USE_VLOCK(APPLET(vlock, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
pascal@493 10 USE_WATCH(APPLET(watch, _BB_DIR_BIN, _BB_SUID_NEVER))
pascal@493 11
pascal@493 12 --- busybox-1.10.0/include/usage.h Sat Mar 22 02:31:50 2008
pascal@493 13 +++ busybox-1.10.0/include/usage.h Sat Mar 22 02:31:50 2008
pascal@517 14 @@ -4314,6 +4314,13 @@
pascal@493 15 "\n set_ingress_map [vlan-name] [skb_priority] [vlan_qos]" \
pascal@493 16 "\n set_name_type [name-type]" \
pascal@493 17
pascal@493 18 +#define vcsa2txt_trivial_usage \
pascal@493 19 + "stdin"
pascal@493 20 +#define vcsa2txt_full_usage \
pascal@493 21 + "Filter /dev/vcsa* to ansi escape sequences"
pascal@493 22 +#define vcsa2txt_example_usage \
pascal@493 23 + "# vcsa2txt < /dev/vcsa1\n"
pascal@493 24 +
pascal@493 25 #define vi_trivial_usage \
pascal@493 26 "[OPTION] [FILE]..."
pascal@493 27 #define vi_full_usage \
pascal@617 28
pascal@493 29 --- busybox-1.10.0/miscutils/Config.in Sat Mar 22 02:31:50 2008
pascal@493 30 +++ busybox-1.10.0/miscutils/Config.in Sat Mar 22 02:31:50 2008
pascal@493 31 @@ -461,6 +461,12 @@
pascal@493 32 only height, or both, in any order. It also does not complain on error,
pascal@493 33 but returns default 80x24. Usage in shell scripts: width=`ttysize w`.
pascal@493 34
pascal@493 35 +config VCSA2TXT
pascal@493 36 + bool "vcsa2txt"
pascal@493 37 + default n
pascal@493 38 + help
pascal@493 39 + Filter /dev/vcsa* output to ansi escape sequences.
pascal@493 40 +
pascal@493 41 config WATCHDOG
pascal@493 42 bool "watchdog"
pascal@493 43 default n
pascal@617 44
pascal@493 45 --- busybox-1.10.0/util-linux/Kbuild Sat Mar 22 02:31:53 2008
pascal@493 46 +++ busybox-1.10.0/util-linux/Kbuild Sat Mar 22 02:31:53 2008
pascal@493 47 @@ -33,3 +33,4 @@
pascal@493 48 lib-$(CONFIG_SWAPONOFF) += swaponoff.o
pascal@493 49 lib-$(CONFIG_SWITCH_ROOT) += switch_root.o
pascal@493 50 lib-$(CONFIG_UMOUNT) += umount.o
pascal@493 51 +lib-$(CONFIG_VCSA2TXT) += vcsa2txt.o
pascal@617 52
pascal@493 53 --- busybox-1.10.0/util-linux/vcsa2txt.c Sat Mar 22 19:40:15 2008
pascal@493 54 +++ busybox-1.10.0/util-linux/vcsa2txt.c Sat Mar 22 19:40:15 2008
pascal@493 55 @@ -0,0 +1,79 @@
pascal@493 56 +/* vi: set sw=4 ts=4: */
pascal@493 57 +/*
pascal@493 58 + * /dev/vcsa* filter for busybox
pascal@493 59 + *
pascal@493 60 + * pascal.bellard@ads-lu.com
pascal@493 61 + *
pascal@493 62 + * Licensed under GPLv2 or later, see file License in this tarball for details.
pascal@493 63 + */
pascal@493 64 +
pascal@493 65 +#include "libbb.h"
pascal@493 66 +
pascal@493 67 +int vcsa2txt_main(int argc) MAIN_EXTERNALLY_VISIBLE;
pascal@493 68 +int vcsa2txt_main(int argc)
pascal@493 69 +{
pascal@493 70 + struct {
pascal@493 71 + unsigned char l, c, x, y; // man 4 console_codes
pascal@493 72 + } scrn;
pascal@493 73 + unsigned char last = 0, ch[2]; // BLGCRMOW
pascal@493 74 + static unsigned char end[5] = "\e[0m\n", color[8] = "04261537";
pascal@493 75 + int sp, lf, x;
pascal@493 76 +
pascal@493 77 + if (safe_read(0, &scrn, 4) < 0) return 1;
pascal@493 78 + for (lf = 0; scrn.l; lf++, scrn.l--) {
pascal@493 79 + for (sp = x = 0; ++x <= scrn.c;) {
pascal@493 80 + if (safe_read(0, &ch[0], 2) < 0) return 1;
pascal@493 81 + if (argc > 1) ch[1] = 0;
pascal@493 82 + sp++;
pascal@493 83 + if (last == ch[1] && ch[0] == ' ') continue;
pascal@493 84 + for (lf++; --lf;) bb_putchar('\n');
pascal@493 85 + while (--sp) bb_putchar(' ');
pascal@493 86 +#define ENABLE_VCSA_PACKED 1
pascal@493 87 +#if ENABLE_VCSA_PACKED
pascal@493 88 + if (last ^= ch[1]) {
pascal@493 89 + char esc[16],*s;
pascal@493 90 + struct offsets {
pascal@493 91 + char mask, type, shr;
pascal@493 92 + } *p;
pascal@493 93 + static struct offsets offset[3] = {
pascal@493 94 + {8,0,1}, {0x70,'4',4}, {7,'3',0}
pascal@493 95 + };
pascal@493 96 + static char init = 0x7F;
pascal@493 97 +
pascal@493 98 + s = esc+2;
pascal@493 99 + *(short *)esc = ntohs(256*'\e'+'[');
pascal@493 100 + p = offset;
pascal@493 101 + do {
pascal@493 102 + if ((init|last) & p->mask) {
pascal@493 103 + int c = (ch[1] & p->mask) >> p->shr;
pascal@493 104 +
pascal@493 105 + if ((*s = p->type) != 0) s++;
pascal@493 106 + else if (c == 0) {
pascal@493 107 + c = 2;
pascal@493 108 + *s++ = '2'; /* normal */
pascal@493 109 + }
pascal@493 110 + *s++ = color[c];
pascal@493 111 + *s++ = ';';
pascal@493 112 + }
pascal@493 113 + } while (p++->shr);
pascal@493 114 + s[-1] = 'm';
pascal@493 115 + init = 0;
pascal@493 116 + fwrite(esc,s-esc,1,stdout);
pascal@493 117 + }
pascal@493 118 + last = ch[1];
pascal@493 119 +#else
pascal@493 120 + if (last != ch[1]) {
pascal@493 121 + static char esc[10] = "\e[0;47;37m";
pascal@493 122 +
pascal@493 123 + esc[2] = ((last = ch[1]) & 8) ? '1' /* bold */ : '0' /* defaults */;
pascal@493 124 + esc[sizeof(esc)-5] = color[(ch[1] >> 4) & 7];
pascal@493 125 + esc[sizeof(esc)-2] = color[ch[1] & 7];
pascal@493 126 + fwrite(esc,sizeof(esc),1,stdout);
pascal@493 127 + }
pascal@493 128 +#endif
pascal@493 129 + bb_putchar(ch[0]);
pascal@493 130 + }
pascal@493 131 + }
pascal@493 132 + fwrite(end,sizeof(end),1,stdout);
pascal@493 133 + return 0;
pascal@493 134 +}