[as-devel] small patch
Ashton Trey Belew (trey@veggie.stu.wesleyan.edu)
Sat, 27 Apr 2002 13:01:28 -0400
Hello,
A friend of mine sent me a nice randomizing color script for
aterm. For some odd reason I thought it would be cute to put it into
aterm itself. I diffed from today's CVS tree circum 1pm, If you would like
it, here it is:
RCS file: /cvsroot/aterm/aterm/src/main.c,v
retrieving revision 1.15
diff -c -u -r1.15 main.c
--- src/main.c 11 Mar 2001 06:58:20 -0000 1.15
+++ src/main.c 27 Apr 2002 16:36:00 -0000
@@ -1802,6 +1802,32 @@
if (!rs_color[i])
rs_color[i] = def_colorName[i];
+/************************************************************************
+My friend Joe Greenseid wrote a cute little perl script so that all the
+he exec's are different colors. He gave it to me; and I discovered
+that on my aging P166 that is was mad slow; and promptly forgot
+about it. Skip forward to me hanging out at Sean Dague's house
+one day. And as is the case when I am at his house we started
+goofing off; this code is the result. Sean did the hard work.
+************************************************************************/
+ if (Options & Opt_randomTint) {
+ char* randomtintcolors[] = {
+ "red","blue","orange","green","cyan","magenta"
+ };
+ double maximum;
+ int seed;
+ int colornum;
+ double x;
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ seed = tv.tv_usec;
+ srand(seed);
+ maximum = 6.0;
+ x = (double) rand() / (double) RAND_MAX;
+ colornum = (int) ( (double) maximum * x);
+ rs_color[Color_bg] = randomtintcolors[colornum];
+ }
+
#ifndef XTERM_REVERSE_VIDEO
/* this is how we implement reverseVideo */
if (Options & Opt_reverseVideo) {
Index: src/rxvt.h
===================================================================
RCS file: /cvsroot/aterm/aterm/src/rxvt.h,v
retrieving revision 1.12
diff -c -u -r1.12 rxvt.h
--- src/rxvt.h 10 Oct 2000 00:35:46 -0000 1.12
+++ src/rxvt.h 27 Apr 2002 16:36:00 -0000
@@ -690,6 +690,7 @@
#define Opt_scrollKeypress (1LU<<12)
#define Opt_transparent (1LU<<13)
#define Opt_transparent_sb (1LU<<14)
+#define Opt_randomTint (1LU<<15)
/* place holder used for parsing command-line options */
#define Opt_Boolean (1LU<<31)
Index: src/xdefaults.c
===================================================================
RCS file: /cvsroot/aterm/aterm/src/xdefaults.c,v
retrieving revision 1.5
diff -c -u -r1.5 xdefaults.c
--- src/xdefaults.c 30 May 2000 22:17:56 -0000 1.5
+++ src/xdefaults.c 27 Apr 2002 16:36:01 -0000
@@ -76,6 +76,7 @@
#endif
static const char *rs_visualBell = NULL;
static const char *rs_reverseVideo = NULL;
+static const char *randomTint = NULL;
#ifdef META8_OPTION
static const char *rs_meta8 = NULL;
@@ -140,6 +141,8 @@
STRG(rs_geometry, NULL, "g", NULL, NULL), /* short form */
BOOL(rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo,
"reverse video"),
+ BOOL(randomTint, "randomTint", "rtint", Opt_randomTint,
+ "random tint"),
#ifdef _MYSTYLE_
STRG(rs_mystyle, "MyStyle", "mst", "name",
"MyStyle"),
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ashton Trey Belew
e-mail: trey@veggie.wesleyan.edu
http://veggie.wesleyan.edu/trey/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Glib's Fourth Law of Unreliability:
Investment in reliability will increase until it exceeds the
probable cost of errors, or until someone insists on getting
some useful work done.