uggworek@sunybcs.UUCP (Don Gworek) (12/16/86)
Here is a simple suntool that displays an icon, whether the tool is open or closed. You can display your favorite icons somewhere on the console screen, without invoking a more CPU expensive tool. Three icons (gort, the robot from the "Day The Earth Stood Still"; marvin, the cute kid from the comic strip by Tom Armstrong; and the bat signal from the "Batman" TV series") are enclosed. If you have an "Odie" plush toy on your desk, or if you hang fuzzy dice from the rearview mirror of your car, you'll probably enjoy this program! This program was compiled and installed on both a Sun 2 and Sun 3 running 3.0. Don Gworek UU: ...{rocksvax|decvax}!sunybcs!gworek CS: gworek@buffalo.edu BI: gworek@sunybcs ----------------------------- cut here ------------------------------- # This is a shell archive. Remove anything before this line, then # unpack it by saving it in a file and typing "sh file". (Files # unpacked will be owned by you and have default permissions.) # # This archive contains: # staticon.1 staticon.c Makefile batsignal.icon gort.icon marvin.icon echo x - staticon.1 sed -e 's/^X//' > "staticon.1" << '//E*O*F staticon.1//' X.\" @(#)staticon.1 1.2 (Don Gworek) 9/14/86 X.\" This document uses the troff(1) -man macros X.TH STATICON 1 "14 September 1986" X.SH NAME Xstaticon X\- display an icon X.SH SYNOPSIS X.B staticon X[ Xsuntool args X] Xiconfile X.PP X.SH DESCRIPTION X.I Staticon Xdisplays your favorite icon when closed or open. XAccepts all the generic tool arguments Xdiscussed in X.I suntools(1). X.SH SEE ALSO Xsuntools(1), iconedit(1) X.SH NOTE XOne of the more frivolous programs ever written. X.SH AUTHOR XDon Gworek ...{rocksvax|decvax}!sunybcs!gworek //E*O*F staticon.1// echo x - staticon.c sed -e 's/^X//' > "staticon.c" << '//E*O*F staticon.c//' X#ifndef lint Xstatic char rcsid[] X = "$Header: staticon,v 1.10 86/10/13 15:42:52 gworek Locked $"; X#endif X X/* X * Your favorite icon, when open or closed. X * X * Compile: cc -O -s -o staticon staticon.c -lsuntool -lsunwindow -lpixrect X */ X X#include <stdio.h> X#include <suntool/tool_hs.h> X#include <suntool/gfxsw.h> X#include <suntool/msgsw.h> X#include <suntool/icon_load.h> X Xchar *progname; /* Who am i? */ Xstruct tool *tool; /* The suntool */ X Xchar *rindex(); Xint sigwinched(); X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X char **tool_attrs = NULL; /* User supplied suntool options */ X struct icon my_icon; /* User's icon */ X struct toolsw *my_sw; /* Subwindow for the tool */ X struct gfxsubwindow *my_gfx; /* Graphics subwindow */ X X/* X * What's the name of this program? X */ X progname = (progname = rindex(*argv, '/')) ? ++progname : *argv; X argc--; argv++; X/* X * Get user's generic suntool args, if any. X */ X if ((tool_parse_all(&argc, argv, &tool_attrs, progname)) == -1) X usage(); X/* X * Load the user's icon X */ X if (argc != 1) X usage(); X { X char errorbuf[IL_ERRORMSG_SIZE + 1]; X X if (icon_load(&my_icon, *argv, errorbuf) != 0) { X (void) fprintf(stderr, "%s: %s: %s.\n", X progname, *argv, errorbuf); X exit(1); X } X } X/* X * Make the sun tool, cleanup attributes, X */ X if ((tool = tool_make( X WIN_WIDTH, my_icon.ic_mpr->pr_width X + (2 * TOOL_BORDERWIDTH), X WIN_HEIGHT, my_icon.ic_mpr->pr_height X + (2 * TOOL_BORDERWIDTH), X WIN_NAME_STRIPE, FALSE, X WIN_ICONIC, TRUE, X WIN_ICON, &my_icon, X WIN_ATTR_LIST, tool_attrs, X 0)) == NULL) { X fputs("%s: Can't make tool\n", stderr); X exit(1); X } X tool_free_attribute_list(tool_attrs); X (void) signal(SIGWINCH, sigwinched); X/* X * Put the user's icon into a subwindow, X */ X if ((my_sw = gfxsw_createtoolsubwindow(tool, "", X my_icon.ic_mpr->pr_width, X my_icon.ic_mpr->pr_height, NULL)) == NULL) { X fputs("Can't create icon graphics subwindow\n", stderr); X exit(1); X } X my_gfx = (struct gfxsubwindow *) my_sw->ts_data; X gfxsw_getretained(my_gfx); X pw_write(my_gfx->gfx_pixwin, 0, 0, my_icon.ic_mpr->pr_width, X my_icon.ic_mpr->pr_height, PIX_SRC, my_icon.ic_mpr, 0, 0); X/* X * Run the tool. First install the tool in the tree of windows. X * then sit in tool_select until the user kills the tool. When the X * tool is exited, "destroy" the tool, and exit. X */ X tool_install(tool); X tool_select(tool, 0); X tool_destroy(tool); X} X X/* X * When the window size changes call this routine to effect X * any damage repairs that are needed. X */ Xsigwinched() X{ X tool_sigwinch(tool); X} X Xusage() X{ X (void) fprintf(stderr, "%s: [suntool args] iconfile\n", progname); X exit(1); X} //E*O*F staticon.c// echo x - Makefile sed -e 's/^X//' > "Makefile" << '//E*O*F Makefile//' X# X# $Header: Makefile,v 1.6 86/07/19 16:53:52 gworek Exp $ X# X# Makefile for staticon X XSRCS = staticon.c XOBJS = staticon.o XDEST = staticon XINSTALLDIR = /usr/local/bin X XICONS = batsignal.icon gort.icon marvin.icon XICONDIR = /usr/include/local X XLFLAGS = -lsuntool -lsunwindow -lpixrect XCFLAGS = -O -s X X${DEST}: ${OBJS} X cc ${CFLAGS} -o ${DEST} ${OBJS} ${LFLAGS} X Xinstall: X install ${DEST} ${INSTALLDIR} X cp ${ICONS} ${ICONDIR} X Xclean: X rm -f *.o ${DEST} X Xlint: ${HDRS} ${SRCS} X lint ${DFLAGS} ${SRCS} //E*O*F Makefile// echo x - batsignal.icon sed -e 's/^X//' > "batsignal.icon" << '//E*O*F batsignal.icon//' X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 X * Description: the famous batsignal in the sky, from the "Batman" TV series X */ X 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xD555,0x5555,0x5555,0x5555, X 0xAAAA,0xAAAA,0xAAAA,0xAAAB,0xD555,0x5555,0x5555,0x5555, X 0xAAAA,0xAAAA,0xBFEA,0xAAAB,0xD555,0x5555,0xFFFD,0x5555, X 0xAAAA,0xAAAF,0xC01F,0xAAAB,0xD555,0x555E,0x0003,0xD555, X 0xAAAA,0xAAB8,0x0000,0xEAAB,0xD555,0x5570,0x0000,0x7555, X 0xAAAA,0xAAC0,0x1DC0,0x1AAB,0xD555,0x5580,0x1FC0,0x0D55, X 0xAAAA,0xAB00,0x1FC0,0x06AB,0xD555,0x5700,0x0F80,0x0755, X 0xAAAA,0xAE00,0xCF98,0x03AB,0xD555,0x5C01,0xEFBC,0x0155, X 0xAAAA,0xAC03,0xFFFE,0x01AB,0xD555,0x5807,0xFFFF,0x00D5, X 0xAAAA,0xB80F,0xFFFF,0x80AB,0xD555,0x781F,0xFFFF,0xC0D5, X 0xAAAA,0xF03F,0xFFFF,0xE06B,0xD555,0x507F,0xFFFF,0xF055, X 0xAAAA,0xF0FF,0xFFFF,0xF86B,0xD555,0x91FF,0xFFFF,0xFC55, X 0xAAAB,0xB3FF,0xFFFF,0xFE6B,0xD557,0x37FF,0xFFFF,0xFF55, X 0xAAAE,0x57EF,0xFFFF,0xBF6B,0xD555,0x170F,0xFFDF,0x0355, X 0xAAAC,0x9807,0x3FCF,0x00EB,0xD55E,0x3806,0x1F86,0x00D5, X 0xAABC,0x4800,0x0E00,0x00AB,0xD571,0x1C00,0x0400,0x01D5, X 0xAAA8,0x8C00,0x0000,0x01AB,0xD562,0x2600,0x0000,0x0355, X 0xAAE4,0x4700,0x0000,0x06AB,0xD5D1,0x1300,0x0000,0x0555, X 0xAB88,0x8980,0x0000,0x0EAB,0xD722,0x22C0,0x0000,0x1D55, X 0xAE44,0x44F0,0x0000,0x7AAB,0xD711,0x1138,0x0000,0xF555, X 0xAC88,0x888E,0x0003,0xEAAB,0xDE22,0x2227,0xC01F,0xD555, X 0xBC44,0x4447,0xFFFF,0xAAAB,0xF111,0x1111,0x3FD7,0x5555, X 0xE888,0x8888,0x888E,0xAAAB,0xE222,0x2222,0x223D,0x5555, X 0xC444,0x4444,0x447A,0xAAAB,0xD111,0x1111,0x1175,0x5555, X 0x8888,0x8888,0x88EA,0xAAAB,0xA222,0x2222,0x23D5,0x5555, X 0xC444,0x4444,0x47AA,0xAAAB,0x9111,0x1111,0x1755,0x5555, X 0x8888,0x8888,0x8EAA,0xAAAB,0xA222,0x2222,0x3D55,0x5555, X 0xC444,0x4444,0x7AAA,0xAAAB,0x9111,0x1111,0x7555,0x5555, X 0x8888,0x8888,0xEAAA,0xAAAB,0xA222,0x2223,0xD555,0x5555, X 0xC444,0x4447,0xAAAA,0xAAAB,0x9111,0x1117,0x5555,0x5555, X 0x8888,0x888E,0xAAAA,0xAAAB,0xA222,0x223D,0x5555,0x5555, X 0xC444,0x447A,0xAAAA,0xAAAB,0xFFFF,0xFFFF,0xFFFF,0xFFFF //E*O*F batsignal.icon// echo x - gort.icon sed -e 's/^X//' > "gort.icon" << '//E*O*F gort.icon//' X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 X * Description: portrait of gort, from "The Day The Earth Stood Still". X * Background: White. X */ X 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x000F,0xFC00,0x0001, X 0x8000,0x00FF,0xFFE0,0x0001,0x8000,0x03FB,0xF078,0x0001, X 0x8000,0x06FB,0xFE1C,0x0001,0x8000,0x0C21,0xBFE6,0x0001, X 0x8000,0x1820,0x6FF7,0x0001,0x8000,0x3061,0x87E3,0x8001, X 0x8000,0x6060,0x0369,0x8001,0x8000,0x6060,0x00E9,0xC001, X 0x8000,0x6060,0x003C,0xC001,0x8000,0xC060,0x003A,0xE001, X 0x8000,0xC040,0x001B,0x6001,0x8000,0xC040,0x001B,0x6001, X 0x8000,0xC240,0x000D,0x3001,0x8001,0x8CC0,0x0007,0xB001, X 0x8001,0x86C0,0x0007,0xB001,0x8001,0xD8C0,0x000F,0x3001, X 0x8001,0xCDC0,0xFFFF,0xB801,0x8003,0xD7DF,0xFFFF,0xB801, X 0x8007,0xA3FE,0x7FFE,0xFC01,0x8007,0xD7C7,0xFFFF,0x7601, X 0x800B,0xDC7F,0x8002,0xF301,0x800F,0xEFE0,0x000C,0x7101, X 0x800F,0x2F00,0x00D8,0x1901,0x800E,0x2800,0x00F8,0x3B01, X 0x800C,0x7FFF,0xF813,0xFF01,0x8004,0x77FF,0xFFFF,0xFF01, X 0x8004,0xEFFF,0xFE7F,0xFE01,0x8003,0x87FF,0xFF7F,0xFC01, X 0x8001,0xB7FF,0xFFFF,0x9801,0x8001,0x99FF,0xFFFF,0x1801, X 0x8000,0xC6C1,0xFFFE,0x1001,0x8000,0xC360,0x0000,0x3001, X 0x8000,0xD9E0,0x0000,0x3001,0x8000,0x6DE0,0x0008,0x3001, X 0x8000,0x63E0,0x0008,0x2001,0x8000,0x6C60,0x0018,0x6001, X 0x8000,0x6660,0x0018,0x6001,0x8000,0x31B0,0x0018,0x4001, X 0x8000,0x1870,0x0018,0xC001,0x8000,0x0F30,0x0018,0xC001, X 0x8000,0x0CF0,0x0019,0x8001,0x8000,0x0DF8,0x8019,0x8001, X 0x8000,0x06F8,0xC03B,0x0001,0x8000,0x07FC,0xC03B,0x0001, X 0x8000,0x07DC,0xE077,0x0001,0x8000,0x0E1F,0xFFFF,0x8001, X 0x8000,0x0F01,0xFFEC,0xC001,0x8000,0x3F00,0x101B,0xC001, X 0x8000,0x7FC0,0x1FFE,0xE001,0x8003,0xE1E0,0x07FC,0x3801, X 0x800F,0xC000,0x0000,0x1FF1,0x81FF,0x001C,0x006F,0x9FFF, X 0xBFFC,0x0007,0x00C1,0xF1FF,0xFF00,0x0001,0x8000,0x3F03, X 0xE070,0x001C,0x0700,0x07F9,0x9FE0,0x0000,0x01C0,0x00FF, X 0xFE01,0x8000,0x0300,0x000F,0xFE03,0x0000,0x0000,0x0001, X 0xF00F,0x001C,0x0000,0x0001,0x800C,0x0000,0x1C03,0x0301, X 0x8038,0x0700,0x3003,0xC181,0xFFFF,0xFFFF,0xFFFF,0xFFFF //E*O*F gort.icon// echo x - marvin.icon sed -e 's/^X//' > "marvin.icon" << '//E*O*F marvin.icon//' X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 X * Description: portrait of marvin, from the comic strip by Tom Armstrong X * Background: White. X */ X 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFC,0x1FFF,0xFFFF, X 0xFFFF,0xFFF0,0x07FF,0xFFFF,0xFFFF,0xFFF0,0x07FF,0xFFFF, X 0xFFFF,0xFFF0,0x1FFF,0xFFFF,0xFFFF,0xFFE0,0x3FFF,0xFFFF, X 0xFFFF,0x81E0,0x3FFF,0xFFFF,0xFFFE,0x0060,0x7FFF,0xFFFF, X 0xFFFC,0x0030,0x3C07,0xFFFF,0xFFF8,0x0000,0x3000,0x7FFF, X 0xFFF8,0x0000,0x0000,0x1FFF,0xFFFF,0x0000,0x0000,0x0FFF, X 0xFFFF,0x8000,0x0000,0x03FF,0xFF81,0x8000,0x0000,0x01FF, X 0xFF00,0xC000,0x0000,0x01FF,0xFC00,0x0000,0x0000,0x00FF, X 0xF800,0x0000,0x0000,0x00FF,0xF800,0x0000,0x0000,0x00FF, X 0xF840,0x0000,0x0000,0x007F,0xFFF0,0x000F,0xC010,0x003F, X 0xFFF8,0x001F,0xE008,0x003F,0xF818,0x0038,0x700D,0x8C1F, X 0xF000,0x0020,0x3004,0xE78F,0xF000,0x0063,0x1804,0x63EF, X 0xF000,0x0047,0x9804,0x31FF,0xE000,0x0008,0x300D,0x19FF, X 0xE000,0x0000,0xF809,0xD8FF,0xC000,0x0003,0xFC18,0xDCFF, X 0xC380,0x0007,0x9F3E,0x1C7F,0xCF80,0x005C,0x03F3,0x9E7F, X 0xFE00,0x0078,0x01C0,0xFE3F,0xF800,0x0030,0x00C0,0x7E3F, X 0xE000,0x0030,0x0000,0x3F7F,0xC000,0x0030,0x0000,0x1FFF, X 0xC000,0x0030,0x0000,0x1FFF,0x8000,0x0030,0x0000,0x1FFF, X 0x8000,0x1030,0x0000,0x1FFF,0x8000,0x1030,0x0000,0x1FFF, X 0x8000,0x243F,0xFFFF,0xFFFF,0x803C,0x6D31,0xFFFF,0xFFFF, X 0xC03F,0xCDF0,0xE1FE,0x1FFF,0xC633,0xC8F8,0x03F8,0x3FFF, X 0xE433,0x98CC,0x061C,0x3FFF,0xE837,0x1987,0xFC07,0xFFFF, X 0xF87E,0x3183,0xF807,0x8FFF,0xF07C,0x7100,0x3807,0x07FF, X 0xF078,0x6300,0x1806,0x06FF,0xE060,0xC700,0x0C06,0x027F, X 0xE0C1,0xCE00,0x4C0C,0x023F,0xE0C3,0x9E00,0x87FC,0x033F, X 0xF006,0x380B,0x83F0,0x033F,0xF080,0x700F,0x8000,0x033F, X 0xF000,0xE003,0x8000,0x033F,0xF8C0,0x0000,0x8002,0x023F, X 0xF8F0,0x0000,0xC006,0x067F,0xFE78,0x3E00,0x600C,0x0EFF, X 0xFE7F,0xFF80,0x3838,0x0CFF,0xFF67,0xFFE0,0x0FF0,0x3FFF, X 0xFFF7,0xFFF8,0x0000,0x7FFF,0xFFFF,0x6DFF,0x0001,0xFFFF, X 0xFFFF,0x6DFF,0xF01F,0xFFFF,0xFFFE,0xDB7F,0xFFFE,0xB3FF, X 0xFFFE,0xDB7F,0xF7F7,0x7DFF,0xFFFF,0x6DB7,0xF07F,0xFDFF //E*O*F marvin.icon// exit 0 Don Gworek UU: ...{rocksvax|decvax}!sunybcs!gworek CS: gworek@buffalo.edu BI: gworek@sunybcs