[alt.sources] Uzap: A visual binary file editor for Unix.

rsilvers@hawk.ulowell.edu (Robert Silvers) (03/30/89)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Makefile README edit.c globals.h screen.c search.c uzap.c
#   uzap.l
# Wrapped by rsilvers@hawk on Mon Feb  6 21:24:57 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(275 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile for Uzap.
X
uzap: uzap.o edit.o search.o screen.o
X	cc -O uzap.o edit.o search.o screen.o -lcurses -ltermcap -o uzap
X
uzap.o: uzap.c 
X	cc -c -O uzap.c  
X
edit.o: edit.c
X	cc -c -O edit.c 
X
search.o: search.c
X	cc -c -O search.c
X
screen.o: screen.c
X	cc -c -O screen.c
X
END_OF_FILE
if test 275 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
chmod +x 'Makefile'
# end of 'Makefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1362 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
X/***************************************************************************/
X/*                                                                         */
X/*  Copyright (c) 1989, Robert Silvers - All rights reserved.              */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/***************************************************************************/
X
X
X
X
X   Uzap is a visual binary file editor for Unix systems written by Robert Silvers
at the University of Lowell.  See the included man page for more info.
X
X						rsilvers@hawk.ulowell.edu
X
END_OF_FILE
if test 1362 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
chmod +x 'README'
# end of 'README'
fi
if test -f 'edit.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'edit.c'\"
else
echo shar: Extracting \"'edit.c'\" \(9849 characters\)
sed "s/^X//" >'edit.c' <<'END_OF_FILE'
X#include "globals.h" 
X
X/***************************************************************************/
X/*                                                                         */
X/*                               Uzap!                                     */
X/*                                                                         */
X/*        Copyright (c) 1989  Robert Silvers - pRevious, Inc.              */
X/*                       -All rights reserved-                             */
X/*                                                                         */
X/*                 Developed at the University of Lowell                   */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/*                                                                         */
X/*          Send comments and bugs to: rsilvers@hawk.ulowell.edu           */
X/***************************************************************************/
X/* 01/05/89 7:41am, loaded itself, modified it's name, and saved it.       */
X/***************************************************************************/
X
X
void HexE(){
X
int cintowin, hpos;
int hx, hy;
unsigned char c, key[4], hnum[16];
X
X   if(loaded){
X
X      free(head);
X      head= (LINK)malloc(sizeof(ELEMENT));
X      head->address= 0;
X      head->prev= 0;
X      head->value= 0;
X      head->next= 0;
X
X      Move(15, 24);
X      PRINTB("HEX");
X      PRINTM("HEX editing mode.  ESC twice returns to command mode");
X
X      cintowin= pos - (block * 240);
X      hy= cintowin / 20;  
X      hpos= 2 * (cintowin - (hy * 20));
X      hx= hpos + 1;
X      hpos+= hpos / 8;
X      Move(hy + 3, hpos + 4);
X
X
X      while(1){
X
X	 GetEscSequence(key);
X	 if(key[0]==12){
X	    Refresh();
X            Move(15, 24);
X            PRINTB("HEX");
X            PRINTM("HEX editing mode.  ESC twice returns to command mode");
X         }
X
X	 if(key[0]==27){
X	          if(key[2]=='A'){
X	        if(hy > 0){
X                   hy--; 
X                   pos-= 20;
X                }else{
X		   if(pos > 200){
X		      hy= 11;
X		      pos-=20;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else if(key[2]=='C'){
X                if((hx < 41) && (pos < size)){
X		   hx++;
X		   if((pos < size) && (hx%2)) pos++;
X		   if(hy==11 && hx==41 && (pos < size)){ 
X		      hx= hpos= 1;
X		      hy= 0;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else if(key[2]=='B'){
X		if((pos + 20) < size){
X                   if(hy < 11){
X		      hy++;
X                      pos+= 20;
X                   }else{
X                      if((pos + 20) < size){
X		         hy= 0;
X		         pos+=20;
X		         block= pos / 240;
X		         Normal();
X		         ShowData();
X                      }
X                   }
X	        }
X	    }else if(key[2]=='D'){
X                if(hx > 0){
X		   hx--;
X		   if((pos > 0) && (!(hx%2))) pos--;
X		   if(hy==0 && hx==0 && (pos > 200)){
X		      hx= 40;
X		      hy= 11;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else{
X	       c= GetKey();
X	       goto done;
X            }
X	 }
X
X	 Bold();
X	 if(isxdigit(key[0])){
X	    modified=TRUE;
X	    if(pos < size){
X
X	       c= key[0];
X
X	       head->address= pos;
X	       head->value= image[pos];
X	       head->next= (LINK)malloc(sizeof(ELEMENT));
X	       head->next->prev= head;
X	       head= head->next;
X	       tail= head;
X	       head->next= 0;
X	       head->address= 0;
X
X	       if(islower(c)) c=toupper(c);   /* Uppercase */
X	       putchar(c);
X
X               if(c < 64) c-= 48;
X	       else c-= 55;
X
X	       if(!(hx%2)){                  
X		  image[pos]= (image[pos] >> 4); /* Right half */
X		  image[pos]= (image[pos] << 4);
X                  image[pos]= c | image[pos];
X	       }else{
X		  image[pos]= (image[pos] << 4); /* Left half  */
X		  image[pos]= (image[pos] >> 4);
X                  image[pos]= (c * 16) | image[pos];
X	       }
X
X	       Move(hy + 3, (((hx - 1) / 2)) + 55);
X	       /* Show ascii version */
X	       if(IsPrint(image[pos]))
X	          putchar(image[pos]);
X               else
X		  putchar('-');
X
X	       if(!(hx==40 && hy==11)){
X		  hx++; 
X	          if(hx%2) pos++;
X               }else{
X	          if(!(hx%2)) pos++; /* Two hex chars=1 byte */  
X		  hpos=hx=1;
X		  hy=0;     /* Next Page */
X		  block= pos / 240;
X		  Normal();
X		  ShowData();
X               }
X            }
X         }
X
X         if(hx==0){ /* Left to right wrap */
X	    hx=1;
X	    if(hy > 0){
X	       hy--;
X	       hx=40;
X            }
X         }
X         if(hx==41){ /* Right to left wrap */
X	    hx=1;
X	    hpos= 1;
X	    if(hy < 11){
X	       hy++;
X            }
X         }
X	 Normal();
X         Move(16, 61);
X         printf("%d/%d       ", pos, size);
X
X	 hpos= hx - 1;
X	 hpos+= hpos / 8;
X         Move(hy + 3, hpos + 4);    
X      }
done:
X      Normal();
X      Move(15, 24);
X      printf("HEX");
X      PRINTM("Returning to command mode");
X   }else{
X      PRINTM("No file to edit");
X   }
X}
X
X
void AscE(){
int cintowin, hpos;
int ax, ay;
unsigned char c, key[4], hnum[16];
X
X   if(loaded){
X
X      /* Undo buffer stuff */
X      free(head);
X      head= (LINK)malloc(sizeof(ELEMENT));
X      head->address= 0;
X      head->value= 0;
X      head->prev= 0;
X      head->next= 0;
X
X      Move(15, 63);
X      PRINTB("ASC");
X      PRINTM("ASC editing mode.  ESC twice returns to command mode");
X
X      cintowin= pos - (block * 240);
X      ay= cintowin / 20;  
X      ax= cintowin - (ay * 20); 
X      hpos= cintowin - (ay * 20);
X      Move(ay + 3, ax + 55);
X
X      while(1){
X
X	 GetEscSequence(key);
X	 if(key[0]==12){
X	    Refresh();
X            Move(15, 63);
X            PRINTB("ASC");
X            PRINTM("ASC editing mode.  ESC twice returns to command mode");
X         }
X
X	 if(key[0]==27){
X	          if(key[2]=='A'){
X	        if(ay > 0){
X                   ay--; 
X                   pos-= 20;
X                }else{
X		   if(pos > 200){
X		      ay= 11;
X		      pos-=20;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else if(key[2]=='C'){
X                if((ax <= 19) && (pos < size)){
X		   ax++;
X		   if(pos < size) pos++;
X		   if(ay==11 && ax==20 && (pos < size)){ 
X		      ax= ay= 0;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else if(key[2]=='B'){
X		if((pos + 20) < size){
X                   if(ay < 11){
X		      ay++;
X                      pos+= 20;
X                   }else{
X                      if((pos + 20) < size){
X		         ay= 0;
X		         pos+=20;
X		         block= pos / 240;
X		         Normal();
X		         ShowData();
X                      }
X                   }
X	        }
X	    }else if(key[2]=='D'){
X                if(ax >= 0){
X		   ax--;
X		   if(pos > 0) pos--;
X		   if(ay==0 && ax==-1 && (pos > 200)){
X		      ax= 19;
X		      ay= 11;
X		      block= pos / 240;
X		      Normal();
X		      ShowData();
X                   }
X                }
X	    }else{
X	       c= GetKey();
X	       goto done;
X            }
X	 }
X
X	 Bold();
X	 if((IsPrint(key[0]) || iscntrl(key[0])) && (key[0]!=27 && key[0]!=12)){
X	    modified=TRUE;
X	    if(pos < size){
X
X	       head->address= pos;
X	       head->value= image[pos];
X	       image[pos]= key[0];   /* Put in ascii char */
X	       head->next= (LINK)malloc(sizeof(ELEMENT));
X	       head->next->prev= head;
X	       head= head->next;
X	       tail= head;
X	       head->next= 0;
X
X	       if(IsPrint(key[0]))
X	          putchar(key[0]);
X               else
X		  putchar('-');
X
X	       hpos= (ax + (ax - 1)) + 1;
X	       hpos+= hpos / 8;
X               Move(ay + 3, hpos + 4);                  /* Put in hex char */
X
X	       sprintf(hnum, "%2x", key[0]);            /* Get HEX value   */
X	       if(hnum[0]==' ') hnum[0]='0';
X	       if(islower(hnum[0])) hnum[0]=toupper(hnum[0]); /* Uppercase */
X	       if(islower(hnum[1])) hnum[1]=toupper(hnum[1]);
X	       putchar(hnum[0]);
X	       putchar(hnum[1]);
X
X	       if(!(ax==19 && ay==11)){
X	          pos++; ax++; 
X               }else{
X	          pos++;
X		  ax=ay=0; /* Next Page */
X		  block= pos / 240;
X		  Normal();
X		  ShowData();
X               }
X            }
X         }
X	 Normal();
X         if(ax== -1){ /* Left to right wrap */
X	    ax=0;
X	    if(ay > 0){
X	       ay--;
X	       ax=19;
X            }
X         }
X         if(ax==20){ /* Right to left wrap */
X	    ax=19;
X	    if(ay < 11){
X	       ay++;
X	       ax=0;
X            }
X         }
X         Move(16, 61);
X         printf("%d/%d       ", pos, size);
X	 Move(ay + 3, ax + 55);
X      }
done:
X      Normal();
X      Move(15, 63);
X      printf("ASC");
X      PRINTM("Returning to command mode");
X   }else{
X      PRINTM("No file to edit");
X   }
X} /* AscE */
X
X
void Undo(){
X
X   if(modified){
X      modified= FALSE;
X
X      while(tail->prev!=0){
X	 tail= tail->prev;
X	 image[tail->address]= tail->value;
X      }
X      pos= tail->address;
X      free(head);
X      PRINTM("Undo!");
X      ShowData();
X   }else{
X      PRINTM("Nothing to undo\n");
X   }
X}
X
END_OF_FILE
if test 9849 -ne `wc -c <'edit.c'`; then
    echo shar: \"'edit.c'\" unpacked with wrong size!
fi
chmod +x 'edit.c'
# end of 'edit.c'
fi
if test -f 'globals.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'globals.h'\"
else
echo shar: Extracting \"'globals.h'\" \(2887 characters\)
sed "s/^X//" >'globals.h' <<'END_OF_FILE'
X#include <stdio.h>
X#include <ctype.h>
X#include <curses.h>
X#include <signal.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X
X/***************************************************************************/
X/*                               Uzap!                                     */
X/*        Copyright (c) 1989  Robert Silvers - pRevious, Inc.              */
X/*                       -All rights reserved-                             */
X/*                 Developed at the University of Lowell                   */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/***************************************************************************/
X
X#define VERSION "V1.0"
X#define PRINTB(X) Bold(); printf(X); Normal()
X#define PRINTM(x) CHome(); printf(x); Home()
X#define PRINTG(x) Graphics(); printf(x); Asc()
X
extern int pos;                   /* Position in binary             */
extern int block;                 /* Current block displayed        */
extern int loaded;                /* TRUE if a file is loaded       */
extern int modified;              /* TRUE if file was modified      */
extern int max;                   /* Number of blocks in file       */
extern int size;                  /* Size of file                   */
extern unsigned char string[512]; /* Global search string           */
extern char filename[128];        /* Filename used for I            */
extern char sfilename[128];       /* Actual saved-filename          */
extern char dfilename[128];       /* Default save-filename          */
extern unsigned char *image;      /* The binary image to edit       */
X
typedef struct node ELEMENT;
typedef ELEMENT     *LINK;
extern LINK    head;
extern LINK    tail;
X
extern struct node{               /* Undo buffer                    */
X   int address;
X   unsigned char value;
X   struct node *next;
X   struct node *prev;
X}undobuffer;
X
extern char GetKey();
extern void Cls(), Bold(), Blink(), Inverse(), Underline(), Normal(),
X       Graphics(), Asc(), DrawScreen(), Refresh(), Move(), GetEscSequence(), 
X       Home(), Beep(), abort(), cont(), CHome(); 
X
X
X
X
END_OF_FILE
if test 2887 -ne `wc -c <'globals.h'`; then
    echo shar: \"'globals.h'\" unpacked with wrong size!
fi
chmod +x 'globals.h'
# end of 'globals.h'
fi
if test -f 'screen.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'screen.c'\"
else
echo shar: Extracting \"'screen.c'\" \(9024 characters\)
sed "s/^X//" >'screen.c' <<'END_OF_FILE'
X#include "globals.h" 
X
X/***************************************************************************/
X/*                                                                         */
X/*                                 Uzap!                                   */
X/*                                                                         */
X/*                  Copyright (c) 1989  Robert Silvers                     */
X/*                          -All rights reserved-                          */
X/*                                                                         */
X/*                 Developed at the University of Lowell                   */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/*                                                                         */
X/*          Send comments and bugs to: rsilvers@hawk.ulowell.edu           */
X/***************************************************************************/
X/* 01/05/89 7:41am, loaded itself, modified it's name, and saved it.       */
X/***************************************************************************/
X
X
void DrawScreen(){
X   echo();
X   noraw();
X   printf(" ");
X   Inverse();
X   printf(" Uzap! %s  (c) 1989 Robert Silvers -----------   --", VERSION);
X   printf(" University of Lowell \n");
X   Normal();
X   Graphics();
X   printf(" lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk  ");
X   printf(" lqqqqqqqqqqqqqqqqqqqqqqk\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" x\t\t\t\t\t\tx   x\t\t\t   x\n");
X   printf(" mqqqqqqqqqqqqqqqqqqqqqHEXqqqqqqqqqqqqqqqqqqqqqqj  ");
X   printf(" mqqqqqqqqqASCqqqqqqqqqqj\n\n");
X   Asc();
X   printf("   Filespec: \n\n");
X   printf("   Messages: \n");
X   PRINTG (" lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");
X   PRINTG ("qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk\n");
X   PRINTG(" x "); PRINTB("L"); printf("oad           ");
X   PRINTB (" H"); printf("ex edit         ");
X   PRINTB (" G"); printf("oto sector         ");
X   PRINTB (" >"); printf("Forward  search "); PRINTG("x\n");
X   PRINTG (" x "); PRINTB("S"); printf("ave           ");
X   PRINTB (" A"); printf("sc edit         ");
X   PRINTB (" J"); printf("ump to byte        ");
X   PRINTB (" <"); printf("Backward search "); PRINTG("x\n");
X   PRINTG (" x "); PRINTB("Q"); printf("uit           ");
X   PRINTB (" U"); printf("ndo!            ");
X   PRINTB (" T"); printf("able               ");
X   PRINTB (" C"); printf("ontinue  search "); PRINTG("x\n");
X   PRINTG (" mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq");
X   PRINTG ("qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj");
X   fflush(stdout);
X   ShowData();
X   noecho();
X   raw();
X} /* DrawScreen */
X
X
void Table(){
char c;
X
X   echo();
X   noraw();
X   Cls();
X   printf("  ");
X   Inverse();
X   printf("CHR DEC HX   CHR DEC HX   CHR DEC HX   CHR DEC HX   ");
X   printf("CHR DEC HX   CHR DEC HX"); 
X   Normal();
X   printf("  \n");
X   printf("  nul 000 00 | syn 022 16 |  ,  044 2C |  B  066 42 | ");
X   printf(" X  088 58 |  n  110 6E  \n");
X   printf("  soh 001 01 | etb 023 17 |  -  045 2D |  C  067 43 | ");
X   printf(" Y  089 59 |  o  111 6F  \n");
X   printf("  stx 002 02 | can 024 18 |  .  046 2E |  D  068 44 | ");
X   printf(" Z  090 5A |  p  112 70  \n");
X   printf("  etx 003 03 | em  025 19 |  /  047 2F |  E  069 45 | ");
X   printf(" [  091 5B |  q  113 71  \n");
X   printf("  eot 004 04 | sub 026 1A |  0  048 30 |  F  070 46 | ");
X   printf(" \\  092 5C |  r  114 72  \n");
X   printf("  enq 005 05 | esc 027 1B |  1  049 31 |  G  071 47 | ");
X   printf(" ]  093 5D |  s  115 73  \n");
X   printf("  ack 006 06 | fs  028 1C |  2  050 32 |  H  072 48 | ");
X   printf(" ^  094 5E |  t  116 74  \n");
X   printf("  bel 007 07 | gs  029 1D |  3  051 33 |  I  073 49 | ");
X   printf(" _  095 5F |  u  117 75  \n");
X   printf("  bs  008 08 | rs  030 1E |  4  052 34 |  J  074 4A | ");
X   printf(" `  096 60 |  v  118 76  \n");
X   printf("  ht  009 09 | us  031 1F |  5  053 35 |  K  075 4B | ");
X   printf(" a  097 61 |  w  119 77  \n");
X   printf("  nl  010 0A | sp  032 20 |  6  054 36 |  L  076 4C | ");
X   printf(" b  098 62 |  x  120 78  \n");
X   printf("  vt  011 0B |  !  033 21 |  7  055 37 |  M  077 4D | ");
X   printf(" c  099 63 |  y  121 79  \n");
X   printf("  np  012 0C |  \"  034 22 |  8  056 38 |  N  078 4E | ");
X   printf(" d  100 64 |  z  122 7A  \n");
X   printf("  cr  013 0D |  #  035 23 |  9  057 39 |  O  079 4F | ");
X   printf(" e  101 65 |  {  123 7B  \n");
X   printf("  so  014 0E |  $  036 24 |  :  058 3A |  P  080 50 | ");
X   printf(" f  102 66 |  |  124 7C  \n");
X   printf("  si  015 0F |  %c  037 25 |  ;  059 3B |  Q  081 51 | ", 37);
X   printf(" g  103 67 |  }  125 7D  \n");
X   printf("  dle 016 10 |  &  038 26 |  <  060 3C |  R  082 52 | ");
X   printf(" h  104 68 |  ~  126 7E  \n");
X   printf("  dc1 017 11 |  '  039 27 |  =  061 3D |  S  083 53 | ");
X   printf(" i  105 69 | del 127 7F  \n");
X   printf("  dc2 018 12 |  (  040 28 |  >  062 3E |  T  084 54 | ");
X   printf(" j  106 6A |\n");
X   printf("  dc3 019 13 |  )  041 29 |  ?  063 3F |  U  085 55 | ");
X   printf(" k  107 6B |\n");
X   printf("  dc4 020 14 |  *  042 2A |  @  064 40 |  V  086 56 | ");
X   printf(" l  108 6C |\n");
X   printf("  nak 021 15 |  +  043 2B |  A  065 41 |  W  087 57 | ");
X   printf(" m  109 6D |\n");
X   printf("  Hit space to continue");
X   noecho();
X   raw();
X   while((c= GetKey())!=32);
X   Refresh();
X   PRINTM("Waiting for command");
X}
X
X
int ShowData(){
unsigned char c, hnum[16];
int x, y;
X
X   if(!loaded) return(0);
X
X   Move(16, 31);
X   printf("Sector: %d/%d          ", block + 1, max + 1);
X   Move(16, 53);
X   printf("Offset: %d/%d       ", pos, size);
X
X   for(y= 0; y < 12; y++){                    
X      Move(y + 3, 4);
X      for(x= 0; x < 20; x++){
X	 if(((block * 240) + x + (y * 20)) >= size){
X	    putchar('#');
X	    putchar('#');
X            if(!((x + 1)%4)) putchar(' ');
X         }else{
X            c= image[(block * 240) + x + (y * 20)];
X	    sprintf(hnum, "%2x", c);       /* Get HEX value */
X	    if(hnum[0]==' ') hnum[0]='0';
X	    if(islower(hnum[0])) hnum[0]=toupper(hnum[0]);
X	    if(islower(hnum[1])) hnum[1]=toupper(hnum[1]);
X	    putchar(hnum[0]);
X	    putchar(hnum[1]);
X            if(!((x + 1)%4)) putchar(' ');
X         }/* if */
X      } /* for */
X
X      Move(y + 3, 55);
X      for(x= 0; x < 20; x++){
X	 if(((block * 240) + x + (y * 20)) >= size)
X	    putchar('#');
X         else{
X            c= image[(block * 240) + x + (y * 20)];
X	    if(IsPrint(c)){
X	       if(c=='-'){
X	          Bold();
X	          putchar('-');
X	          Normal();
X               }else
X	          putchar(c);
X            }else{
X	       putchar('-');
X            } /* if */
X         } /* if */
X      } /* for */ 
X   } /* for */
X   Home();
X} /* ShowData */
X
X
X/* isprint() thinks a tab is a printable character.  Not good.  */
int IsPrint(chr)
unsigned char chr;{
X
X   if(((chr > 31 && chr < 127) || (chr > 159 && chr < 255)) && isprint(chr)
X        && chr!=27)
X      return(1);
X   else
X      return(0);
X}
X
X
void Refresh(){
X
X   Cls();
X   DrawScreen();
X   Move(17, 14);
X   printf("%s               ", dfilename);
X   Move(19, 14);
X}
X
X
X/* Various screen control functions */
X
void Move(y, x)
int x, y;{
X
X   printf("\033[%d;%dH", y, x);
X
X}
void Cls(){
X   printf("\033[H\033[2J");
X}
void CHome(){
X   Move(19, 14);
X   printf("                                                                 ");
X   Move(19, 14);
X}
void Home(){
X   Move(19, 14);
X}
void Bold(){
X   printf("\033[1m"); 
X}
void Blink(){
X   printf("\033[5m"); 
X}
X
void Underline(){
X   printf("\033[4m"); 
X}
X
void Inverse(){
X   printf("\033[7m"); 
X}
X
void Normal(){
X   printf("\033[0m"); 
X}
X
void Graphics(){
X   printf("\033(0\0331");    
X}
X
void Asc(){
X   printf("\033(B\0332"); 
X}
X
void Beep(){
X   putchar(7);
X}
void abort(){
X}
void cont(){
X   Refresh();
X}
X
END_OF_FILE
if test 9024 -ne `wc -c <'screen.c'`; then
    echo shar: \"'screen.c'\" unpacked with wrong size!
fi
chmod +x 'screen.c'
# end of 'screen.c'
fi
if test -f 'search.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'search.c'\"
else
echo shar: Extracting \"'search.c'\" \(6452 characters\)
sed "s/^X//" >'search.c' <<'END_OF_FILE'
X#include "globals.h" 
X
X/***************************************************************************/
X/*                                                                         */
X/*                               Uzap!                                     */
X/*                                                                         */
X/*        Copyright (c) 1989  Robert Silvers - pRevious, Inc.              */
X/*                       -All rights reserved-                             */
X/*                                                                         */
X/*                 Developed at the University of Lowell                   */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/*                                                                         */
X/*          Send comments and bugs to: rsilvers@hawk.ulowell.edu           */
X/***************************************************************************/
X/* 01/05/89 7:41am, loaded itself, modified it's name, and saved it.       */
X/***************************************************************************/
X
X
void Begin(){
X   pos= 0;
X   block= 0;
X   PRINTM("At begining of data");
X   ShowData();
X}
X
void End(){
X   pos= 240 * max;
X   block= max;
X   PRINTM("At end of data");
X   ShowData();
X}
X
void Up(){
X   if (block > 0){
X      pos= pos - 240;
X      block--;
X      PRINTM("Moving backward one block");
X      ShowData();
X   }else{
X      PRINTM("Already at begining of data");
X   }
X}
X
void Down(){
X   if (block < max){
X      block++;
X      pos= pos + 240;
X      PRINTM("Moving forward one block");
X      ShowData();
X   }else{
X      PRINTM("Already at end of data");
X   }
X}
X
X
void Goto(){
int sector;
X
X   if(loaded){
X      echo();
X      noraw();
X      PRINTM("Enter sector to goto:");
X      Move(19, 36);
X      scanf("%d", &sector);
X      Move(19, 14);
X      fflush(stdout);
X      sector--;
X      if(sector >= 0 && sector <= max){
X         block= sector;
X         pos= 240 * block;
X         ShowData();
X	 PRINTM("At requested sector");
X      }else{
X         PRINTM("Sector out of range");
X      }
X      sector= getchar(); /* Skip EOL */
X   }else{ 
X      PRINTM("Must load a file first");
X   } /* if */
X   noecho();
X   raw();
X} /* Goto */
X
X
void Jump(){
int byte;
X
X   if(loaded){
X      echo();
X      noraw();
X      PRINTM("Enter byte to jump to:");
X      Move(19, 37);
X      scanf("%d", &byte);
X      Move(19, 14);
X      fflush(stdout);
X      if(byte >= 0 && byte <= size){
X         block= byte / 240;
X         pos= byte;
X         ShowData();
X	 PRINTM("At sector of requested byte");
X      }else{
X         PRINTM("Byte out of range");
X      }
X      byte= getchar(); /* Skip EOL */
X   }else{ 
X      PRINTM("Must load a file first");
X   } /* if */
X   noecho();
X   raw();
X} /* Goto */
X
X
void Search(dir, length)
int dir, length;{
int x, y, count, cintowin, index;
register i;
unsigned char hnum[16];
X
X   Blink();
X   if(dir==1){
X      PRINTM("Searching forward");
X   }else{
X      PRINTM("Searching backward");
X   }
X   Normal();
X   fflush(stdout);
X
X   i= pos;
X   while(1){
X      i+= dir;
X      if(i>=(size + 1) || i<=-1) break;
X      if(!strncmp(image + i, string, length)){
X         PRINTM("String found");
X	 block= (i / 240);
X	 pos= i;
X	 ShowData();
X	 cintowin= pos - (block * 240);
X
X         /* Highlight HEX version of string */
X
X	 y= cintowin / 20;  /* Compute position of string on screen */
X	 x= (cintowin - (y * 20)) + 1; 
X	 count= x - 1;         /* Set count */
X	 x= x + (x - 1);       /* Two chars per digit */
X	 x+= x / 8;            /* Allow for spaces */
X
X	 Bold();            
X	 Move(y + 3, x + 3);
X	 index= 0;
X	 while(index < length && y < 12){          /* Allow for wrap */
X	    sprintf(hnum, "%2x", string[index++]); /* Get HEX value  */
X	    if(hnum[0]==' ') hnum[0]='0';
X	    if(islower(hnum[0])) hnum[0]=toupper(hnum[0]); /* Uppercase */
X	    if(islower(hnum[1])) hnum[1]=toupper(hnum[1]);
X	    putchar(hnum[0]);
X	    putchar(hnum[1]);
X	    count++;
X            if(!(count%4)) putchar(' ');
X            if(!(count%20)) Move(++y + 3, 4); /* Wrap */ 
X         }
X
X         /* Highlight ascii version of string */
X
X	 y= cintowin / 20;  
X	 x= cintowin - (y * 20); 
X	 count= x;
X	 Move(y + 3, x + 55);
X	 index= 0;
X	 while(index < length && y < 12){ /* Allow for wrap */
X	    if(IsPrint(string[index]))
X	       putchar(string[index]);
X            else
X	       putchar(0);
X	    index++;
X	    count++;
X            if(!(count%20)) Move(++y + 3, 55); /* Wrap */ 
X         }
X	 Normal();
X	 Home();
X	 return;
X      }
X   } /* while */
X   Beep();
X   PRINTM("String not found");
X} /* Search */
X
X
X/* Converts hex search string to ascii chars if it starts with a '$', */
X/* else, it leaves it alone.                                          */
X
int DeHexString(hex)
unsigned char *hex;{
X
int x, i, len, ishex=FALSE;
unsigned char hdigit[16], temp[128];
X
X   len= strlen(hex) - 1;
X
X   if(hex[1]=='$'){
X      ishex=TRUE;
X      strcpy(hex, hex + 1);
X      hex[0]= '0';
X      for(x= 0; x < len; x++){ /* Convert to lower */
X         if(isupper(hex[x])) hex[x]= tolower(hex[x]);
X	 if(!(isxdigit(hex[x]))){
X	    return(-1);
X         }
X      }
X      for(x= 0; x < len - 1; x+= 2){
X         strcpy(hdigit, hex + (len - x - 2), 2);
X         hdigit[2]= '\0';
X   
X         if(hdigit[0] < 96) hdigit[0]= hdigit[0] - 48;
X         else hdigit[0]= hdigit[0] - 87;
X         if(hdigit[1] < 96) hdigit[1]= hdigit[1] - 48;
X         else hdigit[1]= hdigit[1] - 87;
X
X         temp[((len - x) / 2) - 1]= (16 * hdigit[0]) + hdigit[1];
X      }
X      temp[len / 2]= '\0';
X      for(i= 0; i <= (len / 2); i++) hex[i]= temp[i]; 
X
X
X   }else{
X      strcpy(hex, hex + 1);
X   }
X   if(ishex) return(1);
X}
X
END_OF_FILE
if test 6452 -ne `wc -c <'search.c'`; then
    echo shar: \"'search.c'\" unpacked with wrong size!
fi
chmod +x 'search.c'
# end of 'search.c'
fi
if test -f 'uzap.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'uzap.c'\"
else
echo shar: Extracting \"'uzap.c'\" \(9912 characters\)
sed "s/^X//" >'uzap.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <ctype.h>
X#include <curses.h>
X#include <signal.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X
X/***************************************************************************/
X/*                                                                         */
X/*                                 Uzap!                                   */
X/*                                                                         */
X/*                 Copyright (c) 1989  Robert Silvers                      */
X/*                        -All rights reserved-                            */
X/*                                                                         */
X/*                 Developed at the University of Lowell                   */
X/*                                                                         */
X/* This software is supplied free of charge.  This software, or any part   */
X/* of it, may  not  be  redistributed or otherwise made available to, or   */
X/* used  by, any  other  person  without the inclusion of this copyright   */
X/* notice.  This software may not be used to make a profit in any way.     */
X/*                                                                         */
X/* This  software  is provided with absolutely no warranty, to the extent  */
X/* permitted  by  applicable  state law.  In no event, unless required by  */
X/* applicable law, will the author(s) of this this software be liable for  */
X/* any damages caused by this software.                                    */
X/*                                                                         */
X/*          Send bugs and comments to: rsilvers@hawk.ulowell.edu           */
X/***************************************************************************/
X/* 01/01/89 Uzap concieved and started.                                    */
X/* 01/05/89 7:41am, loaded itself, modified it's name, and saved it.       */
X/* 01/06/89 7:21am, both edits work, all done but undo.  80 Hours work.    */
X/***************************************************************************/
X
X#define PRINTB(X) Bold(); printf(X); Normal()
X#define PRINTM(x) CHome(); printf(x); Home()
X#define PRINTG(x) Graphics(); printf(x); Asc()
X
int pos;                   /* Position in binary             */
int block;                 /* Current block displayed        */
int loaded;                /* TRUE if a file is loaded       */
int modified;              /* TRUE if file was modified      */
int max;                   /* Number of blocks in file       */
int size;                  /* Size of file                   */
unsigned char string[512]; /* Global search string           */
char filename[128];        /* Filename used for I            */
char sfilename[128];       /* Actual saved-filename          */
char dfilename[128];       /* Default save-filename          */
unsigned char *image;      /* The binary image to edit       */
X
typedef struct node ELEMENT;
typedef ELEMENT    *LINK;
X
LINK head;                 /* First node                     */
LINK tail;                 /* Last node                      */
struct node{               /* Undo buffer                    */
X   int address;
X   unsigned char value;
X   struct node *next;
X   struct node *prev;
X} undobuffer;
X
char GetKey();
void Cls(), Bold(), Blink(), Inverse(), Underline(), Normal(), Graphics(),
X     Asc(), DrawScreen(), Refresh(), Move(), GetEscSequence(), Home(),
X     Beep(), abort(), cont(), CHome(), IsPrint(), Table();
X
X
main(argc, argv)
int argc;
char *argv[];{
X
char c, opt[2];
int direction= 0, index, x, DeHexString(), dehexres, laststrlen;
void Begin(), End(), Up(), Down(), Search(), HexE(), AscE(), Quit(), Undo(), 
X     Goto(), Jump(), Load(), Save();
X
X   umask(022);
X   signal(SIGINT, abort); /* Trap interupts */
X   signal(SIGHUP, abort);
X   signal(SIGTSTP, abort);
X   signal(SIGSTOP, abort);
X   signal(SIGCONT, cont);
X
X   if(argc > 2){
X      fprintf(stderr, "usage: %s [filename]\n", argv[0]);
X      exit(0);
X   }
X
X   fprintf(stderr, "%d[61\"p", 27);  /* Put term in vt100 mode */ 
X   Asc();
X   Normal();
X
X   initscr();
X   loaded= modified= FALSE;
X
X   Cls();
X   DrawScreen();
X
X   if(argc==2){
X      Load(argv[1]);
X   }else{
X      PRINTM("Waiting for command");
X   }
X   raw();
X   noecho();
X
X   while(1){
X      GetEscSequence(opt);
X      if(islower(opt[0])) opt[0]= toupper(opt[0]);
X
X      switch(opt[0]){
X         case 'L':
X	    echo();
X	    noraw();
X            PRINTM("Enter complete path to file");
X            Move(17, 14);
X            printf("                                                         ");
X            Move(17, 14);
X            scanf("%s", filename);
X            c= getchar();
X	    noecho();
X	    raw();
X	    Load(filename);
X	    break;
X	 case 'S':
X	    CHome();
X	    echo();
X	    noraw();
X            printf("Enter save-file, return for %s", dfilename);
X            Move(17, 14);
X            printf("                                                         ");
X            Move(17, 14);
X	    x= 0;
X	    while((sfilename[x++]= getchar())!='\n');
X	    noecho();
X	    raw();
X	    if(sfilename[0]=='\n') 
X	      Save(dfilename);
X            else{
X	      sfilename[x - 1]='\0';
X	      Save(sfilename);
X            }
X            break;
X	 case 'Q':
X	    Quit();
X            break;
X         case 'H':
X	    HexE();
X	    break;
X         case 'A':
X	    AscE();
X	    break;
X         case 'U':
X	    Undo();
X	    break;
X         case 'T':
X	    Table();
X	    break;
X         case 'G':
X	    Goto();
X	    break;
X         case 'J':
X	    Jump();
X	    break;
X         case '>':
X            if(loaded){
X	       direction= 1;
X	       echo();
X	       noraw();
X               PRINTM("Enter string to locate ($num for hex):");
X               Move(19, 53);
X	       index= 1;
X               string[0]= '0';
X	       while((string[index++]=getchar())!='\n'); /* Allows spaces */
X	       string[index - 1]= 0;
X
X	       noecho();
X	       raw();
X	       dehexres= DeHexString(string);
X               if(dehexres==-1){
X		  PRINTM("Not a valid HEX number");
X	       }else if(dehexres==1){
X	          laststrlen= (index - 2) / 2;
X	          Search(direction, laststrlen);
X               }else{
X	          laststrlen= index - 2;
X	          Search(direction, laststrlen);
X               }
X            }else{
X	       PRINTM("Must load a file first");
X            }
X	    break;
X         case '<':
X            if(loaded){
X	       direction= -1;
X	       echo();
X	       noraw();
X               PRINTM("Enter string to locate ($num for hex):");
X               Move(19, 53);
X
X	       index= 1;
X               string[0]= '0';
X	       while((string[index++]=getchar())!='\n');
X	       noecho();
X	       raw();
X	       string[index - 1]= 0;
X
X	       dehexres= DeHexString(string);
X               if(dehexres==-1){
X		  PRINTM("Not a valid HEX number");
X	       }else if(dehexres==1){
X	          laststrlen= (index - 2) / 2;
X	          Search(direction, laststrlen);
X               }else{
X	          laststrlen= index - 2;
X	          Search(direction, laststrlen);
X	       }
X            }else{
X	       PRINTM("Must load a file first");
X            }
X	    break;
X         case 'C':
X	    if(direction==0){
X	       PRINTM("No search to continue");
X	    }else{
X	       Search(direction, laststrlen);
X            }
X	    break;
X         case 12:
X	    Refresh();
X	    PRINTM("Waiting for command");
X	    break;
X         case  3:     /* Control-C */
X            PRINTM("Hit 'Q' to exit");
X	    break;
X         case 27:
X	    if(opt[2]=='D') Begin();
X	    if(opt[2]=='C') End();
X	    if(opt[2]=='A') Up();
X	    if(opt[2]=='B') Down();
X	    break;
X         default:
X            PRINTM("Not a valid command");
X	    break;
X      } /* case */
X   } /* while */
X} /* main */
X
X
void Load(loadfile)
char *loadfile;{
X
register  x;
char c;
XFILE *file, *fopen();
struct stat buf;
X
X   if((file= fopen(loadfile, "r"))==NULL){
X      CHome();
X      Beep();
X      printf("Cannot open file %s", loadfile);
X      Move(17, 14);
X      printf("%s               ", dfilename);
X      Home();
X      return;
X   }
X   Blink();
X   PRINTM("LOADING");
X   Normal();
X   fflush(stdout);
X   stat(loadfile, &buf); 
X   size= buf.st_size;
X   max= size / 240;
X   free(image);
X   image= (unsigned char*)calloc(size, sizeof(unsigned char)); 
X   pos= block= 0; 
X   for(x= 0; x < size; x++) image[x]= getc(file);
X   CHome();
X   printf("Image loaded, filesize= %d bytes           ", size);
X   Move(17, 14);
X   printf("%s               ", loadfile);
X   Home();
X   strcpy(dfilename, loadfile);
X   fclose(file);
X   modified= FALSE;
X   loaded= TRUE;
X   ShowData();
X} /* Load */
X
void Save(savefile)
char *savefile;{
XFILE *file, *fopen();
register x;
X
X   if((file= fopen(savefile, "w"))==NULL){
X      CHome();
X      Beep();
X      printf("Cannot open file %s for writing", savefile);
X      Home();
X      return;
X   }
X   Blink();
X   PRINTM("SAVING");
X   Normal();
X   fflush(stdout);
X   for(x= 0; x < size; x++) fputc(image[x], file);
X   PRINTM("File saved");
X   strcpy(dfilename, savefile);
X   fclose(file);
X   modified= FALSE;
X} /* Save */
X
X
void Quit(){
char answer;
X
X   if(modified){
X      PRINTM("File modified, Ok to exit?");
X      Move(19, 41);
X      answer= GetKey();
X      if(answer=='y'){
X         CHome();
X         PRINTB("Exiting...");
X         Cls();
X         free(image);
X         endwin();
X
X	 echo();
X	 noraw();
X
X         exit(0);
X      }
X      PRINTM("Returning to command mode");
X      return;
X   }
X   CHome();
X   PRINTB("Exiting...");
X   Cls();
X   free(image);
X   endwin();
X   exit(0);
X}
X
X
void GetEscSequence(key)
char key[2];{
X
X   key[0]= key[1]= key[2]= 0; 
X
X   key[0]= getchar();
X   if(key[0]==27){
X      key[1]= getchar();
X      if(key[1]=='[')
X	 key[2]= getchar();
X      else
X	 ungetc(key[1], stdin);
X   }
X   Normal();
X} /* GetEscSequence */
X
X
char GetKey(){ /* Gets a char without waiting for return */
char c;
X
X   c= getchar();
X   Normal(); /* Kill any ESC chars. */
X   return(c);
X} /* GetKey */
X
X
END_OF_FILE
if test 9912 -ne `wc -c <'uzap.c'`; then
    echo shar: \"'uzap.c'\" unpacked with wrong size!
fi
chmod +x 'uzap.c'
# end of 'uzap.c'
fi
if test -f 'uzap.l' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'uzap.l'\"
else
echo shar: Extracting \"'uzap.l'\" \(4351 characters\)
sed "s/^X//" >'uzap.l' <<'END_OF_FILE'
X.\" $Copyright:	$
X.\" Copyright (c) 1989 Robert Silvers, pRevious, Inc. 
X.\" All rights reserved
X.V= $Header: uzap.l 1.0 01/06/89 $
X.TH UZAP LOCAL "\*(V)" "RS"
X.UZAP NAME
uzap \- unix zap, a visual binary file editor.
X.SH SYNOPSIS
X.B uzap 
X[filename]
X.SH DESCRIPTION
X.I Uzap 
is a general purpose interactive binary file editor.  Using this program, you 
can modify text and instructions in an otherwise inaccessible file.  This is a
full screen program that is compatable with VT100 series terminals.  When a
file is loaded, you will see both a hex, and an ascii representation of it.  
Non-printable ascii characters will appear as a '-'.  Actual hyphens will 
appear in bold.  When you load a file, the filesize will appear, and you
will be presented with a menu of commands.  You may now browse through the file
with the cursor keys.  Down-arrow will move you one 240 character page ahead, 
up-arrow will move you back.  Right-arrow will jump you to the end of the file,
left will go to the beginning.  This program was designed to take no time to
learn how to use with minimal loss of function.  Any comments and bug reports
will be appretiated.  If you have ideas for additional features (except
inserting data), please send them to me.  
X.SH COMMANDS
X
X.I Load
will read the binary image, a file could also have been specified as a
command line argument.  You must give the full path name to the file,
X~username/file will not do (yet).
X
X.I Save
will write the file back to disk.  If you just hit return, the original
filename will be used, and the original file will be overwitten.
X
X.I Quit
will exit the program.  If the file was modified, it will ask you to
verify the quit.  On an unmodified file, it will just exit.  This is the
only way to exit, as Control-C has been disabled (the program will enter a
Control-C into the binary if you hit it while in ascii editing mode).
X
X.I Hex edit
will edit the file in the hex window.  In this window, you may only enter
hex digits.  Use the cursor keys to move around.  If you do this to fast, as
with auto-repeat, an escape character or two may appear on the screen.
Control-L will refresh the display.  Hit ESC twice to exit this mode.  
X
X.I Asc edit
for ascii editing mode.  You may type most characters, including control
characters.  Control-L will refresh the screen, so if you want to enter one 
of those, you must put a 0C in the hex window.  Control-S and Control-Q are 
also not enterable in the ascii window.  Backspace will not back you up, it 
will enter a backspace character into the data, use the left-arrow key if you 
make a mistake.  Hit ESC twice to return to command mode.
X
X.I Undo!
will remove any modifications from the last edit session.  It is only a single
level undo, that is, you cannot undo the undo.
X
X.I Goto sector
will prompt you for a sector.  Sectors are 240 characters in size.
X
X.I Jump to byte
allows you to jump to any byte in the file.  It prompts you for an offset.
Unlike sectors which start with 1, the byte offset begins with 0.  If you 
enter an editing mode, your cursor will appear at the specified byte.
X
X.I Table
will draw an ascii/hex chart.  This is helpful for finding the hex number
of an ascii character.  
X
X.I >Forward search: 
Hit the greater-than key to do a forward search.  This search begins at your
current position in the file, not at the beginning.  This is a case-sensitive
search.  It was easier to program that way.  You may have spaces in the string.
Hex searches are also possible.  To find A7C02F, enter $a7c02f.  The case of the
letters is not important.  You must begin with a dollar sign, or else it will
search for the ascii string "a7c02f".  If the string is found, it will be
highlighted.  If you enter an editing mode, your position will be at the
beginning of this string.
X
X.I <Backward search:
This is the same as a forward search, but works from your current byte offset
to the beginning of the file.
X
X.I Continue search
will continue the last search, in the same direction, with the same string.
X.SH BUGS
X.I You
must hit ESC twice to exit the editing mode.  This is because the arrow keys
send ESC chars.  You need to hit it twice so that the program knows that you
want to leave, and not just move.  I hope to find a way around this some time.
X.SH AUTHOR
Robert Silvers, University of Lowell. (rsilvers@hawk.ulowell.edu)
END_OF_FILE
if test 4351 -ne `wc -c <'uzap.l'`; then
    echo shar: \"'uzap.l'\" unpacked with wrong size!
fi
chmod +x 'uzap.l'
# end of 'uzap.l'
fi
echo shar: End of shell archive.
exit 0
Robert Silvers.                               I'm the NRA. 
Box #1003 University of Lowell.                                   
Lowell Ma, 01854                              (508) 452-5000 x2233