wok-stable annotate busybox/stuff/busybox-1.11.0-vcsa2txt.u @ rev 2909

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