[comp.sys.mac] xbin is great, but it could be even better...

herbw@midas.UUCP (04/08/87)

--------

xbin is a marvelous tool.  I have not used BinHex since discovering xbin.
The following are two suggestions for making xbin even better:

1.  When xbin converts a file, it should issue a message reporting the filename
    of the result.  Since it currently does not do this, it is necessary to ls
    the directory to determine the name of the result, so it can be macput.

    Alternatively, there could be a switch so that xbin would perform a macput
    immediately after converting the file.

2.  Currently, when a program is too big to send as a single posting and must
    be split, each recipient must manually edit the file to remove the headers.
    I don't know if it is possible (perhaps an expert could enlighten me), but
    it would be very nice if xbin could detect "--- End of Part n ---" or some
    other character (or sequence of characters) which would normally never
    occur, and suspend the xbin operation until the "---" signifies the next
    piece.

I hope that the person or people who wrote/maintain xbin read these suggestions
and feel suitably inspired to update the program.  I (and probably many other
xbin users) would appreciate it.

                                  --- Herb Weiner (...!tektronix!midas!herbw)

earleh@dartvax.UUCP (04/10/87)

In article <1280@midas.TEK.COM>, herbw@midas.TEK.COM (Herb Weiner) writes:
> 
>     ...there could be a switch so that xbin would perform a macput
>     immediately after converting the file.
> 

Try putting the following in your .cshrc...

alias send 'macput `xbin -l \!* |grep macname|tr -d \: |sed s/macname.//|tr \\40 _;xbin \!*`'
alias list 'xbin -l \!* '

Here's the first line again, broken so it fits into the terminal width for
reading:

alias send 'macput `xbin -l \!* |grep macname|\
	tr -d \: |sed s/macname.//|tr \\40 _;xbin \!*`'

Invocation:  'send file.hqx' 
               xbin the file and macput it right away
             'list file.hqx'
               short summary of what's in it

I don't claim that the first one is the best way to do it, in fact it 
probably is not.  It's just something I whipped up after reading Herb's
posting.  (I did test it, seemed to work.)  These both take advantage
of the -l switch in xbin which causes it to read the header from the
binhex file and print it out.  

Here is a summary of how it works:

I know what the line containing the Mac file name looks like, so I grep
for it, remove "macname: ", and then convert all blanks to underlines.
The result is the name that the xbined files will have on the host.  I
then run xbin, and if everything goes normally, macput gets the correct
file name as argv[1].

straka@ihlpf.UUCP (04/10/87)

In article <1280@midas.TEK.COM>, herbw@midas.TEK.COM (Herb Weiner) writes:

> xbin is a marvelous tool.  I have not used BinHex since discovering xbin.
> The following are two suggestions for making xbin even better:

> 2.  Currently, when a program is too big to send as a single posting and must
>     be split, each recipient must manually edit the file to remove the headers.
>     I don't know if it is possible (perhaps an expert could enlighten me), but
>     it would be very nice if xbin could detect "--- End of Part n ---" or some
>     other character (or sequence of characters) which would normally never
>     occur, and suspend the xbin operation until the "---" signifies the next
>     piece.


I have written a little program which does this.  I call it bhcomb.  It
is written in c under Sys V.  It is pretty simple, and works.  Its
capability of traversing files should be incorporated into xbin, but that's
another matter.  I routinely use bhcomb under a simple shell script to
turn multiple binhexed binaries into one file for xbin.

BTW, bhcomb validates BinHex lines as opposed to looking for "--- End of
..." delimeters.

I was going to post this to the net, but it was ~4K, and I posted it
about a month ago.  I'll repost it if I get enough requests.

-- 
Rich Straka     ihnp4!ihlpf!straka

New word for the day: arithmoquinification.  Use it *every* day.

earleh@dartvax.UUCP (04/11/87)

In article <1280@midas.TEK.COM>, herbw@midas.TEK.COM (Herb Weiner) writes:
>     ...there could be a switch so that xbin would perform a macput
>     immediately after converting the file.
>     ...

If you put the following two lines in your .cshrc, you can use them
to a) determine the base of the filename that the ".info, .etc" files
will have after xbin is used on the binhexed file and b) xbin the
file, send it to your Mac using macput, prompt you for permission
to delete the xbined files afterwards.  Use of these aliases keeps
your disk usage down, since only the binhexed file exists on the
UNIX file system for any appreciable length of time.  This keeps
system managers friendly.

Usage:
     a) macname file.hqx
     b) macdl file.hqx

alias macname 'xbin -l \!*|grep macname|tr \\40 _|sed s/macname._//'
alias macdl 'xbin \!*;macput `macname \!*`;rm -i `macname \!*`.*'

-----------------------------------------------------------------------------
Copyright 1987 by Earle R. Horton, B.Sc.  All Rights Reserved.  This material
may be redistributed only where such redistribution is without charge and
without restrictions on further redistribution.  Incorporation of this
material in a compilation or other collective work constitutes permission
from the intermediary to all recipients to freely redistribute the entire
collection.  All other uses are prohibited.
-----------------------------------------------------------------------------

howard@amdahl.UUCP (04/14/87)

I should have posted this eons ago.  Here at the old Corporation, I have been
grabbing up the various net goodies and been archiving them for our users
out on disk for some time now.  As a rule, I strip off any preamble for a
description file in the directory, get rid of anything that isn't binhex
(that include the blank line after the line saying "convert me with binhex4.0")
and I compress the file; thereby creating say, DiskInfo1.43.Z, in an appropriate
directory.

When users wish to download something, they typically use MacTerminal or
the highly praised Versaterm emulators and execute the following script
which I have called Zacput on the mainframe (yes I mean mainframe).

So here is the script, its real raw, I wrote it ages ago, it worked, I never
bothered to improve it.  I was going to enhance it to recognize pack files
("z" suffix) but never found the need.  If someone wants to make improvements
and ship it back out to everyone, mail it back and I will act as the clearing
house.  I place it in the Public Domain (magnanimous of me, eh).

--------------cut cut cut cut OUCH! #$%&*& damn scissors -----------------------
:
# Shellscript for transmitting a file(s) to a Macintosh via macput.
# File is in compress format (.Z); is unpacked, xbin'ed and macput
# Upon termination of the operation, the Macintosh bell will ring
#	two times.
#
if [ $# = 0 ] ; then
   echo "$0: expected the filename of a compress(1) file as an argument"
   exit 1
fi
owd=`pwd`
mkdir /usr/mac/tmp/$$ || exit 1
for f in $*
    do
    f=`basename $f .Z`
    if [ $f = "-" ] ; then
       echo "$0: does not accept compress(1) files from standard input, continuing"
    elif [ ! -r $f.Z ] ; then
       echo "$0: could not find $f.Z, continuing"
    elif zcat $f | ( cd /usr/mac/tmp/$$ ; xbin -n $f - 2>/dev/null ) ; then
       cd /usr/mac/tmp/$$
       echo "Now sending the binary file: $f"
       mesg n
       /usr/mac/bin/macput $f
       mesg y
    else
       zcat $f > /usr/mac/tmp/$$/$$.text
       cd /usr/mac/tmp/$$
       echo "Now sending the text file: $f"
       mesg n
       /usr/mac/bin/macput -u -n $f /usr/mac/tmp/$$/$$.text
       mesg y
    fi
    cd $owd
    done
    rm -rf /usr/mac/tmp/$$
ascii bel bel
# ------------------------- End Of Script --------------------------------------
-- 
"Plan for the future because that's where you                Howard C. Simonson
    are going to spend the rest of your life." {hplabs,ihnp4,nsc}!amdahl!howard
         - Mark Twain -

[ The disclaimer for this message may be found in my next article ]