Path: news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!news2.uunet.ca!ionews.io.org!r-node.io.org!nobody From: taob@r-node.io.org (Brian Tao) Newsgroups: comp.binaries.apple2 Subject: binpost 1.4 (part 1/1) Followup-To: comp.sys.apple2 Date: 30 Oct 1993 18:08:09 -0400 Organization: Terran Exobiology Research Institute (1-800-GO-ALIEN) Lines: 297 Message-ID: <2auok9$lgu@r-node.io.org> NNTP-Posting-Host: r-node.io.org #!/bin/sh # BINPOST - Automated delivery of multi-part Binscii segments for UNIX # Written by Brian Tao, version date: 93/10/30 18:02 (1.4) # E-mail: or <90taobri@wave.scar.utoronto.ca> # ######################################################################## # # If you are using this version of binpost for the first time, please # take the time to read ALL the comments (lines preceded by a #) in # this file. You may need to change the supplied default values to # let binpost work with your setup. # # To use binpost, you must have execute privileges on your system's # `inews' news posting utility. All servers using Bnews or Cnews # software to deliver Usenet news should have this file. It is # typically located in /usr/local/bin or /usr/lib/news. Ask your # system administrator if you can't locate the file. Set the INEWS # variable below to the correct pathname and append the "-h" switch. # This tells `inews' to take the headers from the file rather than # from the command line. # # Supply the filenames on the command line (e.g., "binpost foobar.*") # and follow the prompts on the screen. Binpost will use your standard # editor (as defined by the EDITOR environment variable) for entering # the description of the uploaded file. Once all the relevant info has # been amassed, binpost will add headers to each segment and use INEWS # to send them on their way. Then you will have the option of deleting # the Binscii files. Posting Binscii files has never been so easy! # # # # # # # # # # # # # # # # # # # # # # # # # # # 1.0/1.1 - First public release. # # 1.2 - Checksum line added just before start of Binscii segment. # - Replaced POSIX "read -p" with "echo -n/read" combination. # - Cleaned up long stretches of "echo >> $TMPFILE" statements. # # 1.2.1 - Added CKSUM variable. # - Added debugging hint and more comments. # - Correction: UNIX 'bsc' does *not* unbinscii! # # 1.3 - Wrote print() function to use proper 'echo' syntax. Should # work identically on both SysV and BSD systems now. # - Removed option to post detailed description. # - Asks user for optional one-line summary to be placed in header. # - Prompts for editor if one not defined in $EDITOR. # - Changed "parts left" message if only one segment. # - Copies $@ to $ARGV for HP-UX compatibility. # # 1.4 - Begins by printing version and number of segments found. # - The print() function will now echo all of its arguments # instead of just the first one. # - Added "Followup-To:" header to all segments. # - Moved all checksum information into the file description. # - Copies $# to $TOTAL (same reason as $@). # - Temporary files now created in home directory. # - Minor cosmetic changes. # ####################################################################### # DEF_GROUP defines the newsgroup to be posted to if none is specified. # Since binpost was written specifically with Binscii segments in mind # (and thus posting to comp.binaries.apple2), there shouldn't be any # need to change this. However, you may want to limit distribution # to a local Apple II binaries newsgroup. DEF_GROUP="comp.binaries.apple2" # Comp.binaries groups are just that -- newsgroups for binary postings # only. Questions and discussion concerning the files should be # redirected in the corresponding comp.sys.* group. Binpost will set # the "Followup-To:" header to redirect responses to the appropriate # newsgroup. If you want responses forwarded directly to you, set # the DEF_REPLY variable to "poster". Other than that, there # shouldn't be any need to change it. DEF_REPLY="comp.sys.apple2" # On BSD systems, the CKSUM variable should be set to "sum". On SysV # systems, "sum -r" will produce compatible results. You can also use # other similar utilities such as "brik" or "cksum", but they are not # as widely available as the standard "sum" command. If you do not # want to generate checksums, set CKSUM to an empty string. CKSUM="sum" # For debugging purposes, define INEWS as a text pager (like "more" # or "less" or "page"). This will send the final formatted message # to the screen rather than posting it to the world. INEWS="/usr/local/bin/inews -h" INEWS="less" ARGV=$@ # Save original command line TOTAL=$# # Save number of segments ECHO=`echo -n Hello` # Use appropriate 'echo' syntax if [ $ECHO = "-n Hello" ] ; then print () { echo "$@\c" } else print () { echo -n "$@" } fi if [ $TOTAL -eq 0 ] ; then echo "$0: Nothing to post." exit 1 else echo "" echo "*** Binpost 1.4 found $TOTAL segment(s) to post..." echo "" fi print "Enter a newsgroup name [press Return for $DEF_GROUP]: " read NEWSGROUP if [ "x.$NEWSGROUP" = "x." ] ; then NEWSGROUP=$DEF_GROUP fi print "Send followup replies to [press Return for $DEF_REPLY]: " read FOLLOWUP if [ "x.$FOLLOWUP" = "x." ] ; then FOLLOWUP=$DEF_REPLY fi print "Subject line: " read SUBJECT if [ "x.$SUBJECT" = "x." ] ; then echo "" echo "No subject entered. Exeunt." exit fi print "Distribution [press Return for 'world']: " read DISTR echo "" echo "You will now be asked to provide some information on this file" print "and to enter a brief description." if [ "x.$EDITOR" = "x." ] ; then echo "" echo "" print "Editor to use [/usr/bin/vi]: " read EDITOR if [ "x.$EDITOR" = "x." ] ; then EDITOR="/usr/bin/vi" fi else print " Press Return to continue..." read YN fi TMPFILE="~/binpost_$$" BLURB="~/bp-blurb_$$" cat << EOF > $BLURB -------------------------------------------- Name: Version: Author: Computer: Requires: -------------------------------------------- EOF $EDITOR $BLURB if [ $? -ne 0 ] ; then echo "" echo "*** Error invoking editor! Please verify that your EDITOR" echo " environment variable is valid and try posting again." rm $BLURB exit 1 fi echo "" echo "You may now enter an optional one-line description to be included" echo "with each segment. Just press Return if you don't want one." print ":" read SUMMARY echo "Newsgroups: $NEWSGROUP" > $TMPFILE echo "Followup-To: $FOLLOWUP" >> $TMPFILE echo "Subject: $SUBJECT (description, part 0/$TOTAL)" >> $TMPFILE echo "Summary: $SUMMARY" >> $TMPFILE echo "Distribution: $DISTR" >> $TMPFILE echo "" >> $TMPFILE cat $BLURB >> $TMPFILE cat << EOF >> $TMPFILE --- Delivered by binpost 1.4, written by Brian Tao --- --- For more information on binpost, e-mail taob@io.org --- EOF if [ "x.$CKSUM" != "x." ] ; then echo "" echo "Calculating checksums for all segments..." echo "'$CKSUM' results for each segment:" >> $TMPFILE COUNT=1 for SEG in $ARGV { echo " Part $COUNT of $TOTAL - `$CKSUM $SEG`" >> $TMPFILE COUNT=`expr $COUNT + 1` } fi print "Posting description... " $INEWS < $TMPFILE if [ $? -ne 0 ] ; then echo "error posting description!" else echo "done!" fi rm $BLURB COUNT=1 for SEG in $ARGV { REMAIN=`expr $TOTAL - $COUNT` echo "Newsgroups: $NEWSGROUP" > $TMPFILE echo "Followup-To: $FOLLOWUP" >> $TMPFILE echo "Subject: $SUBJECT (part $COUNT/$TOTAL)" >> $TMPFILE echo "Summary: $SUMMARY" >> $TMPFILE echo "Distribution: $DISTR" >> $TMPFILE cat << EOF >> $TMPFILE --- Delivered by binpost 1.4, written by Brian Tao --- --- For more information on binpost, e-mail taob@io.org --- EOF if [ $COUNT -eq 1 ] ; then cat << EOF >> $TMPFILE This is a Binscii file. You need a Binscii decoder to turn this file back into its original form (usually a ShrinkIt file). The following software is available: ProDOS 8 -> BINSCII GS/OS -> GScii+ (NDA), sscii/descii (shell EXE's) UNIX -> sciibin If you have any questions about this file format, or you need help decoding it, please post to the comp.sys.apple2 newsgroup, not comp.binaries.apple2! EOF else echo "Please see part 1 of this posting for decoding information." >> $TMPFILE echo "" >> $TMPFILE fi if [ $REMAIN -gt 1 ] ; then echo "This is part $COUNT of $TOTAL. There are $REMAIN more parts to follow." >> $TMPFILE elif [ $REMAIN -eq 1 ] ; then echo "This is part $COUNT of $TOTAL. There is one more part to follow." >> $TMPFILE else if [ $TOTAL -eq 1 ] ; then echo "This is the only Binscii segment in this file." >> $TMPFILE else echo "This is part $COUNT of $TOTAL. All parts have been posted." >> $TMPFILE echo "Make sure you have all the parts before downloading!" >> $TMPFILE fi fi echo "" >> $TMPFILE echo "================================================================" >> $TMPFILE cat $SEG >> $TMPFILE print "Posting part $COUNT of $TOTAL... " $INEWS < $TMPFILE if [ $? -ne 0 ] ; then echo "error posting segment $COUNT!" else echo "done!" fi COUNT=`expr $COUNT + 1` } rm $TMPFILE echo "" print "Remove Binscii files? [y/N] " read YN if [ "x.$YN" = "x.y" ] ; then rm $ARGV echo "Binscii files removed." else echo "Binscii files not removed." fi