argv@island.uu.net (Dan Heller) (04/28/89)
Submitted-by: Benjamin Chen <bchen@esvax.Berkeley.EDU> Posting-number: Volume 3, Issue 89 Archive-name: xwps/part01 AUTHOR: Benjamin Chen Office: 550-A4 Cory Hall, 2-4332 UUCP: !ucbvax!esvax!bchen HEPNET: LBL::"bchen@esvax.Berkeley.EDU" #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # xwps # This archive created: Wed Apr 26 15:36:38 1989 export PATH; PATH=/bin:$PATH if test ! -d 'xwps' then mkdir 'xwps' fi cd 'xwps' if test -f 'xwps.c' then echo shar: will not over-write existing file "'xwps.c'" else cat << \SHAR_EOF > 'xwps.c' /* xwps.c X Window system window raster image dumper. * * This program will dump a raster image of the contents of a window into a * file for output on PostScript printers or for other uses. * * Author: Benjamin Chen * March 2, 1989 * * Copyright (C) 1989 Regents of the University of California * All rights reserved. * * Acknowledgements: * - The data retrieval portion of the program, i.e. * reading the bytes from the window into a buffer was extracted * from xwd.c by Tony Della Fera of DEC. * */ #ifndef lint static char *rcsid_xwps_c = "$Header: xwps.c,v 1.0 89/03/02 10:01:23 bchen Rel$"; #endif #include <X/Xlib.h> #include <sys/types.h> #include <stdio.h> #include <strings.h> #include <math.h> char *calloc(); typedef enum _bool {FALSE, TRUE} Bool; #include "target.cursor" #include "target_mask.cursor" #define FAILURE 0 #define FEEP_VOLUME 0 #define MAXCOLORS 256 #define PS_NO_COLOR 255 #define SCALE(n) ((int)(((float)n/65535)*255)) extern int errno; char *ProgramName = (char *) NULL; char *colorMapFile = (char *) NULL; double scaleX = 5; /* In inches */ double scaleY = 5; /* In inches */ double translateX = 1; /* In inches */ double translateY = 1; /* In inches */ double rotation = 0; /* in degrees counterclockwise */ int colorMap[MAXCOLORS]; Bool nobdrs = TRUE; int SetColor(oldColorName, newColorName) char *oldColorName, *newColorName; { Color olddef, newdef; if (!XParseColor(oldColorName, &olddef)) return -1; if (!XGetHardwareColor(&olddef)) return -1; if (strncmp(newColorName, "NOCOLOR", 7) == 0) { colorMap[olddef.pixel] = PS_NO_COLOR; return 0; } else if (!XParseColor(newColorName, &newdef)) return -1; if (!XGetHardwareColor(&newdef)) return -1; colorMap[olddef.pixel] = luminance(newdef); return 0; } int luminance(colorSpec) Color colorSpec; { int r, g, b, l; r = SCALE(colorSpec.red); g = SCALE(colorSpec.green); b = SCALE(colorSpec.blue); l = (0.30*r) + (0.59*g) + (0.11*b); return l; } void writeInverse(psFile) FILE *psFile; { fprintf(psFile, "/concatprocs\n"); fprintf(psFile, "{ /proc2 exch cvlit def/n"); fprintf(psFile, " /proc1 exch cvlit def/n"); fprintf(psFile, "/newproc proc1 length proc2 length add array def\n"); fprintf(psFile, " newproc 0 proc1 putinterval\n"); fprintf(psFile, " newproc proc1 length proc2 putinterval\n"); fprintf(psFile, " newproc cvx\n"); fprintf(psFile, "} def\n"); } void writeImage(psFile, data, size, width) FILE *psFile; char *data; unsigned size; int width; { int i, pix, current; Color colorDef; /* Output is hexadecimal */ fprintf(psFile, "plotimage\n"); for(i=0; i<size; i++) { current = (int) data[i]; if (colorMap[current] == -1) { colorDef.pixel = current; XQueryColor(&colorDef); pix = luminance(colorDef); colorMap[current] = pix; } else { pix = colorMap[current]; } fprintf(psFile, "%02x", pix); if ((i+1 % width) == 0) { fprintf(psFile, "\n"); } } fprintf(psFile, "\n"); } #define BITS_PER_SAMPLE 8 void openImage(psFile, width, height) FILE *psFile; int width, height; { int llx, lly, urx, ury, lrx, lry, ulx, uly; float ury1, ulx1, lrx1; /* Calculate the bounding box by applying the correct transformations */ lry = 0; urx = lrx = scaleX * 72; ulx = 0; ury = uly = scaleY * 72; ury1 = urx*sin(rotation) + ury*cos(rotation); ulx1 = ulx*cos(rotation) - uly*sin(rotation); lrx1 = lrx*cos(rotation) - lry*sin(rotation); llx = ulx1 + translateX * 72; lly = translateY * 72; urx = lrx1 + (translateX * 72); ury = ury1 + (translateY *72); fprintf(psFile, "%%!\n"); fprintf(psFile, "%%%%BoundingBox: %d %d %d %d\n", llx, lly, urx, ury); fprintf(psFile, "/inch {72 mul} def\n"); fprintf(psFile, "/picstr %d string def\n", width); fprintf(psFile, "/plotimage\n"); fprintf(psFile, " {%d %d %d [%d 0 0 %d 0 %d] \n", width, height, BITS_PER_SAMPLE, width, -height, height); fprintf(psFile," {currentfile picstr readhexstring pop} \n"); fprintf(psFile," image\n } def\n"); fprintf(psFile, "gsave\n"); fprintf(psFile, "%.2f inch %.2f inch translate\n", translateX, translateY); fprintf(psFile, "%.2f inch %.2f inch scale\n", scaleX, scaleY); fprintf(psFile, "%.2f rotate\n", rotation); } void closeImage(psFile) FILE *psFile; { fprintf(psFile, "grestore\n"); fprintf(psFile, "showpage\n"); fflush(psFile); } int GetDefaults() { char *cp; if (cp = XGetDefault(ProgramName, "ScaleX")) scaleX = atof (cp); if (cp = XGetDefault(ProgramName, "ScaleY")) scaleY = atof (cp); if (cp = XGetDefault(ProgramName, "TranslateX")) translateX = atof (cp); if (cp = XGetDefault(ProgramName, "TranslateY")) translateY = atof (cp); if (cp = XGetDefault(ProgramName, "Rotation")) rotation = atof (cp); if (cp = XGetDefault(ProgramName, "ColormapFile")) colorMapFile = cp; if (cp = XGetDefault(ProgramName, "Borders")) { if (strcmp(cp, "off") == 0) { nobdrs = TRUE; } else if (strcmp(cp, "on") == 0) { nobdrs = FALSE; } } } int readColorMapFile(fileName) char *fileName; { FILE *theFile; char oldColorName[40], newColorName[40]; theFile = fopen(fileName, "r"); if (theFile == (FILE *) NULL) { return -1; } while (fscanf(theFile, "%s %s", oldColorName, newColorName) != EOF) { SetColor(oldColorName, newColorName); } fclose(theFile); return 0; } main(argc, argv) int argc; char **argv; { register int i; register char *buffer; unsigned buffer_size; int virt_x, virt_y; int virt_width, virt_height; char *str_index; char *file_name; char *display; char *win_name; char *getenv(); Bool debug = FALSE; Bool standard_out = TRUE; Display *dpy; Window target_win; Window image_win; WindowInfo win_info; Cursor cursor; XButtonEvent rep; FILE *out_file = stdout; /* * Set program name for errors and getting defaults. * ProgramName is simply our 0th argument with any leading path * stripped off. */ ProgramName = rindex (argv[0], '/'); if (ProgramName++ == (char *) NULL) { ProgramName = argv[0]; } /* * Open the display. */ display = getenv("DISPLAY"); if ((dpy = XOpenDisplay(display)) == NULL) { fprintf(stderr, "%s: Can't open display '%s'\n", argv[0], XDisplayName(display)); exit(1); } /* Initialize colormap */ for (i=0; i< 256; i++) { colorMap[i] = -1; } GetDefaults(); if (colorMapFile != (char *) NULL) { if (readColorMapFile(colorMapFile) == -1) { fprintf(stderr, "%s: Can't read colormap file '%s'\n", argv[0], colorMapFile); fprintf(stderr, "Dumping with default colormap.\n"); } } for (i = 1; i < argc; i++) { str_index = (char *)index (argv[i], ':'); if(str_index != (char *)NULL) { XCloseDisplay(dpy); if ((dpy = XOpenDisplay(argv[i])) == NULL) { fprintf(stderr, "%s: Can't open display '%s'\n", argv[0], XDisplayName(display)); exit(1); } continue; } str_index = (char *) index (argv [i], '-'); if (str_index == (char *)NULL) Syntax(argv[0]); if (strncmp(argv[i], "-nobdrs", 7) == 0) { nobdrs = TRUE; continue; } if (strncmp(argv[i], "-debug", 6) == 0) { debug = TRUE; continue; } if (strncmp(argv[i], "-help", 5) == 0) { Syntax(argv[0]); } if (strncmp(argv[i], "-out", 4) == 0) { if (++i >= argc) Syntax(argv[0]); file_name = argv[i]; standard_out = FALSE; continue; } if (strncmp(argv[i], "-rot", 4) == 0) { rotation = atof(argv[++i]); continue; } if (strncmp(argv[i], "-sx", 4) == 0) { scaleX = atof(argv[++i]); continue; } if (strncmp(argv[i], "-sy", 4) == 0) { scaleY = atof(argv[++i]); continue; } if (strncmp(argv[i], "-tx", 4) == 0) { translateX = atof(argv[++i]); continue; } if (strncmp(argv[i], "-ty", 4) == 0) { translateY = atof(argv[++i]); continue; } if (strncmp(argv[i], "-nobdrs", 7) == 0) { nobdrs = TRUE; continue; } Syntax(argv[0]); } if (!standard_out) { /* * Open the output file. */ if((out_file = fopen(file_name, "w")) == NULL) Error("Can't open output file as specified."); } /* * Store the cursor incase we need it. */ if (debug) fprintf(stderr,"xwps: Storing target cursor.\n"); if((cursor = XCreateCursor( target_width, target_height, target_bits, target_mask_bits, 8, 8, BlackPixel, WhitePixel, GXcopy )) == FAILURE) Error("Error occured while trying to store target cursor."); /* * Let the user select the target window. */ if(XGrabMouse(RootWindow, cursor, ButtonPressed) == FAILURE) Error("Can't grab the mouse."); XNextEvent(&rep); XUngrabMouse(); target_win = rep.subwindow; if (target_win == 0) { /* * The user must have indicated the root window. */ if (debug) fprintf(stderr,"xwps: Root window selected as target.\n"); target_win = RootWindow; } else if (debug) fprintf(stderr, "xwps: Window 0x%x selected as target.\n", target_win); /* * Inform the user not to alter the screen. */ XFeep(FEEP_VOLUME); /* * Get the parameters of the window being dumped. */ if (debug) fprintf(stderr,"xwps: Getting target window information.\n"); if(XQueryWindow(target_win, &win_info) == FAILURE) Error("Can't query target window."); if(XFetchName(target_win, &win_name) == FAILURE) Error("Can't fetch target window name."); /* * Calculate the virtual x, y, width and height of the window pane image * (this depends on wether or not the borders are included. */ if (nobdrs) { if (debug) fprintf(stderr,"xwps: Image without borders selected.\n"); image_win = target_win; virt_x = 0; virt_y = 0; virt_width = win_info.width; virt_height = win_info.height; } else { if (debug) fprintf(stderr,"xwps: Image with borders selected.\n"); image_win = RootWindow; virt_x = win_info.x; virt_y = win_info.y; virt_width = win_info.width + (win_info.bdrwidth << 1); virt_height = win_info.height + (win_info.bdrwidth << 1); } /* * Determine the pixmap size. */ buffer_size = BZPixmapSize(virt_width, virt_height); if (debug) { fprintf(stderr, "xwps: Pixmap in byte ZFormat, size %d bytes.\n", buffer_size); } /* * Calloc the buffer. */ if (debug) fprintf(stderr,"xwps: Calloc'ing data buffer.\n"); if((buffer = calloc(buffer_size , 1)) == NULL) Error("Can't calloc data buffer."); /* * Snarf the pixmap out of the frame buffer. * Color windows get snarfed in Z format first to check the color * map allocations before resnarfing if XY format selected. */ if (debug) fprintf(stderr,"xwps: Getting pixmap.\n"); (void) XPixmapGetZ( image_win, virt_x, virt_y, virt_width, virt_height, (caddr_t)buffer ); /* * Inform the user that the image has been retrieved. */ XFeep(FEEP_VOLUME); XFeep(FEEP_VOLUME); XFlush(); /* * Write to postscript! */ openImage(out_file, virt_width, virt_height); writeImage(out_file, buffer, buffer_size, virt_width); closeImage(out_file); /* * Close the output file. */ if (debug) fprintf(stderr,"xwps: Closing output file.\n"); (void) fclose(out_file); /* * Free the pixmap buffer. */ if (debug) fprintf(stderr,"xwps: Freeing pixmap buffer.\n"); free(buffer); /* * Free window name string. */ if (debug) fprintf(stderr,"xwps: Freeing window name string.\n"); free(win_name); exit(0); } /* * Report the syntax for calling xwps. */ Syntax(call) char *call; { fprintf(stderr, "%s: %s [-tx <inches>] [-ty <inches>]\n", ProgramName, call); fprintf(stderr, " [-sx <inches>] [-sy <inches>]\n"); fprintf(stderr, " [-rot <degrees>]\n"); fprintf(stderr, " [-debug] [-help] [-nobdrs]\n"); fprintf(stderr, " [-out <file>] [[host]:vs]\n"); exit(1); } /* * Error - Fatal xwps error. */ Error(string) char *string; /* Error description string. */ { fprintf(stderr, "\n%s: Error => %s",ProgramName, string); if (errno != 0) { perror(ProgramName); fprintf(stderr, "\n"); } exit(1); } /* End of xwps.c */ SHAR_EOF fi # end of overwriting check if test -f 'Makefile' then echo shar: will not over-write existing file "'Makefile'" else cat << \SHAR_EOF > 'Makefile' # Copyright, 1985 Massachusetts Institute of Technology # # xwps - makefile for the Athena X window system window # window raster image dumper. # # Written by: Benjamin Chen # February 22, 1989 DESTDIR = INCLUDES = -I/usr/include/X CURSDIR = . CONFDIR = /usr/new XLIB = /usr/lib/libX.a XH = /usr/include/X/Xlib.h CFLAGS = -O -f68881 $(INCLUDES) -I$(CURSDIR) CLIBS = -lm .SUFFIXES: .o .h .c .a OBJS = xwps.o all: xwps xwps: $(OBJS) $(XLIB) $(CC) $(CFLAGS) -o xwps $(OBJS) $(XLIB) $(CLIBS) xwps.o: \ $(CURSDIR)/target.cursor $(CURSDIR)/target_mask.cursor \ $(XH) link: $(CC) $(CFLAGS) -o xwps $(OBJS) $(XLIB) $(CLIBS) install: all install -s xwps $(DESTDIR)$(CONFDIR) chmod 755 $(DESTDIR)$(CONFDIR)/xwps clean: rm -f *~* *.bak core xwps.o xwps \#* rm -f xwps.c.[0-9]* Makefile.[0-9]* xwps.1.[0-9]* vgrind: vgrind xwps.c SHAR_EOF fi # end of overwriting check if test -f 'xwps.0' then echo shar: will not over-write existing file "'xwps.0'" else cat << \SHAR_EOF > 'xwps.0' XWPS(1) USER COMMANDS XWPS(1) NAME xwps - X Window System, window image dumper. SYNOPSIS xwps [ -debug ] [ -help ] [ -nobdrs ] [ -out _f_i_l_e ] [ -xy ] [ _h_o_s_t:_d_i_s_p_l_a_y ] DESCRIPTION _X_w_p_s is an X Window System (protocol version 10) window image dumping utility. _X_w_p_s allows X users to store window images in a PostScript file. This file can then be printed on a PostScript printer such as the Apple LaserWriter. The target window is selected by clicking the mouse in the desired window. The keyboard bell is rung once at the beginning of the dump and twice when the dump is completed. An optional color map can be specified so users can custom- ize how colors are represented at the output (see COLORMAP). Also, xwps implements the BoundingBox statement in PostScript which defines the rectangle that encloses all of the marks painted as a result of executing the program. These images can then be included in programs such as LaTex for printing. ARGUMENT SUMMARY -help Print out the `Usage:' command syntax summary. -nobdrs This argument specifies that the window dump should not include the pixels that compose the X window border. This is useful in situations where you may wish to include the window contents in a document as an illustration. -out _f_i_l_e This argument allows the user to explicitly specify the output file on the command line. The default is to output to standard out. -tx _i_n_c_h_e_s, -ty _i_n_c_h_e_s These arguments allow the user to move the image to a new position with respect to the page by the the specified amount in inches. The lower left corner of the page is used as the origin. The displacement need not be an integer. The default is +1.0 inches in both directions. -sx _i_n_c_h_e_s, -sy _i_n_c_h_e_s These arguments allow the user to scale the image by the specified amount in inches. The lower left position of the window image is used as the origin for the scaling. The scale amount need not be an integer. The default is 5.0 inches uniform scaling. X Version 10 Last change: 2 March 1989 1 XWPS(1) USER COMMANDS XWPS(1) -rot _d_e_g_r_e_e_s These arguments allow the user to rotate the image by the specified amount in degrees. Rotation occurs about the current origin (possibly changed by trans- lation) in the counter-clockwise direction. The rotation amount need not be an integer. The default is 0 degrees (no rotation). _h_o_s_t:_d_i_s_p_l_a_y This argument allow you to specify the host and display number on which to find the target window. For example `xwps orpheus:1' would specify that the target window is on display `1' on the machine `orpheus'. By default, _x_w_p_s uses the host and display number stored in the environment variable DISPLAY, and therefore this argument is not normally specified. COLOR MAP _X_w_p_s allows you to change how a color will appear as output on the PostScipt printer. This feature is useful on black and white printers if you want to highlight certain features in black or mask out other features such as the background in white. The changes are specified by a file which you set in your .Xdefaults (see ColormapFile). The format of the file is ``oldcolor newcolor'', where _o_l_d_- _c_o_l_o_r and _n_e_w_c_o_l_o_r are the usual X color specifications. A special definition NOCOLOR can be specified as the new color, if no printing of that color is desired. Example SkyBlue black #858589 NOCOLOR X DEFAULTS TranslateX Number of inches to move the origin horizon- tally. Default is +1.0 inches. TranslateY Number of inches to move the origin verti- cally. Default is +1.0 inches. ScaleX Number of inches to scale the image horizon- tally. Default is 5.0 inches. ScaleY Number of inches to scale the image verti- cally. Default is 5.0 inches. Rotation Number of degrees to rotate the image counter-clockwise. Default is no rotation. ColormapFile Where to read the file containing the mapping X Version 10 Last change: 2 March 1989 2 XWPS(1) USER COMMANDS XWPS(1) of Borders If ``on'', then borders are included in the dump. Default is ``on''. ENVIRONMENT DISPLAY To get default host and display number. AUTHOR Copyright 1989 University of California, Berkeley Benjamin Chen, Electronics Research Laboratory X Version 10 Last change: 2 March 1989 3 SHAR_EOF fi # end of overwriting check if test -f 'Xdefaults.sample' then echo shar: will not over-write existing file "'Xdefaults.sample'" else cat << \SHAR_EOF > 'Xdefaults.sample' xwps.ScaleX: 2.0 xwps.ScaleY: 2.0 xwps.TranslateX: 3.0 xwps.TranslateY: 3.0 xwps.Rotation: 90.0 xwps.Borders: off xwps.ColormapFile: xwps.sample SHAR_EOF fi # end of overwriting check if test -f 'xwps.1' then echo shar: will not over-write existing file "'xwps.1'" else cat << \SHAR_EOF > 'xwps.1' .TH XWPS 1 "2 March 1989" "X Version 10" .SH NAME xwps - X Window System, window image dumper. .SH SYNOPSIS .B "xwps" [ -debug ] [ -help ] [ -nobdrs ] [ -out \fIfile\fP ] [ -xy ] [ \fIhost\fP:\fIdisplay\fP ] .SH DESCRIPTION .PP .I Xwps is an X Window System (protocol version 10) window image dumping utility. .I Xwps allows X users to store window images in a PostScript file. This file can then be printed on a PostScript printer such as the Apple LaserWriter. The target window is selected by clicking the mouse in the desired window. The keyboard bell is rung once at the beginning of the dump and twice when the dump is completed. An optional color map can be specified so users can customize how colors are represented at the output (see COLORMAP). Also, xwps implements the BoundingBox statement in PostScript which defines the rectangle that encloses all of the marks painted as a result of executing the program. These images can then be included in programs such as LaTex for printing. .SH ARGUMENT SUMMARY .PP .TP 8 .B "-help" Print out the `Usage:' command syntax summary. .PP .TP 8 .B "-nobdrs" This argument specifies that the window dump should not include the pixels that compose the X window border. This is useful in situations where you may wish to include the window contents in a document as an illustration. .PP .TP 8 .B "-out \fIfile\fP" This argument allows the user to explicitly specify the output file on the command line. The default is to output to standard out. .PP .TP 8 .B "-tx \fIinches\fP, -ty \fIinches\fP" These arguments allow the user to move the image to a new position with respect to the page by the the specified amount in inches. The lower left corner of the page is used as the origin. The displacement need not be an integer. The default is +1.0 inches in both directions. .PP .TP 8 .B "-sx \fIinches\fP, -sy \fIinches\fP" These arguments allow the user to scale the image by the specified amount in inches. The lower left position of the window image is used as the origin for the scaling. The scale amount need not be an integer. The default is 5.0 inches uniform scaling. .PP .TP 8 .B "-rot \fIdegrees\fP" These arguments allow the user to rotate the image by the specified amount in degrees. Rotation occurs about the current origin (possibly changed by translation) in the counter-clockwise direction. The rotation amount need not be an integer. The default is 0 degrees (no rotation). .PP .TP 8 .B "\fIhost\fP:\fIdisplay\fP" This argument allow you to specify the host and display number on which to find the target window. For example `xwps orpheus:1' would specify that the target window is on display `1' on the machine `orpheus'. By default, .I xwps uses the host and display number stored in the environment variable DISPLAY, and therefore this argument is not normally specified. .SH "COLOR MAP" .I Xwps allows you to change how a color will appear as output on the PostScipt printer. This feature is useful on black and white printers if you want to highlight certain features in black or mask out other features such as the background in white. The changes are specified by a file which you set in your .Xdefaults (see ColormapFile). .PP The format of the file is ``oldcolor newcolor'', where .B "\fIoldcolor\fP and \fInewcolor\fP" are the usual X color specifications. A special definition NOCOLOR can be specified as the new color, if no printing of that color is desired. .PP Example .nf SkyBlue black #858589 NOCOLOR .LP .SH "X DEFAULTS" .TP 15 .B TranslateX Number of inches to move the origin horizontally. Default is +1.0 inches. .TP 15 .B TranslateY Number of inches to move the origin vertically. Default is +1.0 inches. .TP 15 .B ScaleX Number of inches to scale the image horizontally. Default is 5.0 inches. .TP 15 .B ScaleY Number of inches to scale the image vertically. Default is 5.0 inches. .TP 15 .B Rotation Number of degrees to rotate the image counter-clockwise. Default is no rotation. .TP 15 .B ColormapFile Where to read the file containing the mapping of 'colors'. .TP .B Borders If ``on'', then borders are included in the dump. Default is ``on''. .SH ENVIRONMENT .PP .TP 8 .B DISPLAY To get default host and display number. .SH AUTHOR .PP Copyright 1989 University of California, Berkeley .PP Benjamin Chen, Electronics Research Laboratory SHAR_EOF fi # end of overwriting check if test -f 'colormap.sample' then echo shar: will not over-write existing file "'colormap.sample'" else cat << \SHAR_EOF > 'colormap.sample' #858589 NOCOLOR yellow black black NOCOLOR SHAR_EOF fi # end of overwriting check if test -f 'target.cursor' then echo shar: will not over-write existing file "'target.cursor'" else cat << \SHAR_EOF > 'target.cursor' #define target_width 16 #define target_height 16 #define target_x_hot 8 #define target_y_hot 8 static short target_bits[] = { 0x0000, 0x0180, 0x0180, 0x07e0, 0x0990, 0x1188, 0x13c8, 0x7e7e, 0x7e7e, 0x13c8, 0x1188, 0x0990, 0x07e0, 0x0180, 0x0180, 0x0000}; SHAR_EOF fi # end of overwriting check if test -f 'target_mask.cursor' then echo shar: will not over-write existing file "'target_mask.cursor'" else cat << \SHAR_EOF > 'target_mask.cursor' #define target_mask_width 16 #define target_mask_height 16 static short target_mask_bits[] = { 0x03c0, 0x03c0, 0x0ff0, 0x1ff8, 0x3ffc, 0x3ffc, 0xffff, 0xffff, 0xffff, 0xffff, 0x3ffc, 0x3ffc, 0x1ff8, 0x0ff0, 0x03c0, 0x03c0}; SHAR_EOF fi # end of overwriting check cd .. # End of shell archive exit 0