home *** CD-ROM | disk | FTP | other *** search
- /* fv is a binary file editor written by Chris Hooper (cdh@mtu.edu)
- * on 6-2-91 and has gone through many revisions since then.
- * Much inspiration was given by Bill Moore, the first real user!
- * Owner: CHRISTOPHER D HOOPER
- *
- * fv source Copyright (c) 1992 - 1998 Chris Hooper
- *
- * Modification and redistribution is strictly prohibited.
- * Sale of this software above media cost is prohibited.
- *
- * Except for above two restrictions, this software may be used for
- * any purpose, commercial and private.
- *
- * Disclaimer: This product is fit for no use, foreign or domestic.
- * Use implies knowledge you intend to destroy something.
- */
-
-
- #define MAXLEN 512
-
- #define uchar unsigned char
- #define ulong unsigned long
- #define uint unsigned int
-
- #define ESC 27
- #define HEX 0
- #define STRING 1
- #define EDIT_STRLEN 500
-
- extern char out_string[];
- extern uchar *buffer;
- extern ulong *ibuffer;
- extern int buf_size;
- extern int max_buf_size;
- extern int daddr;
- extern int addis;
- extern int chdis;
- extern int wdis;
- extern int force_ronly;
- extern int force_write;
- extern int ronly;
- extern int mode;
- extern int wdismode;
- extern int dirty;
- extern int looping;
- extern int wpline;
- extern int cpline;
- extern int divisor;
- extern int divisor2;
- extern int divmod;
- extern int divmod2;
- extern int view_address;
- extern int global_type;
- extern int global_direction;
- extern int global_num;
- extern int prompting;
- extern int stopping;
- extern int global_special[MAXLEN];
- extern int swapmode;
- extern int swapbytes;
- extern int Swapbytes;
- extern int SWAPBYTES;
- extern int kbuffer_size;
- extern int noscreen;
- extern int filenum;
- extern int filenames;
- extern char *filename[256];
- extern char *hex;
- extern ulong fend;
- extern ulong last_viewed;
- extern ulong file_sz[];
- extern uchar ascii[];
- extern uchar global_search[MAXLEN];
- extern int alignment;
-
- char *strchr();
- int get_key();
- void unget_key();
- void error_exit();
- void status_mode();
- int colon_mode();
- ulong file_end();
-
- #define STATIC static
- #define ALIGN(x) x &= ~(alignment - 1)
- #define ALIGNED(x) ((x) & ~(alignment - 1))
-
- #ifdef ALIGN_VIEW
- #define VALIGN(x) ALIGN(x)
- #else
- #define VALIGN(x) /* */
- #endif
-
- #if defined(sun)
- # if !defined(Solaris1) && !defined(Solaris2)
- # if defined(__svr4__) || defined(__SVR4)
- # define Solaris2
- # else
- # define Solaris1
- # endif
- # endif
- # ifndef SunOS
- # define SunOS
- # endif
- #endif
-
- #if (defined(_OS9000) || defined(_OSK)) && !defined(OS9)
- # define OS9
- #endif
-
- #if defined(__FreeBSD__) && !defined(FreeBSD)
- # define FreeBSD
- #endif
-
- /* dcc defines AMIGA */
- #if (defined(AMIGA) || defined(amiga)) && !defined(Amiga)
- # define Amiga
- #endif
-
- #if defined(linux) && !defined(Linux)
- # define Linux
- #endif
-
- #ifdef LITTLE_ENDIAN
- # undef LITTLE_ENDIAN
- #endif
-
- #if defined(__i486__) || defined(i386) || defined(Win32) || defined(_MPFARM) || defined(_MPF386) || defined(__i386)
- # ifndef LITTLE_ENDIAN
- # define LITTLE_ENDIAN
- # endif
- #else
- # undef LITTLE_ENDIAN
- #endif
-
- #ifdef Linux
- # include <endian.h>
- # if __BYTE_ORDER == __BIG_ENDIAN
- # undef LITTLE_ENDIAN
- # else
- # ifndef LITTLE_ENDIAN
- # define LITTLE_ENDIAN
- # endif
- # endif
- #endif
-