Here is how to edit the death star logo

Bill Mayhew wtm at neoucom.UUCP
Fri Jan 5 16:03:40 AEST 1990


Hi,

It really doesn't require fatbit and adb to edit the working icon.
The example below allows you to do it with your very own c program.
You do have to be root in order to edit the icon.  You could set
uid the program, but then any random l'user could hose your icon;
not that it would make that much difference...

Compile the program below.  Assuming you name the executable wb,
simply type wb with no arguments.  Wb by itself will send the bit
pattern of the icon to stdout as ascii chars, which you may trap
and edit with vi or whatever.  I strongly suggest saving the
original icon to a file for future reference.  After you've don't
your Van Gogh immitation, type wb file_name, and wb will program
the icon to the bit pattern specified in file_name.

I didn't write the program, but I have tested it and it works.
John is given credit in the header below.  As usual, use at your
own risk.   Sorry if this voilates net ettiquite to post this here,
but our access to unix-pc is dicey; it isn't very long anyway.


Enjoy,
Bill wtm at neoucom.edu  (...!lll-winken!scooter!neoucom!wtm)
                      (...!uunet!aablue!neoucom!wtm)
                      (...!cwjcc!neoucom!wtm)


=========================cut for wb.c===============================
/* wb -- Change "window/busy" indicator on bottom right of UNIX PC screen
 *	Copyright (c) 1988 by John Buck
 *	You may NOT include this program or its algorithm in any
 *	product designed for sale.  You can copy it for your own non-commercial
 *	use only; this entire copyright notice must be included.
 */
#include <stdio.h>
#include <nlist.h>
#include <sys/types.h>
#include <sys/stat.h>

struct nlist nl[2] = {
	{ "wbraster" },
	{ NULL }
};

/* The "working" bitmap is 21 high by 80 wide */
unsigned short	wb[21][5];
int	fd;

main(argc, argv)
char **argv;
{
	FILE *fp;
	struct stat wins, nms;

	fp = NULL;
	/* Is the window driver there? */
	if(stat("/etc/lddrv/wind", &(wins)) == -1){
		fprintf(stderr, "%s: Ooops -- can't stat ", argv[0]);
		perror("/etc/lddrv/wind");
		exit(5);
	}
	/* Quick name-list lookup, saves spending lots of CPU time
	 * each invokation
	 */
	if(stat("/etc/lddrv/wbrast.nl", &nms) == -1 ||
	   nms.st_mtime < wins.st_mtime ||
	   (fp = fopen("/etc/lddrv/wbrast.nl", "r")) == NULL ||
	   fread(&(nl[0]), sizeof (nl[0]), 1, fp) != 1){
		if(fp) fclose(fp);
		/* Too bad, have to do a lookup (once only?) */
		if(nlist("/etc/lddrv/wind", nl) < 0 || nl[0].n_value <= 0){
			fprintf(stderr, "%s: Bad namelist for %s\n", argv[0],
				nl[0].n_name);
			exit(2);
		}
		if((fp = fopen("/etc/lddrv/wbrast.nl", "w")) != NULL){
			fwrite(&(nl[0]), sizeof (nl[0]), 1, fp);
			fclose(fp);
		}
	}
#ifdef DEBUG
	fprintf(stdout, "wbraster @ 0x%x\n", nl[0].n_value);
#endif
	if((fd = open("/dev/kmem", 2)) == -1){
		perror("/dev/kmem");
		exit(3);
	}
	lseek(fd, nl[0].n_value, 0);
	/* If args, must be a filename containing a bitmap */
	if(argc > 1)
		dofile(argv[1]);
	else	{
		/* Otherwise, just show us what is there */
		if(read(fd, &(wb[0][0]), 21*5*(sizeof (short))) != 21*5*(sizeof(short))){
			fprintf(stderr, "Error reading raster data\n");
			close(fd);
			exit(3);
		}
		printrast();
	}
	close(fd);
	exit(0);
}

printrast()
{
	register unsigned short i, j, c, k;

	for(i = 0; i < 21; i++){
		for(j = 0; j < 5; j++){
			c = wb[i][j];
			for(k = 0; k < 16; k++, c >>= 1){
				if(c & 1)
					putchar('@');
				else
					putchar(' ');
			}
		}
		putchar('\n');
	}
}

dofile(f)
char *f;
{
	FILE *fp;
	register unsigned short i, j, c, k;
	register char *s;
	char ibuf[258];

	if((fp = fopen(f, "r")) == NULL){
		fprintf(stderr, "Can't open ");
		perror(f);
		exit(3);
	}
	for(i = 0; i < 21; i++){
		if(fgets(ibuf, 256, fp) == NULL){
			fprintf(stderr, "Need 21 lines, only found %d\n", i);
			exit(6);
		}
		s = ibuf;
		for(j = 0; j < 5; j++){
			c = 0;
			for(k = 0; k < 16; k++, s++){
				if(*s == ' '){
					;
				} else if(*s == '@'){
					c |= (1<<k);
				} else break;
			}
			wb[i][j] = c;
		}
	}
	write(fd, &(wb[0][0]), 21*5*(sizeof (short)));
} /* end of wb.c */
====================end of transmission==========================



More information about the Comp.sys.att mailing list