Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!eos!shelby!rutgers!rochester!cornell!moore From: moore@svax.cs.cornell.edu (Doug Moore) Newsgroups: comp.sys.mac Subject: Re: Mass de-binhexing Keywords: binhex, mcvert, source code for unix written in C Message-ID: <27670@cornell.UUCP> Date: 10 May 89 04:41:30 GMT References: <8230@phoenix.Princeton.EDU> <1333@tellab5.tellabs.CHI.IL.US> Sender: nobody@cornell.UUCP Reply-To: moore@svax.cs.cornell.edu (Doug Moore) Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 194 In article <1333@tellab5.tellabs.CHI.IL.US> kenk@tellab5.UUCP (Ken Konecki) writes: in praise of mcvert. Thanks Ken. Unfortunately, since I gave you permission to post, all the mail I've sent to you has bounced back to me, which is why I haven't been able to tell you that: Mcvert appeared on sumex-aim about a month ago and I quickly learned that there was a bug affecting Sun 3/60's. I fixed it and have been unable to get the update to you. So I guess I'll get it to you now. It follows this message. You can divide the stuff that follows into four parts, one for each file updated, and run "patch" on each one to update the source files. I agree with those who say that it would be nice if mcvert could decode stuffit archives. When I wrote it two years ago, Packit was hot and I included unpacking capability. Now, I don't have a lot of time for it. Sorry. Others are welcome to improve it as they wish. If anyone says that it would be nice if mcvert could produce .data, .rsrc and .info files compatible with macput and macget, I disagree. It's macput and macget that should be changed. But I'm not going to do that anytime soon either. Doug Moore (moore@cs.cornell.edu) mcvert patches *** Makefile Wed May 10 00:23:59 1989 --- ../Makefile Wed Apr 12 13:50:14 1989 *************** *** 1,7 **** CSOURCES = mcvert.c hqxify.c unpack.c SOURCES = mcvert.c hqxify.c unpack.c mactypes.h Makefile OBJECTS = mcvert.o hqxify.o unpack.o ! BIN = /mu/moore/mac/bin CFLAGS = -O -DBSD mcvert: $(OBJECTS) --- 1,7 ---- CSOURCES = mcvert.c hqxify.c unpack.c SOURCES = mcvert.c hqxify.c unpack.c mactypes.h Makefile OBJECTS = mcvert.o hqxify.o unpack.o ! BIN = . CFLAGS = -O -DBSD mcvert: $(OBJECTS) *************** *** 17,26 **** clean: rm -f mcvert $(OBJECTS) - - debug: - cc -g -DBSD -o dbvert $(CSOURCES) - - profile: - cc -p $(CFLAGS) -o prvert $(CSOURCES) - --- 17,19 ---- *** hqxify.c Wed May 10 00:23:54 1989 --- ../hqxify.c Wed Apr 12 00:39:57 1989 *************** *** 35,41 **** hqx_block = (hqx_buf *) buf_ptr; hqx = (hqx_header *) (hqx_block->name + hqx_block->nlen); hqx_ptr = buf_ptr; ! hqx_end = (byte *) hqx + sizeof(hqx_header); calc_crc = 0; while (hqx_ptr < hqx_end) calc_crc = (((calc_crc&0xff) << 8) | *hqx_ptr++) ^ magic[calc_crc >> 8]; --- 35,41 ---- hqx_block = (hqx_buf *) buf_ptr; hqx = (hqx_header *) (hqx_block->name + hqx_block->nlen); hqx_ptr = buf_ptr; ! hqx_end = (byte *) hqx + sizeof(hqx_header) - 1; calc_crc = 0; while (hqx_ptr < hqx_end) calc_crc = (((calc_crc&0xff) << 8) | *hqx_ptr++) ^ magic[calc_crc >> 8]; *************** *** 113,118 **** --- 113,119 ---- /* Create the .hqx file and write the info to it */ strncpy(hqxfname, info.name, info.nlen); + hqxfname[info.nlen] = '\0'; unixify(hqxfname); fprintf(verbose, "Converting %-30s type = \"%4.4s\", author = \"%4.4s\"\n", *************** *** 120,126 **** calc_crc = 0; hqx_ptr = (byte *) hqx_block; ! hqx_end = hqx_ptr + 1 + hqx_block->nlen + sizeof(hqx_header); while (hqx_ptr < hqx_end) calc_crc = (((calc_crc&0xff) << 8) | *hqx_ptr++) ^ magic[calc_crc >> 8]; calc_crc = ((calc_crc&0xff) << 8) ^ magic[calc_crc >> 8]; --- 121,127 ---- calc_crc = 0; hqx_ptr = (byte *) hqx_block; ! hqx_end = hqx_ptr + hqx_block->nlen + sizeof(hqx_header); while (hqx_ptr < hqx_end) calc_crc = (((calc_crc&0xff) << 8) | *hqx_ptr++) ^ magic[calc_crc >> 8]; calc_crc = ((calc_crc&0xff) << 8) ^ magic[calc_crc >> 8]; *************** *** 277,284 **** line_ptr = line_start; scan_line: fast_line = line_ptr; ! while ((*fast_line++ = tr68[*fast_line]) IS_LEGAL); ! c = *--fast_line; switch (status) { case READING: if (c == SKIP && fast_line == line_end) break; --- 278,285 ---- line_ptr = line_start; scan_line: fast_line = line_ptr; ! while ((*fast_line = tr68[*fast_line]) IS_LEGAL) fast_line++; ! c = *fast_line; switch (status) { case READING: if (c == SKIP && fast_line == line_end) break; *************** *** 548,555 **** calc_crc = bin_to_hqx_fork(hqx_rsrclen); write_hqx_crc(calc_crc); ! ! *buf_ptr++ = !buf_ptr[-1]; /* To end a run and to get the last */ empty_hqxbuf(); /* stray bits, temporarily add a char */ if (save_state != 2) --line_ptr; if (line_ptr == line_end) { --- 549,556 ---- calc_crc = bin_to_hqx_fork(hqx_rsrclen); write_hqx_crc(calc_crc); ! *buf_ptr = !buf_ptr[-1]; /* To end a run and to get the last */ ! buf_ptr++; empty_hqxbuf(); /* stray bits, temporarily add a char */ if (save_state != 2) --line_ptr; if (line_ptr == line_end) { *** mactypes.h Wed May 10 00:23:58 1989 --- ../mactypes.h Tue Apr 11 18:26:49 1989 *************** *** 95,100 **** --- 95,103 ---- byte protect; /* ?Pr??????, don't know what ? bits mean */ byte dlen[4]; /* Data Fork length (bytes) - most sig. */ byte rlen[4]; /* Resource Fork length byte first */ + byte bugblank; /* to fix obscure sun 3/60 problem + that always makes sizeof(hqx_header + even */ } hqx_header; typedef struct { /* hqx file header buffer (includes file name) */ byte nlen; /* Length of filename. */ *** mcvert.c Wed May 10 00:23:50 1989 --- ../mcvert.c Tue Apr 11 18:26:55 1989 *************** *** 1,6 **** ! /* mcvert.c - version 1.0 - March 30, 1989 * Written by Doug Moore - Cornell University - moore@cs.cornell.edu - April '87 * Sun bug fixes, assorted stuff - Jim Sasaki, March '89 * * This program may be freely distributed for non-profit purposes. It may not * be sold, by itself or as part of a collection of software. It may be freely --- 1,9 ---- ! /* mcvert.c - version 1.02 - April 11, 1989 * Written by Doug Moore - Cornell University - moore@cs.cornell.edu - April '87 * Sun bug fixes, assorted stuff - Jim Sasaki, March '89 + * Changed default max_line_size from 2000 to unlimited - Doug Moore, April, '89 + * Sun 3/60 doesn't like odd-sized structs. Bug fixed - Doug Moore, April, '89 + * - aided by Spencer W. Thomas * * This program may be freely distributed for non-profit purposes. It may not * be sold, by itself or as part of a collection of software. It may be freely *************** *** 41,47 **** if ((text_author = getenv("MAC_EDITOR")) == NULL) text_author = "MACA"; if ((ext = getenv("MAC_EXT")) == NULL) ext = ".bin"; if ((dir = getenv("MAC_DLOAD_DIR")) == NULL) dir = "."; ! if ((maxlines_str = getenv("MAC_LINE_LIMIT")) == NULL) maxlines = 2000; else maxlines = atoi(maxlines_str); /* Make command line arguments globally accessible */ --- 44,50 ---- if ((text_author = getenv("MAC_EDITOR")) == NULL) text_author = "MACA"; if ((ext = getenv("MAC_EXT")) == NULL) ext = ".bin"; if ((dir = getenv("MAC_DLOAD_DIR")) == NULL) dir = "."; ! if ((maxlines_str = getenv("MAC_LINE_LIMIT")) == NULL) maxlines = 0; else maxlines = atoi(maxlines_str); /* Make command line arguments globally accessible */