home *** CD-ROM | disk | FTP | other *** search
- From: hendrik@cca.vu.nl (Hendrik te Winkel)
- Newsgroups: alt.binaries.pictures.d,alt.sources
- Subject: postlargefile - a shell script for free
- Message-ID: <1991Jul10.133302.1324@cca.vu.nl>
- Date: 10 Jul 91 13:33:02 GMT
-
- Hello netlanders!
- This is a contribution I thought I might share with you.
- It is a shell script developed by myself to (originally) post a large
- file (eg GIF-file) on to the net, with nnpost.
-
- It has undoubtedly some drawbacks, some of them are already listed in the script.
- One is that it is a C-Shell script, but what the heck, if it is usefull.
-
- It is intended to be used with nnpost, since that is the poster I use. I don't
- know if it works with other posters, it must be, I guess, it expects a poster
- program that can have everything it needs on the argument line, so now
- interactivity should be needed.
- What else? It does not set paths, it expects split and uuencode and cp and rm
- to be accessible, not good, but fix it yourself please.
-
- The script works fine here, the call is:
- postlarge giffilename subject newsgroup infofilenaam [destribution]
- Where the infofilename is the name of the file which will be in the first
- part of the posting. The other parts will be the uuencoded splits only.
-
- Last thing I tried was to refrain from the signature file to be sent in the
- postings, I only wanted the file to appear in the last one, but that didn't
- work out fine because nnpost puts things in a queue and I just renamed the
- signature file during the execution of this script, alas.
-
- Well, here it comes, have fun, and let me know if it is any good, please.
-
- Bye, Hendrik
- hendrik@cca.vu.nl
- ------------------------Shell script to follow, no shar or whatever--------
- #!/bin/csh
- # Call: postgif giffilename subject newsgroup infofilenaam [destribution]
- # This shell script is meant to post (large) files to the specified newsgroup(s).
- # It does some controlling and calls a few other programs before the final task:
- # Posting by calling nnpost with the appropriate parameters.
- # No garantuees, beware that there is no path variabel set.
- #
- # Hendrik, July, 10th, 1991.
-
- # It is intended to be used with nnpost, since that is the poster I use. I don't
- # know if it works with other posters, it must be, I guess, it expects a poster
- # program that can have everything it needs on the argument line, so now
- # interactivity should be needed.
- # What else? It does not set paths, it expects split and uuencode and cp and rm
- # to be accessible, not good, but fix it yourself please.
-
- # The script works fine here, the call is:
- # postlarge giffilename subject newsgroup infofilenaam [destribution]
- # Where the infofilename is the name of the file which will be in the first
- # part of the posting. The other parts will be the uuencoded splits only.
-
- # Last thing I tried was to refrain from the signature file to be sent in the
- # postings, I only wanted the file to appear in the last one, but that didn't
- # work out fine because nnpost puts things in a queue and I just renamed the
- # signature file during the execution of this script, alas.
-
- # Set the variabels. Note: Try to keep the variabels in your homedir, since
- # nnpost uses /usr/tmp already.
- # (Which by SunOS is standard linked to /var/tmp, which is on the root device.)
-
- set dumpfile = dump # actual file to be sent
- set uuencodefile = uue.out # output for uuencode
- set sumfile = sum.out # idem for sum
-
- # Argument checking
-
- if ( $#argv < 4 ) then
- echo "Usage: $0 Gif-filename Subject Newsgroup Info-filename [destribution]"
- exit
- endif
-
- if (! -f $1 ) then
- echo "Can't find $1"
- echo "Usage: $0 Gif-filename Subject Newsgroup Info-filename [destribution]"
- exit
- else if (! -f $4 ) then
- echo "Can't find $4"
- echo "Usage: $0 Gif-filename Subject Newsgroup Info-filename [destribution]"
- exit
- else
- if ( $#argv == "5" ) then # Check if other destribution wanted
- set destrib = $5
- else set destrib = world # Nope, use world
- endif
-
- # Now remove old files, if any, and create the files that are going to be sent
- rm -f $uuencodefile xa? $sumfile $dumpfile
-
- echo "Sum of the original file: `sum $1` $1" > $sumfile
- echo "" >> $sumfile
-
- uuencode $1 $1 > $uuencodefile
- split $uuencodefile
- rm $uuencodefile
- endif
-
- # Count the number of files to be sent, mind you, I only take the first 26. (xaa-xaz)
- # This should be enough, larger postings should be 'junked'.
-
- foreach i ( xa? )
- @ j ++
- end
-
- echo Number of files to post: $j
-
- # The real loop, take the individual splitted files, do some housekeeping and sent.
-
- foreach i ( xa? )
- @ k ++
- if ( $k == "1" ) then
- echo "Inserting $4 at beginning."
- cat $4 > $dumpfile
- echo "" >> $dumpfile
- cat $sumfile >> $dumpfile
- echo "" >> $dumpfile
- else
- cp /dev/null $dumpfile
- endif
-
-
- echo "------------BEGIN (part $k/$j) CUT HERE----------">>$dumpfile
- cat $i >> $dumpfile
- echo "--------------END (part $k/$j) CUT HERE----------">>$dumpfile
-
- # Now post it, I really do not know if this will work with other posters,
- # nnpost -p delivers it rightaway, without editting the files, which is
- # exactly as I wanted.
-
- nnpost -d $destrib -s "$2 (part $k/$j)" -k " " -y " " -f $dumpfile -p $3
-
- end
-
- rm xa? $dumpfile
- ------------------------end of shell script------------------------------------
- --
- Hendrik te Winkel hendrik@cca.vu.nl
- I don't want no one crying, or feeling sad,
- or standing in the rain without their hat.
- - Chi Coltrane.
-