Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!yale!cmcl2!dasys1!treed From: treed@dasys1.UUCP (Timothy Reed) Newsgroups: comp.emacs Subject: reponses to gemacs binary editing mode Keywords: emacs gnu gemacs binary patch etc etc Message-ID: <9852@dasys1.UUCP> Date: 1 Jun 89 05:35:06 GMT Organization: Shearson Lehman Hutton Lines: 362 Subject: gemacs binary editing mode? The following are responses from my inquiry regarding editing binary files and executables with emacs. Thanks for all the responses - the yunexus!mike's is the one I've used so far, tho' I plan on examining the hex dumpers soon. Timothy Reed Acme Data Corp. ..!uunet!slcpi!treed From uunet!utai!yunexus!mike Mon May 29 14:54:58 1989 Greetings... Just find-file and write-file will do fine. There's no special mode. You may want to set the variable require-final-newline to nil though. Mike Mike Marques | Usenet: ......!utzoo!yunexus!mike York University (Computing Services) | mike@nexus.yorku.ca -------------------------------------| Bitnet: mike@libra.yorku.ca Only visiting this planet... | Voice: (416) 736-5257 From uunet!ernie.Berkeley.EDU!andy Mon May 29 14:55:38 1989 Subject: No personal expe with this yet... (hex.el) HAve fun, please inform of any improv's you might make. Andrew /* * Andrew kindly mailed me lisp source for hex.el version 1.0. which is * pretty long. I will happily email it to any and all interested parties. * Please send email to ..!uunet!slcpi!treed or treed@shearson.com. * * thanks - tim * */ From uunet!NMSU.Edu!ted Mon May 29 18:48:25 1989 Subject: gemacs binary editing mode? here is an invertible hex dump package. i use these programs for patching when necessary by hex dumping, editing, and then un hex dumping. no guarantees. please send corrections to me at ted@nmsu.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: # hd.c # unhd.c # This archive created: Mon May 29 16:32:09 MDT 1989 if test -f 'hd.c' then echo shar: will not over-write existing file 'hd.c' else sed -e '1,$s/^X//' << 'SHAR_EOF' > hd.c X#include X#include X X/* reasonably good hex dumper */ X X/* Xusage is: Xhd [option-list] [files] Xoption-list is a string with a leading '-' followed by Xzero or more of the following X X a output addresses X h output hex codes X t output sanitized ascii representation (text) X Xa '-' alone is the same as -h Xif no options are given -aht is assumed. X Xfiles is a list of file names to be dumped. if no files are Xspecified, then the standard input is used. a '-' in place of a file Xname specifies the standard input. X Xthe hex codes are surrounded by ( and ) so that unhd can find them. X*/ X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int addresses, hex, text; /* flags for options */ X int bytes; /* number of bytes to show on a line */ X int i; /* handy for loops */ X int width; /* width of useable line */ X FILE *file; X X /* no flags defaults for everything */ X addresses = text = hex = 1; X X if (argc == 1) { X } X /* check for flags */ X else if (argv[1][0] == '-') { X addresses = text = hex = 0; X X /* scan a resonable number of characters */ X for (i=1;i<5 && argv[1][i];i++) { X switch (argv[1][i]) { X X /* turn on address field */ X case 'a': X addresses = 1; X break; X X /* turn on hex dump */ X case 'h': X hex = 1; X break; X X /* turn on ascii dump */ X case 't': X text = 1; X break; X } X } X } X X /* set up the number of bytes to display on each line */ X if (hex) { X bytes = 16; X } X else if (text) { X bytes = 64; X } X else { X fprintf(stderr,"must use either -h or -t"); X exit(1); X } X X /* if no files */ X if (argc == 1 || (argc == 2 && argv[1][0] == '-')) { X copy(addresses,hex,text,bytes,stdin); X } X else { X /* or for all files that are specified */ X for (i=(argv[1][0] == '-')+1;i unhd.c X#include X#include X X/* the hex UN-dumper....takes a stream of hexadecimal numbers and X converts them to bytes....usage is: Xunhd files X Xwhere files is a list of files to be undumped. if files is null, then Xthe standard input is undumped. only things in parentheses are Xconverted. this program is an inverse of hd. X X*/ X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int i; X FILE *file; X X if (argc == 1) undump(stdin); X else { X for (i=1;i