Xref: utzoo alt.sex.pictures.d:1882 alt.sources:3192 Path: utzoo!censor!comspec!humvax!becker!ncrcan!attcan!uunet!wuarchive!julius.cs.uiuc.edu!rpi!uupsi!sunic!news.funet.fi!tukki.jyu.fi!jyu.fi!otto From: otto@tukki.jyu.fi (Otto J. Makela) Newsgroups: alt.sex.pictures.d,alt.sources Subject: Re: Wanted: autoposter or poster for split files Message-ID: Date: 7 Jan 91 00:06:56 GMT References: <376@frederic.octel.UUCP> Sender: news@tukki.jyu.fi (News articles) Followup-To: alt.sources.d Organization: Turing Police, Criminal AI section Lines: 549 In-Reply-To: marc@octel.UUCP's message of 5 Jan 91 05:24:28 GMT Nntp-Posting-Host: jyu.fi In article <376@frederic.octel.UUCP> marc@octel.UUCP (Marc Lewert) writes: Do any of you that post regularly have a script or program that will post a set of files that have been split? I've already once posted these, but it's been some time now. Also, I've made quite a few fixes to them. So, here they are. Hope you find them useful. #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 01/06/1991 23:03 UTC by otto@tukki # Source directory /home10/otto/old/x # # existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 297 -rw-r--r-- ReadMe # 2225 -rwxr-xr-x makemail # 1667 -rw-r--r-- makemail.l # 3021 -rwxr-xr-x makepost # 1780 -rw-r--r-- makepost.l # 2925 -rwxr-xr-x uusplit # 1371 -rw-r--r-- uusplit.l # # ============= ReadMe ============== if test -f 'ReadMe' -a X"$1" != X"-c"; then echo 'x - skipping ReadMe (File already exists)' else echo 'x - extracting ReadMe (Text)' sed 's/^X//' << 'SHAR_EOF' > 'ReadMe' && This is a collection of shell scripts for posting and mailing binary files, with man pages. If you make changes or fixes to these programs, please let me know so that I can merge these changes with my own version. X I'm placing these programs into the public domain. X Otto J. M{kel{ SHAR_EOF chmod 0644 ReadMe || echo 'restore of ReadMe failed' Wc_c="`wc -c < 'ReadMe'`" test 297 -eq "$Wc_c" || echo 'ReadMe: original size 297, current size' "$Wc_c" fi # ============= makemail ============== if test -f 'makemail' -a X"$1" != X"-c"; then echo 'x - skipping makemail (File already exists)' else echo 'x - extracting makemail (Text)' sed 's/^X//' << 'SHAR_EOF' > 'makemail' && #!/bin/csh -f # Make a multipart mailing from file name given as argument # Otto J. Makela version 1.1 (07/01/90) # # makepost filename recepient [lines] # Where: # filename is the file to be posted # recepient is who gets the mail # lines is how many-lined postings to create X # Uses: /bin/cat, /bin/rm, mail, uusplit and the selected editor X # --- Configurable stuff --- # These set the temporary posting file names set header="/tmp/$$-header" posting="/tmp/$$-mailing." # This produces about 60k files with uuencoded stuff # (The first file is a bit longer than the rest (text comments and checksums), # the last file may be shorter, actually it might be only one line !) # (fixme: would be a lot neater if all the files would be about equal size) set lines=1000 # What editor should be used to edit the header file, if EDITOR is not set if ( ! $?EDITOR ) set EDITOR="emacs" # --- End configuration section --- X set ourname=$0 set ourname=${ourname:t} X if ( $#argv < 2 ) then X echo "usage: ${ourname} filename recepient [lines]" X exit endif X if ( $#argv >= 3 ) set lines=$3 if ( $#argv >= 4 ) echo "${ourname}: warning - extra arguments ($4...) ignored" X # Verify that the given filename exists in the first place ! if ( ! -f $1 ) then X echo "${ourname}: file $1 does not exist or is not a plain file" X exit endif X # Create header file, then edit it. echo "(Please edit description for file $1 in place of this line)" >! ${header} $EDITOR ${header} X # Then append checksums to header and create posting files uusplit $1 ${header} ${posting} ${lines} X # Calculate how many files we just created set total=`echo ${posting}[a-z][a-z] | wc -w` echo -n "${total} parts:" # Isn't there a nicer way to do this ? if ( $total <= 9 ) set total="0${total}" X set number=1 foreach part (${posting}[a-z][a-z]) X echo -n " $number" X if ( $number <= 9 ) set number="0${number}" X ( if ( $number == "01" ) cat ${header}; echo "$1 part${number}/${total}"; echo "BEGIN--cut here--cut here"; /bin/cat ${part}; echo "END--cut here--cut here"; if ( -f ~/.signature ) then; echo "--"; cat ~/.signature; endif ) | mail -s "$1 (part ${number}/${total})" $2 X X /bin/rm -f ${part} X @ number++ end X /bin/rm -f ${header} echo "" # The End. SHAR_EOF chmod 0755 makemail || echo 'restore of makemail failed' Wc_c="`wc -c < 'makemail'`" test 2225 -eq "$Wc_c" || echo 'makemail: original size 2225, current size' "$Wc_c" fi # ============= makemail.l ============== if test -f 'makemail.l' -a X"$1" != X"-c"; then echo 'x - skipping makemail.l (File already exists)' else echo 'x - extracting makemail.l (Text)' sed 's/^X//' << 'SHAR_EOF' > 'makemail.l' && .\" Revision Level 1.1 .\" Last Delta 07/01/90 .TH MAKEMAIL 1 .SH NAME makemail \- Mail binary file given as argument specified recepient .SH SYNOPSIS .B makemail .IB filename .IB recepient [ .IB lines ] .SH DESCRIPTION This program is used to mail a given binary file to a specified recepient. The given file is uuencoded, split and equipped with a checksum header. Then, the editor specified by the environment variable .B $EDITOR is spawned (or emacs, if .B $EDITOR is not set), for editing a file description for the mailing. After you exit the editor, the split files prepended with the description are mailed to the specified user using .BR mail(1). .SH OPTIONS .TP .IB lines This specifies the lines per mailing created from the split file. The actual number of lines will be slightly larger in the first mail message due to the checksum header information, and less in the last created mailing. The default is 1000 lines, which makes for about 60k mail files. .SH SEE ALSO .BR makepost(1), .BR uusplit(1), .BR mail(1) .SH NOTES The rather strange format of created mail files emulates the one used on .I comp.binaries.ibm.pc X It is possible to mail the same binary to several users by giving their email addresses separated with commas as the second argument. .SH BUGS It is possible that a last part of a multipart mailing is very short, even only of the uuencode `end' line. X It is not possible to send only a part of a binary file. .SH FILES /tmp is used extensively for temporary files. .SH DIAGNOSTICS Error messages for nonexistant files and newsgroups. Warning messages for extra and misformed arguments. .SH AUTHOR Otto J. Makela SHAR_EOF chmod 0644 makemail.l || echo 'restore of makemail.l failed' Wc_c="`wc -c < 'makemail.l'`" test 1667 -eq "$Wc_c" || echo 'makemail.l: original size 1667, current size' "$Wc_c" fi # ============= makepost ============== if test -f 'makepost' -a X"$1" != X"-c"; then echo 'x - skipping makepost (File already exists)' else echo 'x - extracting makepost (Text)' sed 's/^X//' << 'SHAR_EOF' > 'makepost' && #!/bin/csh -f # Make a multipart posting from file name given as argument # Otto J. Makela version 1.2 (07/01/90) # # makepost filename [newsgroup [lines]] # Where: # filename is the file to be posted # newsgroup is where it should be posted [alt.sex.pictures] X # Uses: /bin/cat, /bin/rm, /bin/grep, uusplit and the selected editor X # --- Configurable stuff --- # These set the temporary posting file names set header="/tmp/$$-header" posting="/tmp/$$-posting." # This produces about 60k files with uuencoded stuff # (The first file is a bit longer than the rest (text comments and checksums), # the last file may be shorter, actually it might be only one line !) # (fixme: would be a lot neater if all the files would be about equal size) set lines=1000 # What editor should be used to edit the header file, if EDITOR is not set if ( ! $?EDITOR ) set EDITOR="emacs" # Default newsgroup (can't be multiple groups) to go to, if none specified set newsgroup="alt.sex.pictures" # Where we search for existing newsgroup names # (This is unfortunately [BC]news & local configuration dependent) set activegroups="~news/lib/active" # --- End configuration section --- X set ourname=$0 set ourname=${ourname:t} X if ( ! $#argv ) then X echo "usage: ${ourname} filename [newsgroup [lines]]" X exit endif X if ( $#argv >= 2 ) set newsgroup=$2 if ( $#argv >= 3 ) set lines=$3 if ( $#argv >= 4 ) echo "${ourname}: warning - extra arguments ($4...) ignored" X # Verify that the given filename exists in the first place ! if ( ! -f $1 ) then X echo "${ourname}: file $1 does not exist or is not a plain file" X exit endif X # Verify that the specified newsgroup exists on this system /bin/grep -s "^${newsgroup} " ${activegroups} if ( $status ) then X echo "${ourname}: newsgroup ${newsgroup} not found" X exit endif X # Direct followups to appropriate .d (discussion) group, if it exists set followup=${newsgroup}.d /bin/grep -s "^${followup} " ${activegroups} if ( $status ) set followup=${newsgroup} X # Create header file, then edit it. echo "(Please edit description for file $1 in place of this line)" >! ${header} $EDITOR ${header} X # Then append checksums to header and create posting files uusplit $1 ${header} ${posting} ${lines} X # Calculate how many files we just created set total=`echo ${posting}[a-z][a-z] | wc -w` echo -n "${total} parts:" # Isn't there a nicer way to do this ? if ( $total <= 9 ) set total="0${total}" X set number=1 foreach part (${posting}[a-z][a-z]) X echo -n " $number" X if ( $number <= 9 ) set number="0${number}" X @ lines = `cat $part | wc -l` + 2 X if ( $number == "01" ) @ lines += `cat $header | wc -l` X (echo "Newsgroups: ${newsgroup}"; echo "Subject: $1 (part ${number}/${total})"; echo "Followup-to: ${followup}"; echo "Lines: ${lines}"; echo ""; if ( $number == "01" ) cat ${header}; echo "$1 part${number}/${total}"; echo "BEGIN--cut here--cut here"; /bin/cat ${part}; echo "END--cut here--cut here") | inews -h X /bin/rm -f ${part} X @ number++ end X /bin/rm -f ${header} echo "" # The End. SHAR_EOF chmod 0755 makepost || echo 'restore of makepost failed' Wc_c="`wc -c < 'makepost'`" test 3021 -eq "$Wc_c" || echo 'makepost: original size 3021, current size' "$Wc_c" fi # ============= makepost.l ============== if test -f 'makepost.l' -a X"$1" != X"-c"; then echo 'x - skipping makepost.l (File already exists)' else echo 'x - extracting makepost.l (Text)' sed 's/^X//' << 'SHAR_EOF' > 'makepost.l' && .\" Revision Level 1.2 .\" Last Delta 07/01/90 .TH MAKEPOST 1 .SH NAME makepost \- Post binary file given as argument to a newsgroup .SH SYNOPSIS .B makepost .IB filename [ .IB newsgroup [ .IB lines ] ] .SH DESCRIPTION This program is used to post a given binary file to a newsgroup. The given file is uuencoded, split and equipped with a checksum header. Then, the editor specified by the environment variable .B $EDITOR is spawned (or emacs, if .B $EDITOR is not set), for editing a file description for the posting. After you exit the editor, the split files prepended with the description are posted to the appropriate newsgroup using .BR inews(1). .SH OPTIONS .TP .IB newsgroup This option specifies the newsgroup for the posting. If none is specified, .I alt.sex.pictures is assumed. .TP .IB lines This specifies the lines per posting created from the split file. The actual number of lines will be slightly larger in the first posting due to the checksum header information, and less in the last created posting. The default is 1000 lines, which makes for about 60k postings. .SH SEE ALSO .BR makemail(1), .BR uusplit(1), .BR inews(1) .SH NOTES The rather strange format of created postings emulates the one used on .I comp.binaries.ibm.pc X A \*(lqFollowup-to:\*(rq header is generated for the appropriate discussion group, if it exists. Thus, the default is for a \*(lqFollowup-to: alt.sex.pictures.d\*(rq header to be inserted. .SH BUGS It is possible that a last part of a multipart posting is very short, even only of the uuencode `end' line. .SH FILES /tmp is used extensively for temporary files. .SH DIAGNOSTICS Error messages for nonexistant files and newsgroups. Warning messages for extra and misformed arguments. .SH AUTHOR Otto J. Makela SHAR_EOF chmod 0644 makepost.l || echo 'restore of makepost.l failed' Wc_c="`wc -c < 'makepost.l'`" test 1780 -eq "$Wc_c" || echo 'makepost.l: original size 1780, current size' "$Wc_c" fi # ============= uusplit ============== if test -f 'uusplit' -a X"$1" != X"-c"; then echo 'x - skipping uusplit (File already exists)' else echo 'x - extracting uusplit (Text)' sed 's/^X//' << 'SHAR_EOF' > 'uusplit' && #!/bin/csh -f # Split a large file into summary header and several uuencoded portions # Otto J. Makela version 1.4 (07/01/91) # # uusplit filename [headername [partname [lines]]] # Where: # filename is the file to be uuencoded and split # headername is the name of the summary header [filename.header] # partname is the name of the split files [filename.uue.XX] # linecount is the number of lines per file [1000] X # Uses: /bin/rm, /bin/sum, /bin/chmod, /bin/split and uuencode (the last # without /bin, since the location varies) and optionally brik (location # varies also) X # --- Configurable stuff --- # These set the default header and part file names (set from $1 !) set header="$1.header" parts="$1.uue." # This default produces about 60k files with uuencoded stuff set lines=1000 # The following line should be '/bin/sum -r' if this is a SysV environment set sum="/bin/sum" # Brik CRC for whole file wanted ? set dobrik=1 # --- End configuration section --- X set ourname=$0 set ourname=${ourname:t} X if ( ! $#argv ) then X echo "usage: ${ourname} filename [headername [partname [lines]]]" X exit endif X if ( $#argv >= 2 ) set header=$2 if ( $#argv >= 3 ) set parts=$3 if ( $#argv >= 4 ) set lines=$4 if ( $#argv >= 5 ) echo "${ourname}: warning - extra arguments ($5...) ignored" X # Verify arguments if ( ! -f $1 ) then X echo "${ourname}: file $1 does not exist or is not a plain file" X exit endif X @ lines += 0 if ( $status ) then X echo "${ourname}: nonnumeric lines value $lines (1000 assumed)" X set lines=1000 endif X # Chmod the file and remove possibly existing split fragments /bin/chmod 644 $1 /bin/rm -f ${parts}[a-z][a-z] X # First uuencode the file, and split it # (add blank line after uuencoded stuff 'cause some uudecoders have problems # decoding unless there is a blank line following the "end" line) ( uuencode $1 $1; echo "" ) | /bin/split -${lines} - ${parts} X # Calculate how many files we just created set total=`echo ${parts}[a-z][a-z] | wc -w` # Isn't there a nicer way to do this ? if ( $total <= 9 ) set total="0${total}" X # The header file is either created or appended ! echo "[" >>! ${header} echo 'Checksums obtained with the 4.3BSD "sum" or System V "sum -r" command.' >> ${header} echo "" >> ${header} echo "Part checksums (from uuencoded stuff between BEGIN and END lines)" >> ${header} X # Then take each part and calculate the header information for it set number=1 foreach part (${parts}[a-z][a-z]) X if ( $number <= 9 ) set number="0${number}" X echo -n "part${number} " >> ${header} X ${sum} ${part} >> ${header} X @ number++ end X # Then calculate original file information echo "" >> ${header} echo "Original file checksum" >> ${header} echo -n "$1 " >> ${header} ${sum} $1 >> ${header} X # If required, add a Brik (binary) CRC for splitted file if ( $?dobrik ) then X echo "" >> ${header} X brik -Gb $1 >> ${header} endif X echo "]" >> ${header} echo "" >> ${header} X # The End. SHAR_EOF chmod 0755 uusplit || echo 'restore of uusplit failed' Wc_c="`wc -c < 'uusplit'`" test 2925 -eq "$Wc_c" || echo 'uusplit: original size 2925, current size' "$Wc_c" fi # ============= uusplit.l ============== if test -f 'uusplit.l' -a X"$1" != X"-c"; then echo 'x - skipping uusplit.l (File already exists)' else echo 'x - extracting uusplit.l (Text)' sed 's/^X//' << 'SHAR_EOF' > 'uusplit.l' && .\" Revision Level 1.4 .\" Last Delta 07/01/90 .TH UUSPLIT 1 .SH NAME uusplit \- Split binary file given as argument to multiple uuencoded files .SH SYNOPSIS .B uusplit .IB filename [ .IB headername [ .IB partname [ .IB lines ] ] ] .SH DESCRIPTION This program is used to split a given binary file to a series of uuencoded files plus a checksum header. The checksum header contains output of .BR sum(1) for all the created uuencoded files and the original file, plus optionally a .BR brik(1) checksum. .SH OPTIONS .TP .IB headername Name of the file where the checksum header is generated. The default is .IB filename \|.header .TP .IB partname Head name for the generated part files. The default is .IB filename \|.uue. which forms filenames like .IB filename \|.uue.aa \|, .IB filename \|.uue.ab \|, .IB filename \|.uue.ac \|, etc. .TP .IB lines This specifies the lines per split file created. The default is 1000 lines, which makes for about 60k files. .SH SEE ALSO .BR makepost(1), .BR makemail(1), .BR sum(1), .BR brik(1), .BR split(1) .SH BUGS It is possible that a last part of a file is very short, even just the uuencode `end' line. X Assumes near-infinite filename length in true BSD fashion. Pox on SysV. .SH DIAGNOSTICS Error messages for nonexistant files. Warning messages for extra and misformed arguments. .SH AUTHOR Otto J. Makela SHAR_EOF chmod 0644 uusplit.l || echo 'restore of uusplit.l failed' Wc_c="`wc -c < 'uusplit.l'`" test 1371 -eq "$Wc_c" || echo 'uusplit.l: original size 1371, current size' "$Wc_c" fi exit 0 -- /* * * Otto J. Makela * * * * * * * * * * * * * * * * * * */ /* Phone: +358 41 613 847, BBS: +358 41 211 562 (CCITT, Bell 24/12/300) */ /* Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE */ /* * * Computers Rule 01001111 01001011 * * * * * * * * * * * * * * * * */