[comp.sys.mac] Correction to joiner script

drc@dbase.UUCP (Dennis Cohen) (02/11/88)

A few weeks ago, someone posted a "joiner" script to combine the various parts
of a multipart BinHex posting.  I decided to give it a try on the Esperanto
stack posting that just went past and discovered a little (?) error.  It looks
for lines that start with three hyphens and does no other checking.  This can
and does happen in the middle of BinHexed files (witness part 10 of the
Esperanto stack), causing great foulups.  I have corrected it to look for lines
that start with three hyphens AND a space.  This cannot happen in the middle
of a BinHex run, since spaces aren't legal there.  The corrected script follows:

#! /bin/csh -f                                            
# usage: joiner file > joined                              
#   or  cat parts | joiner > joined                    
                                                        
if ($#argv == 0) then                                  
        sed -n -e '/^--- /,/^--- /  p' | sed -e '/^--- / d'
else                                                     
        sed -n -e '/^--- /,/^--- /  p' $1 | sed -e '/^--- / d'
endif                                                   


I hope that this will be of help to others.  I normally wouldn't even have
seen it as I have MPW scripts to do this sort of thing, but just decided to let
the Pyramid have a go at it.

Dennis Cohen
Ashton-Tate Glendale Development Center
dBASE Mac Development Team

straka@ihlpf.ATT.COM (Straka) (02/16/88)

In article <300@dbase.UUCP> drc@dbase.UUCP (Dennis Cohen) writes:
>A few weeks ago, someone posted a "joiner" script to combine the various parts
>of a multipart BinHex posting.  I decided to give it a try on the Esperanto
>stack posting that just went past and discovered a little (?) error.  It looks

Is it time to repost bhcomb.c, a combiner script (and macput, macget, xbin) to
the net for some newcomers?  If so, comp.sources.mac might be most
appropriate newsgroup , but I question whether most (especially the newcomers)
subscribe to that seldom-used group?  

Suggestions are welcome.
-- 
Rich Straka     ihnp4!ihlpf!straka

Advice for the day: "MSDOS - just say no."

moriarty@tc.fluke.COM (Jeff Meyer) (02/20/88)

In article <3694@ihlpf.ATT.COM> straka@ihlpf.UUCP (55223-Straka,R.J.) writes:
>Is it time to repost bhcomb.c, a combiner script (and macput, macget, xbin) to
>the net for some newcomers?  If so, comp.sources.mac might be most
>appropriate newsgroup , but I question whether most (especially the newcomers)
>subscribe to that seldom-used group?  

I've just posted HexJoin.c to comp.sources.mac -- it's a program I built
some months ago for combining comp.binaries.mac segmented hex files.  Works
like a charm...

                                "If Jesus came back today, and saw what was
                                 going on in his name, he'd never stop
                                 throwing up."
                                                -- Hannah and Her Sisters

                                        Moriarty, aka Jeff Meyer
INTERNET:     moriarty@tc.fluke.COM
Manual UUCP:  {uw-beaver, sun, allegra, hplsla, lbl-csam}!fluke!moriarty
CREDO:        You gotta be Cruel to be Kind...
<*> DISCLAIMER: Do what you want with me, but leave my employers alone! <*>

liberte@zaphod.ncsa.uiuc.edu (02/23/88)

All the seds I tried (sun and vax) seem to have a bug that prevents the
joiner script from working even with the space in '/^--- /'.  So I rewrote
the script in awk.  But I am looking forward to using hexjoin.c.

dan
liberte@a.cs.uiuc.edu
---

#! /bin/awk -f
BEGIN { inhex = 0 }
/^---/  { if (inhex && (NF > 1)) {
		inhex = 0
		}
		else {
		  inhex = 1
		  }
		getline
		}

	{ if (inhex) print $0 }