home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / mailspli.zoo / mailsplit
Encoding:
Text File  |  1990-04-03  |  62.7 KB  |  2,086 lines

  1.  
  2. #! /bin/sh
  3. # This is a shell archive.  Remove anything before this line, then unpack
  4. # it by saving it into a file and typing "sh file".  To overwrite existing
  5. # files, type "sh file -c".  You can also feed this as standard input via
  6. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  7. # will see the following message at the end:
  8. #        "End of shell archive."
  9. # Contents:  Configure README README2.7 TODO joinr.SH mailsplit.SH
  10. #   undoc joinr.1 mailsplit.1
  11. # Wrapped by wyle@lavi on Wed Mar 28 10:14:08 1990
  12. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  13. if test -f 'Configure' -a "${1}" != "-c" ; then 
  14.   echo shar: Will not clobber existing file \"'Configure'\"
  15. else
  16. echo shar: Extracting \"'Configure'\" \(15368 characters\)
  17. sed "s/^X//" >'Configure' <<'END_OF_FILE'
  18. X#! /bin/sh
  19. X#
  20. X# Configure shell script for mailsplit
  21. X#
  22. X# @(#)Configure    2.6    88/08/20       M F Wyle
  23. X#
  24. X# "Yes, you may rip this off to use in other distribution packages."
  25. X#      -Larry Wall-
  26. X#
  27. X# Thanks Larry I did!  -Mitch
  28. X#
  29. X# If your sh doesn't like these # comments, nuke them.  You must
  30. X# also get rid of the # comments in mailsplit and joinr.
  31. X#
  32. X# $Id: Configure,v 1.5 90/02/07 12:05:00 yamanaka Rel $
  33. X#
  34. Xpackage=mailsplit
  35. X
  36. X: sanity checks
  37. XPATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:/usr/ucb/bin:/usr/old'
  38. Xexport PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed
  39. Xmyself to sh."; sh $0; kill $$)
  40. X
  41. Xif test ! -t 0; then
  42. X    echo "Say 'sh Configure', not 'sh <Configure'"
  43. X    exit 1
  44. Xfi
  45. X
  46. X(alias) >/dev/null 2>&1 && \
  47. X    echo "(I see you are using the Korn shell.  Some ksh's blow up on
  48. XConfigure," && \
  49. X    echo "especially on exotic machines.  If yours does, try the Bourne shell
  50. Xinstead.)"
  51. X
  52. Xecho "creating a work directory named UU"
  53. Xif test ! -d UU; then
  54. X  mkdir UU
  55. Xfi
  56. Xcd UU
  57. X
  58. X: We must find out about Eunice early
  59. Xeunicefix=':'
  60. Xif test -f /etc/unixtovms; then
  61. X    eunicefix=/etc/unixtovms
  62. Xfi
  63. Xif test -f /etc/unixtovms.exe; then
  64. X    eunicefix=/etc/unixtovms.exe
  65. Xfi
  66. X
  67. X: some greps do not return status, grrr.
  68. Xecho "grimblepritz" >grimble
  69. Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
  70. X    contains=contains
  71. Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
  72. X    contains=grep
  73. Xelse
  74. X    contains=contains
  75. Xfi
  76. Xrm -f grimble
  77. X: the following should work in any shell
  78. Xcase "$contains" in
  79. Xcontains*)
  80. X    echo " "
  81. X    echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  82. X    cat >contains <<'EOSS'
  83. Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  84. XEOSS
  85. Xchmod +x contains
  86. Xesac
  87. X
  88. X: first determine how to suppress newline on echo command
  89. Xecho "Checking echo to see how to suppress newlines..."
  90. X(echo "hi there\c" ; echo " ") >.echotmp
  91. Xif $contains c .echotmp >/dev/null 2>&1 ; then
  92. X    echo "...using -n."
  93. X    n='-n'
  94. X    c=''
  95. Xelse
  96. X    cat <<'EOM'
  97. X...using \c
  98. XEOM
  99. X    n=''
  100. X    c='\c'
  101. Xfi
  102. Xecho $n "Type carriage return to continue.  Your cursor should be here-->$c"
  103. Xread ans
  104. Xrm -f .echotmp
  105. X
  106. X: now set up to do reads with possible shell escape and default assignment
  107. Xcat <<EOSC >myread
  108. Xcase "\$fastread" in
  109. Xyes) ans=''; echo " " ;;
  110. X*) ans='!';;
  111. Xesac
  112. Xwhile expr "X\$ans" : "X!" >/dev/null; do
  113. X    read ans
  114. X    case "\$ans" in
  115. X    !)
  116. X        sh
  117. X        echo " "
  118. X        echo $n "\$rp $c"
  119. X        ;;
  120. X    !*)
  121. X        set \`expr "X\$ans" : "X!\(.*\)\$"\`
  122. X        sh -c "\$*"
  123. X        echo " "
  124. X        echo $n "\$rp $c"
  125. X        ;;
  126. X    esac
  127. Xdone
  128. Xrp='Your answer:'
  129. Xcase "\$ans" in
  130. X'') ans="\$dflt";;
  131. Xesac
  132. XEOSC
  133. X: set up shell script to do ~ expansion
  134. Xcat >filexp <<EOSS
  135. X$startsh
  136. X: expand filename
  137. Xcase "\$1" in
  138. X ~/*|~)
  139. X    echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  140. X    ;;
  141. X ~*)
  142. X    if $test -f /bin/csh; then
  143. X        /bin/csh -f -c "glob \$1"
  144. X        echo ""
  145. X    else
  146. X        name=\`$expr x\$1 : '..\([^/]*\)'\`
  147. X        dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  148. X        if $test ! -d "\$dir"; then
  149. X            me=\`basename \$0\`
  150. X            echo "\$me: can't locate home directory for: \$name" >&2
  151. X            exit 1
  152. X        fi
  153. X        case "\$1" in
  154. X        */*)
  155. X            echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  156. X            ;;
  157. X        *)
  158. X            echo \$dir
  159. X            ;;
  160. X        esac
  161. X    fi
  162. X    ;;
  163. X*)
  164. X    echo \$1
  165. X    ;;
  166. Xesac
  167. XEOSS
  168. Xchmod +x filexp
  169. X$eunicefix filexp
  170. X
  171. X
  172. X
  173. X: general instructions
  174. Xcat <<EOH
  175. XThis installation shell script will examine your system and ask you
  176. Xquestions to determine how the $package package should be installed.
  177. XIf you get stuck on a question, you may use a ! shell escape to start a
  178. Xsubshell or execute a command.  Many of the questions will have default
  179. Xanswers in square brackets--typing carriage return will give you the
  180. Xdefault.
  181. X
  182. XEOH
  183. Xrp="[Type carriage return to continue]"
  184. Xecho $n "$rp $c"
  185. X. myread
  186. X
  187. X: find out where common programs are
  188. Xecho " "
  189. Xecho "Locating mailsplit component utility programs..."
  190. Xcat <<EOSC >loc
  191. X$startsh
  192. Xcase \$# in
  193. X0) exit 1;;
  194. Xesac
  195. Xthing=\$1
  196. Xshift
  197. Xdflt=\$1
  198. Xshift
  199. Xfor dir in \$*; do
  200. X    case "\$thing" in
  201. X    .)
  202. X        if test -d \$dir/\$thing; then
  203. X            echo \$dir
  204. X            exit 0
  205. X        fi
  206. X        ;;
  207. X    *)
  208. X        if test -f \$dir/\$thing; then
  209. X            echo \$dir/\$thing
  210. X            exit 0
  211. X        elif test -f \$dir/\$thing.exe; then
  212. X            : on Eunice apparently
  213. X            echo \$dir/\$thing
  214. X            exit 0
  215. X        fi
  216. X        ;;
  217. X    esac
  218. Xdone
  219. Xecho \$dflt
  220. Xexit 1
  221. XEOSC
  222. Xchmod +x loc
  223. X$eunicefix loc
  224. Xloclist="
  225. Xbasename
  226. Xcat
  227. Xtar
  228. Xrm
  229. Xsed
  230. Xmv
  231. Xawk
  232. Xhead
  233. Xpwd
  234. Xsplit
  235. Xcompress
  236. XMail
  237. Xtouch
  238. Xuuencode
  239. Xuudecode
  240. Xuncompress
  241. X"
  242. Xpth='. /bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin /etc /usr/new /usr/new/bin /usr/nbin /usr/ucb/bin /usr/old'
  243. X
  244. Xfor file in $loclist; do
  245. X    xxx=`loc $file $file $pth`
  246. X    eval $file=$xxx
  247. X    eval _$file=$xxx
  248. X    case "$xxx" in
  249. X    /*)
  250. X        echo $file is in $xxx.
  251. X        ;;
  252. X    *)
  253. X        echo "I don't know where $file is.  I hope it's in everyone's PATH."
  254. X        ;;
  255. X    esac
  256. Xdone
  257. Xcase "$test" in
  258. Xtest)
  259. X    echo "Hopefully test is built into your sh."
  260. X    ;;
  261. X/bin/test)
  262. X    if sh -c "PATH= test true" >/dev/null 2>&1; then
  263. X        echo "Using the test built into your sh."
  264. X        test=test
  265. X    fi
  266. X    ;;
  267. X*)
  268. X    test=test
  269. X    ;;
  270. Xesac
  271. Xcase "$echo" in
  272. Xecho)
  273. X    echo "Hopefully echo is built into your sh."
  274. X    ;;
  275. X/bin/echo)
  276. X    echo " "
  277. X    echo "Checking compatibility between /bin/echo and builtin echo (if
  278. Xany)..."    $echo $n "hi there$c" >foo1
  279. X    echo $n "hi there$c" >foo2
  280. X    if cmp foo1 foo2 >/dev/null 2>&1; then
  281. X        echo "They are compatible.  In fact, they may be identical."
  282. X    else
  283. X        case "$n" in
  284. X        '-n') n='' c='\c' ans='\c' ;;
  285. X        *) n='-n' c='' ans='-n' ;;
  286. X        esac
  287. X        cat <<FOO
  288. XThey are not compatible!  You are probably running ksh on a non-USG system.
  289. XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
  290. Xhave echo built in and we may have to run some Bourne shell scripts.  That
  291. Xmeans I'll have to use $ans to suppress newlines now.  Life is ridiculous.
  292. X
  293. XFOO
  294. X        rp="Your cursor should be here-->"
  295. X        $echo $n "$rp$c"
  296. X        . myread
  297. X    fi
  298. X    $rm -f foo1 foo2
  299. X    ;;
  300. X*)
  301. X    : cross your fingers
  302. X    echo=echo
  303. X    ;;
  304. Xesac
  305. Xrmlist="$rmlist loc"
  306. X
  307. X: see if sh knows # comments
  308. Xecho " "
  309. Xecho "Checking your sh to see if it knows about # comments..."
  310. Xif sh -c '#' >/dev/null 2>&1 ; then
  311. X    echo "Your sh handles # comments correctly."
  312. X    shsharp=true
  313. X    spitshell=cat
  314. X    echo " "
  315. X    echo "Okay, let's see if #! works on this system..."
  316. X    echo "#!/bin/echo hi" > try
  317. X    $eunicefix try
  318. X    chmod +x try
  319. X    try > today
  320. X    if $contains hi today >/dev/null 2>&1; then
  321. X        echo "It does."
  322. X        sharpbang='#!'
  323. X    else
  324. X        echo "#! /bin/echo hi" > try
  325. X        $eunicefix try
  326. X        chmod +x try
  327. X        try > today
  328. X        if test -s today; then
  329. X            echo "It does."
  330. X            sharpbang='#! '
  331. X        else
  332. X            echo "It doesn't."
  333. X            sharpbang=': use '
  334. X        fi
  335. X    fi
  336. Xelse
  337. X    echo "Your sh doesn't grok # comments--I will strip them later on."
  338. X    shsharp=false
  339. X    echo "exec grep -v '^#'" >spitshell
  340. X    chmod +x spitshell
  341. X    $eunicefix spitshell
  342. X    spitshell=`pwd`/spitshell
  343. X    echo "I presume that if # doesn't work, #! won't work either!"
  344. X    sharpbang=': use '
  345. Xfi
  346. X
  347. X
  348. X: figure out how to guarantee sh startup
  349. Xecho " "
  350. Xecho "Checking out how to guarantee sh startup..."
  351. Xstartsh=$sharpbang'/bin/sh'
  352. Xecho "Let's see if '$startsh' works..."
  353. Xcat >try <<EOSS
  354. X$startsh
  355. Xset abc
  356. Xtest "$?abc" != 1
  357. XEOSS
  358. X
  359. Xchmod +x try
  360. X$eunicefix try
  361. Xif try; then
  362. X    echo "Yup, it does."
  363. Xelse
  364. X    echo "Nope.  You may have to fix up the shell scripts to make sure sh runs
  365. Xthem."
  366. Xfi
  367. Xrm -f try today
  368. X
  369. X: determine where manual pages go
  370. Xcase "$mansrc" in
  371. X'')
  372. X    dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
  373. X    ;;
  374. X*)  dflt="$mansrc"
  375. X    ;;
  376. Xesac
  377. Xcont=true
  378. Xwhile $test "$cont" ; do
  379. X    echo " "
  380. X    rp="Where do the manual pages (source) go? [$dflt]"
  381. X    $echo $n "$rp $c"
  382. X    . myread
  383. X    mansrc=`filexp "$ans"`
  384. X    if test -d $mansrc; then
  385. X        cont=''
  386. X    else
  387. X        dflt=n
  388. X        rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
  389. X        $echo $n "$rp $c"
  390. X        . myread
  391. X        dflt=''
  392. X        case "$ans" in
  393. X        y*) cont='';;
  394. X        esac
  395. X    fi
  396. Xdone
  397. Xcase "$mansrc" in
  398. X*l)
  399. X    manext=l
  400. X    ;;
  401. X*n)
  402. X    manext=n
  403. X    ;;
  404. X*C)
  405. X    manext=C
  406. X    ;;
  407. X*)
  408. X    manext=1
  409. X    ;;
  410. Xesac
  411. X
  412. X
  413. X: determine where public executables go
  414. Xcase "$bin" in
  415. X'')
  416. X    dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
  417. X    ;;
  418. X*)  dflt="$bin"
  419. X    ;;
  420. Xesac
  421. Xcont=true
  422. Xwhile $test "$cont" ; do
  423. X    echo " "
  424. X    rp="Where do you want to put the public executables? [$dflt]"
  425. X    $echo $n "$rp $c"
  426. X    . myread
  427. X    bin="$ans"
  428. X    bin=`filexp $bin`
  429. X    if test -d $bin; then
  430. X        cont=''
  431. X    else
  432. X        dflt=n
  433. X        rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
  434. X        $echo $n "$rp $c"
  435. X        . myread
  436. X        dflt=''
  437. X        case "$ans" in
  438. X        y*) cont='';;
  439. X        esac
  440. X    fi
  441. Xdone
  442. X:
  443. X: Variables and tuning parameters set here:
  444. X:
  445. Xecho " "
  446. Xdflt="/tmp"
  447. Xrp="In which directory should temporary files be created? [$dflt]"
  448. Xecho $n "$rp $c"
  449. X. myread
  450. XTD="$ans"
  451. X
  452. X:
  453. X: If uuencode not found, try btoa
  454. X:
  455. Xcase $uuencode in
  456. X  uuencode)
  457. X    echo " "
  458. X    echo "Hmmm...  I couldn't find uuencode anywhere; I'll look for btoa."
  459. X    file="btoa"
  460. X    xxx=`loc $file $file $pth`
  461. X    eval $file=$xxx
  462. X    eval _$file=$xxx
  463. X    case "$xxx" in
  464. X      /*) echo "$file is in $xxx  I'll use $xxx instead of uuencode."
  465. X          uuencode=$xxx ;;
  466. X      *)  echo "btoa not found either."
  467. X          echo " "
  468. X          dflt="uuencode"
  469. X      rp="Neither uuencode nor btoa found; which shall I use [$dflt]?"
  470. X          echo $n "$rp $c"
  471. X      . myread
  472. X          uuencode="$ans" ;;
  473. X    esac ;;
  474. Xesac
  475. X
  476. XUUOPT="" 
  477. Xcase $uudecode in
  478. X  uudecode)
  479. X    echo " "
  480. X    echo "Hmmm...  I couldn't find uudecode anywhere; I'll look for btoa -a."
  481. X    file="btoa"
  482. X    xxx=`loc $file $file $pth`
  483. X    eval $file=$xxx
  484. X    eval _$file=$xxx
  485. X    case "$xxx" in
  486. X      /*) echo "$file is in $xxx  I'll use $xxx instead of uudecode."
  487. X          uuencode=$xxx 
  488. X      UUOPT="-a" ;;
  489. X      *)  echo "btoa not found either."
  490. X          echo " "
  491. X          dflt="uudecode"
  492. X      rp="Neither uudecode nor btoa found; which shall I use [$dflt]?"
  493. X          echo $n "$rp $c"
  494. X      . myread
  495. X          uudecode="$ans" ;;
  496. X    esac ;;
  497. Xesac
  498. X:
  499. X: If compress not found, try compact
  500. X:
  501. Xcompact="false"
  502. Xcase $compress in
  503. X  compress)
  504. X    echo " "
  505. X    echo "Hmmm...  I couldn't find compress anywhere; I'll look for compact."
  506. X    file="compact"
  507. X    xxx=`loc $file $file $pth`
  508. X    eval $file=$xxx
  509. X    eval _$file=$xxx
  510. X    case "$xxx" in
  511. X      /*) echo "$file is in $xxx  I'll use $xxx instead of compress."
  512. X          compress=$xxx
  513. X          compact="true"  ;;
  514. X      *)  echo "compact not found either."
  515. X          echo " "
  516. X      file="pack"
  517. X      xxx=`lock $file $file $pth`
  518. X      eval $file=$xxx
  519. X      eval _$file=$xxx
  520. X      case "$xxx" in
  521. X        /*) echo "$file is in $xxx  I'll use $xxx instead of compress."
  522. X                compress=$xxx
  523. X                compact="others"  ;;
  524. X            *)  echo "pack not found either."
  525. X                echo " "
  526. X            dflt="compress"
  527. X    rp="No compress, no compact and no pack found; which shall I use [$dflt]?"
  528. X            echo $n "$rp $c"
  529. X            . myread
  530. X            compact="false"
  531. X            compress="$ans" ;;
  532. X      esac;;
  533. X    esac ;;
  534. Xesac
  535. X:
  536. X: Likewise for uncompress and uncompact:
  537. X:
  538. Xcase $uncompress in
  539. X  uncompress)
  540. X    echo " "
  541. X    echo "I couldn't find uncompress anywhere; I'll look for uncompact."
  542. X    file="uncompact"
  543. X    xxx=`loc $file $file $pth`
  544. X    eval $file=$xxx
  545. X    eval _$file=$xxx
  546. X    case "$xxx" in
  547. X      /*) echo "$file is in $xxx  I'll use $xxx instead of uncompress."
  548. X          uncompress=$xxx ;;
  549. X      *)  echo "uncompact not found either."
  550. X          echo " "
  551. X      file="unpack"
  552. X      xxx=`loc $file $file $pth`
  553. X      eval $file=$xxx
  554. X      eval _$file=$xxx
  555. X      case "$xxx" in
  556. X        /*) echo "$file is in $xxx  I'll use $xxx instead of uncompress."
  557. X            uncompress=$xxx ;;
  558. X        *)  echo "unpack not found either."
  559. X            echo " "
  560. X            dflt="uncompress"
  561. Xrp="No uncompress, no uncompact and no unpack found; which should I use [$dflt]?"
  562. X            echo $n "$rp $c"
  563. X            . myread
  564. X            uncompress="$ans" ;;
  565. X     esac ;;
  566. X    esac ;;
  567. Xesac
  568. X
  569. X:
  570. X: Set default bits for compress, file name extension, and command line flags
  571. X:
  572. Xcase $compact in
  573. X  false)
  574. X    echo " "
  575. X    dflt="16"
  576. X    rp="How many bits should $compress use (ok to guess) [$dflt]"
  577. X    echo $n "$rp $c"
  578. X    . myread
  579. X    CB="$ans"
  580. X    CF="\"-b $CB\""
  581. X    CE="Z" ;;
  582. X  true)
  583. X    CE="C"
  584. X    CF="" ;;
  585. X  others)
  586. X    CE="z"
  587. X    CF="" ;;
  588. Xesac
  589. X:
  590. X: Check if Mail was found, if not use mail:
  591. X:
  592. XMS="Subj"
  593. Xcase $Mail in
  594. X  Mail)
  595. X    MS="Mist"
  596. X    echo " "
  597. X    echo "I couldn't find Mail anywhere; I'll try to use mailx..."
  598. X    file="mailx"
  599. X    xxx=`loc $file $file $pth`
  600. X    eval $file=$xxx
  601. X    eval _$file=$xxx
  602. X    case "$xxx" in
  603. X      /*) echo "$file is in $xxx  I'll use $xxx."
  604. X          Mail=$xxx ;;
  605. X       *) echo " "
  606. X      echo "I couldn't find mailx anywhere; I'll try to use mail..."
  607. X      file="mail"
  608. X      xxx=`loc $file $file $pth`
  609. X      eval $file=$xxx
  610. X      eval _$file=$xxx
  611. X      case "$xxx" in
  612. X        /*) echo "$file is in $xxx  I'll use $xxx."
  613. X            Mail=$xxx ;;
  614. X         *) echo "mail not found either."
  615. X            echo " "
  616. X            dflt="mail"
  617. X        rp="Neither mail nor Mail was found; which should I use [$dflt]?"
  618. X            echo $n "$fp $c"
  619. X            . myread
  620. X            Mail="$ans" ;;
  621. X     esac ;;
  622. X     esac ;;
  623. Xesac
  624. X
  625. X# Strip dirnames here for compatibilities. 
  626. X#     Added by yamanaka@iias.fujitsu.co.jp
  627. X
  628. Xfor file in $loclist; do
  629. X    xxx=`loc $file $file $pth`
  630. X    eval $file=`basename $xxx`
  631. Xdone
  632. X
  633. X
  634. Xecho " "
  635. Xdflt="5"
  636. Xrp="What should the default debugging level be (ok to guess) [$dflt]"
  637. Xecho $n "$rp $c" 
  638. X. myread 
  639. XDB="$ans"
  640. X
  641. Xdflt="0"
  642. X
  643. Xcat << FOO
  644. X
  645. XSome mailers (a certain X.400 system with "MTA congestion problems"
  646. Xwill remain nameless) have trouble dealing with sudden, large bursts
  647. Xof messages.  You might want to set the default delay to 5 or 10
  648. Xseconds if your mailer has such problems.  Otherwise leave it at 0, the
  649. Xdefault.
  650. X
  651. XFOO
  652. X
  653. Xrp="What is the default delay (in seconds) between sending pieces [$dflt]"
  654. Xecho $n "$rp $c"
  655. X. myread
  656. XDE="$ans"
  657. X
  658. X
  659. Xecho " "
  660. Xdflt=''
  661. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  662. Xrp="If you did, type ^C and start over."
  663. X$echo $n "$rp $c"
  664. X. myread
  665. Xecho " "
  666. X
  667. X:
  668. X: here goes!!
  669. X:
  670. X
  671. Xcp ../joinr.SH ./
  672. Xcp ../mailsplit.SH ./
  673. X. joinr.SH
  674. X. mailsplit.SH
  675. X
  676. Xecho " "
  677. Xdflt="n"
  678. Xrp="Would you like to install joinr and mailsplit in $bin now (y/n) "
  679. Xecho $n "$rp $c"
  680. X. myread
  681. Xcase $ans in
  682. X  y|Y) cp ./joinr $bin/joinr
  683. X       cp ./mailsplit $bin/mailsplit ;;
  684. Xesac
  685. X
  686. Xecho " " 
  687. Xdflt="n"
  688. Xrp="Would you like to install the man pages $mansrc now (y/n) "
  689. Xecho $n "$rp $c" 
  690. X. myread 
  691. Xcase $ans in
  692. X  y|Y) cp "../joinr.1" "$mansrc/joinr.$manext"
  693. X       cp "../mailsplit.1" "$mansrc/mailsplit.$manext" ;; 
  694. Xesac 
  695. X
  696. Xcd ..
  697. X
  698. Xecho " "
  699. Xecho "saving joinr and mailsplit in `pwd`"
  700. Xmv UU/joinr ./joinr
  701. Xmv UU/mailsplit ./mailsplit
  702. X
  703. Xecho " "
  704. Xecho "removing my work directory UU."
  705. X$rm -rf UU
  706. END_OF_FILE
  707. if test 15368 -ne `wc -c <'Configure'`; then
  708.     echo shar: \"'Configure'\" unpacked with wrong size!
  709. fi
  710. chmod +x 'Configure'
  711. # end of 'Configure'
  712. fi
  713. if test -f 'README' -a "${1}" != "-c" ; then 
  714.   echo shar: Will not clobber existing file \"'README'\"
  715. else
  716. echo shar: Extracting \"'README'\" \(3102 characters\)
  717. sed "s/^X//" >'README' <<'END_OF_FILE'
  718. Xmailsplit sends files and/or directories via e-mail using tar,
  719. Xcompress, etc.  It sends an awk-script to re-assemble the pieces at the
  720. Xreceiving side.  It is useful for sending directories and large images
  721. Xaround when you don't have ftp, or you have to cross e-mail network
  722. Xboundaries.
  723. X
  724. XTo configure and/or install mailsplit for your site/machine, just run the
  725. XConfigure script (i.e.):
  726. X
  727. X% sh Configure
  728. X
  729. XIf you're too lazy to read the man pages, here's a quick test.  After
  730. XConfigure'ing the programs, send yourself a sample directory, for example:
  731. X
  732. X< Send yourself your bin directory: >
  733. X
  734. X% mailsplit <you> ./bin
  735. X
  736. XWatch mailsplit run.  In a few minutes, you should receive mail.
  737. XCreate a new directory, cd to it, and run joinr on the incoming mail:
  738. X
  739. X% mkdir delete.me
  740. X% cd delete.me
  741. X% mail
  742. X
  743. X<save pieces of your bin directory in p1, p2, ...>
  744. X
  745. X% joinr p?
  746. X
  747. X* * *
  748. XIt is a Bourne-shell script.  Read the over-blown man-page.  Send me
  749. Xideas for improvements, bug reports.
  750. X-Mitch  (wyle@ethz.uucp)
  751. X
  752. X*** Addendum for 2.4 ***
  753. XApologies to those of you who received 2.0.  I fixed all the bugs which
  754. Xcaused it not to work (here).  Please be cautious with the enclosed
  755. Xversion.  I have tested it extensively on a Sun-3/xx under Sun OS 3.4,
  756. Xand a vax running Ultrix 2.0, but bugs may have crept in...  The
  757. Xjoin-script enclosed with each first message now accepts repeats and
  758. Xpieces out-of-order.   If you don't trust mailsplit 2.4, at least test
  759. Xand install this new joiner script.  It really helps.
  760. X
  761. X*** Addendum for 2.5 ***
  762. XMore apologies to those of you who received 2.4.  I am in the process
  763. Xof testing this package  along with it's new Configure script (Thanks,
  764. XLarry!) on our Cray, a Unisys sys V, Ultrix, Sun OS, a convex, a
  765. Xsequent, an alliant, etc.  When I'm confident it works on the machines
  766. Xhere, I'll release it to usenet.  In the meantime, please beat up on it
  767. Xand send me bugs, ideas, etc.  Configure can configure it to run on
  768. XUltrix, Sun OS, Dynix (sequent), convex (alliant), and vanilla sys-V
  769. X(Unisys 5000).  If it won't run on your machine, please tell me!
  770. X
  771. XIt now understands "compact" formats, though I think one should stick
  772. Xto compress.  There are PD implementations of compress.  I noticed that
  773. Xsome of the machines I tested on lack uuencode/uudecode.  There are PD
  774. Ximplementations of that as well, but after the Configure, I did NOT test
  775. Xmailsplit on those machines which were missing uuencode/decode.
  776. X
  777. Xcut was replaced by a sed script.  I should have known cut was a Sun-ism.
  778. X
  779. X*** Addendum for 2.6 ***
  780. X+ joinr now explicitely exits 0; there was a bug with BSD 4.3.
  781. X+ The new, robust joinr script died with old awk (vers 7).  I therefore
  782. X  changed it to be less robust but more portable:  pieces after # 10 will
  783. X  NOT be checked for duplicates and/or out-of-order.  I'll probably change it
  784. X  back after everyone has new awk :-(
  785. X+ Added -N flag to NOT send the joinr script (now that it's grown)
  786. X+ Added a man page for joinr
  787. X+ Added a how-to pargagraph to the front of this file for impatient people :)
  788. X+ More support for compact/uncompact
  789. X+ Extensive testing on all machines at ETH campus
  790. END_OF_FILE
  791. if test 3102 -ne `wc -c <'README'`; then
  792.     echo shar: \"'README'\" unpacked with wrong size!
  793. fi
  794. # end of 'README'
  795. fi
  796. if test -f 'README2.7' -a "${1}" != "-c" ; then 
  797.   echo shar: Will not clobber existing file \"'README2.7'\"
  798. else
  799. echo shar: Extracting \"'README2.7'\" \(2656 characters\)
  800. sed "s/^X//" >'README2.7' <<'END_OF_FILE'
  801. X
  802. XFixes in version 2.7 by HIDEKI YAMANAKA:
  803. X
  804. X1. Automatic recognition of an uncomprerss program and an decoder.
  805. X
  806. X   Mailsplit stores an archive like
  807. X
  808. X   ...
  809. X   begin 666 /tmp/1spxxx
  810. X   ...
  811. X
  812. X   If the file name is prefixed like /tmp/1spxxx.Z or /tmp/1spxxx.C,
  813. X   we can simply get an appropriate uncompress program. And some people
  814. X   prefer btoa than uuencode. the header of btoa is like
  815. X
  816. X  ...
  817. X  xbtoa5 666 /tmp/1spxxx Begin
  818. X  ...
  819. X
  820. X  So also we can get an appropriate decoder like "awk '/[bB]egin/{print $1}'".
  821. X  If the result is "begin", then "uudecode'; if it is "xbtoa5", then "btoa -a".
  822. X
  823. X  If the mechanism is included in the joinr, we can change a compress program
  824. X  and a encoder on the command line but configuration time.
  825. X
  826. X  Lastly, I think the filename "/tmp/1spxxx" is harmful because it is absolute
  827. X  path name. If some site configures the temporal directory "/usr/tmp", the 
  828. X  site cannot reassembles transmitted files unless /tmp has enough space.
  829. X  (Even though /usr/tmp is enough space for reassembling the pieces.)
  830. X  I think the basename is better.
  831. X
  832. X2. Making more System V compatible.
  833. X
  834. X  Joinr script isn't always compatible with other site. Commands in the script
  835. X  are specified by its absolute pathname, but there are many System V machines
  836. X  which are not same the path name. So I think better introduce PATH variable
  837. X  in the script and strip dirnames of the commands.
  838. X
  839. X  The "tar" program of System V produces verbose messages in the error stream
  840. X  when specifying -v option and mailsplit is requires another error detection
  841. X  mechanisms. The "tar" requires -o option when restoring so that the owner and
  842. X  permission would be appropriate. (Otherwise the owner is others and the 
  843. X  permission is like that.
  844. X
  845. X  System V machines doesn't always have the "compress", instead they have
  846. X  "pack". (Pack doesn't permit to read data from the stdin, so a slight 
  847. X  change is needed.)
  848. X
  849. X  System V machines doesn't have "Mail", instead they have "mailx".
  850. X
  851. X3. Abort routine when missing some parts.
  852. X
  853. X  You would think errors will detect later part of the joinr. When joinr
  854. X  passes an incorrect compressed file, uncompress sometimes produces
  855. X  huge garbage outputs. Moreover users cannot easily know missing parts
  856. X  if only an error detection message is shown.
  857. X
  858. X---
  859. XHideki Yamanaka
  860. X
  861. X-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  862. X        INTERNATIONAL INSTITUTE FOR 
  863. X    ADVANCED STUDY OF SOCIAL INFORMATION SCIENCE,
  864. X          FUJITSU LIMITED, JAPAN
  865. X
  866. X               HIDEKI YAMANAKA
  867. X        
  868. XE-MAIL: yamanaka@iias.fujitsu.co.jp or
  869. X    yamanaka%iias.fujitsu.co.jp@uunet.uu.net (in precise)
  870. X-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  871. END_OF_FILE
  872. if test 2656 -ne `wc -c <'README2.7'`; then
  873.     echo shar: \"'README2.7'\" unpacked with wrong size!
  874. fi
  875. # end of 'README2.7'
  876. fi
  877. if test -f 'TODO' -a "${1}" != "-c" ; then 
  878.   echo shar: Will not clobber existing file \"'TODO'\"
  879. else
  880. echo shar: Extracting \"'TODO'\" \(953 characters\)
  881. sed "s/^X//" >'TODO' <<'END_OF_FILE'
  882. X
  883. X 1. chmod in joinr  SHOULD be 777 NOT 0777
  884. X 2. chmod should NOT have -f flag!!
  885. X 3. change the tar command!!!!  don't check for output!
  886. X 4. Send a GENERIC joinr without all the &#@^&^ pathnames!!
  887. X 5. Use compress -d instead of uncompress
  888. X 6. Ask where the mail program is, don't assume /usr/ucb/mail.
  889. X 7. Configure doesn't understand relative directories!  Use ~ if available,
  890. X    cd .. (from UU when asking questions).
  891. X 8. Add the "to-be-installed-dir" to the path, export path!
  892. X 9. Include COMPLETE command used to send the stuff!
  893. X10. When a directory of '.' is provided as the name to send,
  894. X    perhaps cwd should be in subject line?
  895. X
  896. X11. Make uuencode BITNET (perhaps use btoa/atob) transparent!!!
  897. X*****  Add support for NON-uuencode uudecode including atob btoa
  898. Xabe!!
  899. X*****
  900. X
  901. X12. Allow user to change the @&!&^# names of mailsplit and joinr!!
  902. X
  903. X13. Ad wc tests (a la cshar) and crc check counts to pieces and complete
  904. X    tarchive.
  905. END_OF_FILE
  906. if test 953 -ne `wc -c <'TODO'`; then
  907.     echo shar: \"'TODO'\" unpacked with wrong size!
  908. fi
  909. # end of 'TODO'
  910. fi
  911. if test -f 'joinr.SH' -a "${1}" != "-c" ; then 
  912.   echo shar: Will not clobber existing file \"'joinr.SH'\"
  913. else
  914. echo shar: Extracting \"'joinr.SH'\" \(5704 characters\)
  915. sed "s/^X//" >'joinr.SH' <<'END_OF_FILE'
  916. Xecho "Extracting joinr (with variable substitutions)"
  917. X: This section of the file will have variable substitutions done on it.
  918. X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  919. X: Protect any dollar signs and backticks that you do not want interpreted
  920. X: by putting a backslash in front.  You may delete these comments.
  921. X$spitshell >joinr <<!GROK!THIS!
  922. X$startsh
  923. X#
  924. X# joinr - Extract and glue together mailsplit transmissions 
  925. X# @(#)joinr.SH    2.7    90/03/28       M F Wyle, T. Numata, H. Yamanaka
  926. X#
  927. X# \$Id: joinr.SH,v 1.9 90/03/19 22:38:39 yamanaka Rel $
  928. X#
  929. X# Modify awk script and strip dirnames of commands for compatibility
  930. X# between BSD and System V.
  931. X#        90/01/25       H.Yamanaka (with T.Numata's advices)
  932. X#
  933. X# Modify tar extraction mechanism in mailsplit to work on System V
  934. X# machines.
  935. X#        90/02/01    H.Yamanaka (with T.Numata's advices)
  936. X
  937. X############################################################################
  938. X# These commands and paths should be configured for your machine/site
  939. X
  940. XPATH="/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:\\
  941. X/usr/new:/usr/new/bin:/usr/nbin:/usr/ucb/bin:/usr/old"
  942. XBA=$basename     # chop off leading path *
  943. XCAT=$cat         # Concatenate And prinT *
  944. XTA=$tar          # Archive command *
  945. X# options to send to archive command to extract data
  946. Xif test -f /vmunix ; then
  947. X   TAO="xvf"  # If BSD;
  948. Xelif test -f /unix ; then
  949. X   TAO="xfo"  # If System V;
  950. Xelse
  951. X   TAO="xf" ; # I don't know.
  952. Xfi
  953. XRM="$rm -f"      # Remove command
  954. XSED=$sed         # Stream editor *
  955. XMV=$mv           # Rename command *
  956. XAWK=$awk         # get regular expression *
  957. XHEAD=$head       # Get initial part of file (for a non-UCB sys use cat) *
  958. XPWD=$pwd         # Print working directory *
  959. Xtouch=$touch     # the touch command
  960. Xuncompress=$uncompress
  961. Xuudecode=$uudecode
  962. XUUOPT=$UUOPT
  963. XCE=$CE           # compress'd file name extension
  964. X
  965. XTD=$TD            # temp directory
  966. XT1=$TD/x_\$\$_    # temp file for pieces
  967. XT2=$TD/g_\$\$     # temp file for garbage
  968. XT3=$TD/f_\$\$     # temp file for archive
  969. XT4=$TD/p_\$\$     # file containing the extract awk script
  970. X
  971. X!GROK!THIS!
  972. X
  973. X: In the following dollars and backticks do not need the extra backslash.
  974. X$spitshell >>joinr <<'!NO!SUBS!'
  975. X##############################################################################
  976. X# You might want to change these, but it's not likely.
  977. X
  978. XME=`$BA $0`        # This program's name
  979. XVE="2.7 90/03/28"  # Version of this program
  980. X
  981. X##############################################################################
  982. X# Hacker city
  983. X
  984. Xecho " "
  985. Xecho "$ME version $VE  (C) 1988, 1989, 1990   M F Wyle" 1>&2
  986. Xecho " "
  987. X
  988. Xecho "...initializing, preparing to extract..."
  989. Xif test ! -t 0; then
  990. X  echo "...found data on standard in; ignoring command line..."
  991. Xelse
  992. X  echo "...standard input empty, looking for files on command line..."
  993. X  case $# in
  994. X    0) case $ME in
  995. X     joinr) echo " "
  996. X        echo "Usage:   $ME [ < ] file(s)"
  997. X        echo "Example: $ME < p1of2 p2of2"
  998. X        echo " "
  999. X        exit 1 ;;
  1000. X    *) $CAT $0 |/bin/sh $0
  1001. X       exit 0 ;;
  1002. X       esac ;;
  1003. X  esac
  1004. X  echo "...found $# file(s) on command line, feeding them to $ME"
  1005. X  case $ME in
  1006. X    joinr) $CAT $* | $0 ;;
  1007. X    *)     $CAT $0 $* | /bin/sh $0 ;;
  1008. X  esac
  1009. X  exit 0
  1010. Xfi
  1011. X
  1012. Xcase $ME in
  1013. X  sh) echo " "
  1014. X      echo "Usage:   $ME file(s)"
  1015. X      echo "Example: $ME p1of2 p2of2"
  1016. X      echo " "
  1017. X      exit 1 ;;
  1018. Xesac
  1019. X
  1020. X$RM $T1* $T2 $T3* $T4*  # get rid of old files
  1021. X$CAT  <<'EOA' > $T4         # create awk extract script
  1022. XAWK '
  1023. XBEGIN { inhex = 0; nparts=0 }
  1024. X/^---/ {
  1025. X  if ($2 == "start" && $3 == "of" && $5 == "part" && $7 == "of") {
  1026. X    nparts= $8
  1027. X    fd=proc_files[$6 - 1]
  1028. X    if (fd == 0) fd= $6
  1029. X    if (fd < 10) file = "T1" fd
  1030. X    else if (fd < 100) file = "T1" "_" fd
  1031. X    else file = "T1" "__" fd
  1032. X    if (proc_files[$6] > 0) {
  1033. X       file = "T2"
  1034. X    } else {
  1035. X       proc_files[$6] = fd
  1036. X    }
  1037. X    inhex = 1
  1038. X    getline
  1039. X  }
  1040. X  else if ($2 == "end" && $3 == "of" && $5 == "part" && $7 == "of") 
  1041. X    inhex = 0
  1042. X}
  1043. X{ if (inhex) print $0 > file }
  1044. XEND { nerrors=0
  1045. X      for (i=1; i <= nparts; i++)
  1046. X    if (proc_files[i] == 0) {
  1047. X      print "*** part " i " is missing. ***" 
  1048. X      nerrors++
  1049. X    }
  1050. X      if (nerrors > 0) print "abort" > "T3"
  1051. X}'
  1052. XEOA
  1053. X
  1054. X# Make awk script use process-specific filenames
  1055. X$SED -e "s;AWK;$AWK;" -e "s;T1;$T1;" -e "s;T2;$T2;" \
  1056. X   -e "s;T3;$T3;" < $T4 > $T4"p"
  1057. X$RM $T4
  1058. X$MV $T4"p" $T4
  1059. X# Invoke the awk script on std in:
  1060. Xecho ...extracting data...
  1061. X. $T4
  1062. Xif test -s $T3 ; then
  1063. X  echo "...aborted extraction..."
  1064. X  $RM $T1* $T2 $T3 $T4
  1065. X  exit 1
  1066. Xfi
  1067. X$CAT $T1* > $T3                # gather pieces
  1068. Xecho ...finished extraction, starting uudecode...
  1069. Xheader=`$HEAD $T3 | $AWK '/[bB]egin/{print $1 " " $3}'`
  1070. Xset $header
  1071. Xfname=$2
  1072. Xcase $1 in
  1073. X  xbtoa5) uudecode=btoa
  1074. X      UUOPT='-a' ;;
  1075. X  begin) uudecode=uudecode
  1076. X     UUOPT=
  1077. X     ;;
  1078. Xesac
  1079. XOurDir=`$PWD`
  1080. Xcd $TD
  1081. X$touch $T3
  1082. Xchmod  777 $T3
  1083. X$uudecode $UUOPT $T3
  1084. X$RM  $T3
  1085. Xchmod  777 $fname
  1086. XIFS=.
  1087. Xset $fname
  1088. XIFS=' '
  1089. Xcase $2 in
  1090. X  C) uncompress=uncompact
  1091. X     CE=C ;;
  1092. X  z) uncompress=unpack
  1093. X     CE=z ;;
  1094. X  Z) uncompress=uncompress
  1095. X     CE=Z ;;
  1096. X  tar) uncompress=:
  1097. X       $MV $fname $1 ;;
  1098. X  *) $MV $fname $1.$CE ;;
  1099. Xesac
  1100. Xfname=$1
  1101. X
  1102. Xecho ...finished uudecode, starting uncompress...
  1103. X$uncompress $fname.$CE 1>/dev/null 2>&1
  1104. X$MV $fname $OurDir
  1105. Xcd $OurDir
  1106. Xecho ...finished uncompress, starting tar extraction...
  1107. X$RM $T1*                      # tar returns no exit status!! Grrr.
  1108. X$TA $TAO $fname 2>$T1         # check exit status of tar
  1109. Xif test -s $T1 ; then
  1110. Xecho "... >>> Sigh <<<  $TA seems to be having problems:"
  1111. X$CAT $T1
  1112. Xecho "...saving $TA archive in $fname."
  1113. Xelse
  1114. Xif test ! -f /vmunix ; then   # for System V (by yamanaka@iias.fujitsu.co.jp)
  1115. X  $TA tfv $fname
  1116. Xfi
  1117. Xecho "...That's all folks!"
  1118. X$RM $fname
  1119. Xfi
  1120. X$RM  $T1* $T2* $T3* $T4*
  1121. Xexit 0
  1122. X!NO!SUBS!
  1123. Xchmod 755 joinr
  1124. X$eunicefix joinr
  1125. END_OF_FILE
  1126. if test 5704 -ne `wc -c <'joinr.SH'`; then
  1127.     echo shar: \"'joinr.SH'\" unpacked with wrong size!
  1128. fi
  1129. chmod +x 'joinr.SH'
  1130. # end of 'joinr.SH'
  1131. fi
  1132. if test -f 'mailsplit.SH' -a "${1}" != "-c" ; then 
  1133.   echo shar: Will not clobber existing file \"'mailsplit.SH'\"
  1134. else
  1135. echo shar: Extracting \"'mailsplit.SH'\" \(10274 characters\)
  1136. sed "s/^X//" >'mailsplit.SH' <<'END_OF_FILE'
  1137. Xxfile="mailsplit"
  1138. Xecho "Extracting $xfile (with variable substitutions)"
  1139. X: This section of the file will have variable substitutions done on it.
  1140. X: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  1141. X: Protect any dollar signs and backticks that you do not want interpreted
  1142. X: by putting a backslash in front.  You may delete these comments.
  1143. X$spitshell >$xfile <<!GROK!THIS!
  1144. X$startsh
  1145. X
  1146. X##############################################################################
  1147. X# These commands and paths should be configured for your machine/site
  1148. X
  1149. XPATH="/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:\\
  1150. X/usr/new:/usr/new/bin:/usr/nbin:/usr/ucb/bin:/usr/old"
  1151. XBASENAME=$basename
  1152. XCAT=$cat
  1153. XRM=$rm
  1154. XMV=$mv
  1155. XSPLIT=$split
  1156. XTA=$tar              # Archive command (assumed here to be in search path!)
  1157. XCO=$compress         # Default compress command  (assumed to be in search path!)
  1158. XCE=$CE             # compress'd file name extension
  1159. XMA=$Mail             # Default Mail program
  1160. XUU=$uuencode         # uuencode command (assumed here to be in search path!)
  1161. XCB=$CB               # Default number of bits to use in compress
  1162. XCF=$CF               # Default compress command line flag(s)
  1163. XMS=$MS               # Mailer Subject line flag
  1164. XDE=$DE               # Default delay time between sending pieces
  1165. XTD=$TD               # Default temporary directory for storing temp files
  1166. XDB=$DB               # Default debugging level
  1167. XSPRT="_"         # Separator for archive file name
  1168. X#            ;; Added by yamanaka@iias.fujitsu.co.jp
  1169. X##############################################################################
  1170. X!GROK!THIS!
  1171. X
  1172. X: In the following dollars and backticks do not need the extra backslash.
  1173. X$spitshell >>$xfile <<'!NO!SUBS!'
  1174. X#
  1175. X# mailsplit:  package, transmit, re-assemble unix directories via e-mail
  1176. X#
  1177. X# @(#)mailsplit.SH    2.7    90/03/28       M F Wyle, H. Yamanaka
  1178. X#
  1179. X# $Id: mailsplit.SH,v 1.8 90/03/19 22:40:14 yamanaka Rel $
  1180. X#
  1181. X# Add -A option and strip dirnames of commands
  1182. X#             90/01/25       H Yamanaka
  1183. X
  1184. X
  1185. X##############################################################################
  1186. X# You might want to change these, but it's not likely.
  1187. X
  1188. XME=`$BASENAME $0`   # Program (my) name
  1189. XLI=700              # Default number of lines for split-up pieces
  1190. XCM="$0 $*"          # Command line
  1191. XVE="2.7  90/03/28"  # Version of this program
  1192. XMF=""               # Default Mailer flags
  1193. XIJ="true"           # Flag which signals if joinr script should be prepended
  1194. XTM=false            # Default test Mode flag (If set, don't do anything)
  1195. XT1=$TD/1sp$$        # Default temp file for output of tar, compress
  1196. XT2=$TD/2sp$$        # Default temp file for uuencoded output
  1197. XT3=$TD/3sp$$        # Default temp file prefix for split pieces
  1198. XT4=$TD/4sp$$        # a copy of joinr
  1199. X##############################################################################
  1200. X
  1201. X# You do NOT want to change these variables or their initial values!
  1202. X
  1203. XRA=all              # Default range of pieces to send
  1204. XFC=0                # File Count
  1205. Xne="FL=$FL' '"      # Next command in parser
  1206. XSU="_default_"      # Default Subject is first file or dir sent
  1207. XFL=""               # Initialize file list
  1208. XTO=""               # Initialize recipient
  1209. Xumask 0             # Important for writing reading files created!
  1210. X
  1211. X# Human Factors Law Number 4:  
  1212. X# "Upon startup, thou shalt tell the user where he is and how to quit."
  1213. X#           -Ben Schneiderman-
  1214. X
  1215. Xecho " " 1>&2
  1216. Xecho "$ME version $VE  (C) 1988, 1989, 1990    M F Wyle, H. Yamanaka" 1>&2
  1217. Xecho " " 1>&2
  1218. X
  1219. X##############################################################################
  1220. X# Read beyond here at your own risk; you've entered... The hacker zone...
  1221. X# Parse the command line for recipient, options, flags, files, dirs:
  1222. X
  1223. Xfor AR in $* ; do
  1224. X  case $AR in
  1225. X    -C  ) ne="CO=" ;;
  1226. X    -D  ) ne="TD=" ;;
  1227. X    -M  ) ne="MF=" ;;
  1228. X    -N  ) IJ="false" ;;
  1229. X    -A  ) MS="archive" ;;
  1230. X    -T  ) ne="TA=" ;;
  1231. X    -V  ) DB=9     ;;
  1232. X    -b  ) ne="CB=" ;;
  1233. X    -d  ) ne="DE=" ;;
  1234. X    -l  ) ne="LI=" ;;
  1235. X    -m  ) ne="MA=" ;;
  1236. X    -n  ) TM=true  ;;
  1237. X    -r  ) ne="RA=" ;;
  1238. X    -s  ) ne="SU=" ;;
  1239. X    -t  ) TM=true ;;
  1240. X    -v  ) echo "$ME version $VE by Mitch Wyle" ;  exit 0 ;;
  1241. X    -x* ) DB=`echo $AR | cut -c3` ; DB=${DB:-0} ;;
  1242. X    -u  ) ne="UU=" ;;
  1243. X    -*  ) echo " " ; echo "Bad flag for $ME": $AR
  1244. X          echo "Usage:    $ME  [<options>] <mailpath> <file(s)>"
  1245. X          echo "Example:  $ME  werner@utastro.uucp ./casetool"
  1246. X          echo " "
  1247. X          exit 0  ;;
  1248. X    *   ) eval $ne"$AR" ; ne='FL=$FL" "' ;;
  1249. X  esac
  1250. Xdone
  1251. Xcase $# in
  1252. X  0 | 1 )
  1253. X    echo " "
  1254. X    echo "Usage:    $ME  [<options>] <mailpath> <file(s)>"
  1255. X    echo "Example:  $ME  werner@utastro.uucp CaseTool"
  1256. X    echo " "
  1257. X    exit 0  ;;
  1258. Xesac
  1259. Xset $FL
  1260. XTO=$1
  1261. Xcase $SU in
  1262. X  _default_ ) SU=$2 ;;
  1263. Xesac
  1264. X
  1265. Xcase $DB in
  1266. X  8|9) set -x ;;
  1267. Xesac
  1268. X
  1269. X# create a copy of joinr in /tmp:
  1270. Xcat >$T4 <<'JOINR!END'
  1271. X!NO!SUBS!
  1272. Xcat ./joinr >>$xfile
  1273. X$spitshell >>$xfile <<'!NO!SUBS!'
  1274. XJOINR!END
  1275. X
  1276. Xcase $RA in               # hacked from usenet commentary; will
  1277. X  all) ;;                 # be replaced by an awk script RSN
  1278. X  *  )
  1279. X    SIFS="$IFS"
  1280. X    IFS=","
  1281. X    for i in $RA ; do
  1282. X      R=$R" "$i
  1283. X    done
  1284. X    RA=$R
  1285. X    IFS=$SIFS
  1286. X    R=""
  1287. X    for tok in $RA ; do
  1288. X      case $tok in 
  1289. X      *-*)
  1290. X        SIFS="$IFS"
  1291. X        IFS='-'
  1292. X        set $tok
  1293. X        IFS="$SIFS"
  1294. X        i=$1
  1295. X        max=${2:-99}
  1296. X        while test $i -le $max ; do
  1297. X          R=$R" "$i
  1298. X          i=`expr $i + 1`    # only exec in the entire parse
  1299. X        done ;;
  1300. X      *) R=$R" "$tok ;;
  1301. X      esac
  1302. X      RA=$R
  1303. X    done ;;
  1304. Xesac
  1305. X
  1306. Xcase $DB in
  1307. X  5|6|7|8|9) echo "...beginning tar and compress..." ;;
  1308. Xesac
  1309. Xset $FL ; shift
  1310. Xfor i in $* ; do
  1311. X  if test -s $i ; then        # Test existence of each file to send
  1312. X    FC=`expr $FC + 1`         # Increment file counter
  1313. X  fi
  1314. Xdone
  1315. Xif test $FC -gt 0 ; then      # Is there something to send?
  1316. X  case $DB in                 # Yup. continue
  1317. X    1|2|3|4) 
  1318. X      case $TM in
  1319. X        true )
  1320. X          echo "would have issued command:"
  1321. X          echo "$TA cvf $T1 $* 2> /dev/null"
  1322. X      case $CO in
  1323. X        *compress)
  1324. X              echo "CE=Z; $CO $CF $T1 1>/dev/null 2>&1 " ;;
  1325. X        *compact)
  1326. X              echo "CE=C; $CO $T1 1>/dev/null 2>&1 " ;;
  1327. X        *pack)
  1328. X              echo "CE=z; $CO $CF $T1 1>/dev/null 2>&1 " ;;
  1329. X        *cat)
  1330. X              echo "CE=tar; $MV $T1 $T1.$CE" ;;
  1331. X        *)
  1332. X              echo "$CO $T1 1>/dev/null 2>&1 " ;;
  1333. X      esac ;;
  1334. X        false)  $TA cvf $T1 $* 2> /dev/null
  1335. X          case $CO in
  1336. X            *compress)
  1337. X                  CE=Z; $CO $CF $T1 1>/dev/null 2>&1 ;;
  1338. X            *compact)
  1339. X                  CE=C; $CO $T1 1>/dev/null 2>&1 ;;
  1340. X            *pack)
  1341. X                  CE=z; $CO $T1 1>/dev/null 2>&1 ;;
  1342. X            *cat)
  1343. X                  CE=tar; $MV $T1 $T1.$CE ;;
  1344. X            *)
  1345. X                  $CO $T1 1>/dev/null 2>&1 ;;
  1346. X         esac ;;
  1347. X        *    ) echo "Sigh... Programmer error in $ME at line 93." ;;
  1348. X      esac ;;
  1349. X    *) 
  1350. X      case $TM in
  1351. X       true )
  1352. X         echo "would have issued command:"
  1353. X         echo "$TA cvf $T1 $* 2> /dev/null"
  1354. X     case $CO in
  1355. X       *compress)
  1356. X             echo "CE=Z; $CO $CF $T1 1>/dev/null 2>&1 " ;;
  1357. X       *compact)
  1358. X             echo "CE=C; $CO $T1 1>/dev/null 2>&1 " ;;
  1359. X       *pack)
  1360. X             echo "CE=z; $CO $T1 1>/dev/null 2>&1 " ;;
  1361. X        *cat)
  1362. X              echo "CE=tar; $MV $T1 $T1.$CE" ;;
  1363. X        *)
  1364. X              echo "$CO $T1 1>/dev/null 2>&1 " ;;
  1365. X     esac ;;
  1366. X        false)  $TA cvf $T1 $* 2> /dev/null
  1367. X          case $CO in
  1368. X            *compress)
  1369. X                  CE=Z; $CO $CF $T1 1>/dev/null 2>&1 ;;
  1370. X            *compact)
  1371. X                  CE=C; $CO $T1 1>/dev/null 2>&1 ;;
  1372. X            *pack)
  1373. X                  CE=z; $CO $T1 1>/dev/null 2>&1 ;;
  1374. X            *cat)
  1375. X                  CE=tar; $MV $T1 $T1.$CE ;;
  1376. X            *)
  1377. X                  $CO $T1 1>/dev/null 2>&1 ;;
  1378. X         esac ;;
  1379. X       *    ) echo "Sigh... Programmer error in $ME at line 153." ;;
  1380. X      esac ;;
  1381. X  esac
  1382. Xelse                          # Nope, nothing to send
  1383. Xcase $DB in
  1384. X  [5-9] ) echo "...whoops!  Nothing to send!  Punting..." 1>&2 ;;
  1385. Xesac
  1386. X  exit 1
  1387. Xfi
  1388. Xcase $DB in
  1389. X  5|6|7|8|9) echo "...finished tar, compress, starting uuencode..."
  1390. Xesac
  1391. Xcase $TM in
  1392. X  true )
  1393. X    echo "would have issued command:"
  1394. X    case $UU in
  1395. X      uuencode|*uuencode)
  1396. X    echo "$UU $T1.$CE `$BASENAME $T1.$CE` > $T2 " ;;
  1397. X      *)              
  1398. X    echo "(cd $TD; $UU `$BASENAME $T1.$CE` > $T2) " ;;
  1399. X    esac ;;
  1400. X  false) 
  1401. X    case $UU in
  1402. X      uuencode|*uuencode) 
  1403. X    $UU $T1.$CE `$BASENAME $T1.$CE` > $T2 ;;
  1404. X      *)
  1405. X    (cd $TD; $UU `$BASENAME $T1.$CE` > $T2) ;;
  1406. X    esac ;;
  1407. X  *    ) echo "Sigh... Programmer error in $ME at line 170." ;;
  1408. Xesac
  1409. Xcase $DB in
  1410. X  5|6|7|8|9) echo "...finished uuencode, starting split..." ;;
  1411. Xesac
  1412. Xcase $TM in 
  1413. X  true )
  1414. X    echo "would have issued command:" 
  1415. X    echo "$SPLIT -$LI $T2 $T3" ;; 
  1416. X  false)  $SPLIT -$LI $T2 $T3 ; ;; 
  1417. X  *    ) echo "Sigh... Programmer error in $ME at line 128." ;;
  1418. Xesac 
  1419. Xcase $TM in
  1420. X  true )
  1421. X    echo "would have issued commands:"
  1422. X    case $MS in
  1423. X      archive) echo "$CAT > $TO"_n ;;
  1424. X      Subj)    echo "$MA -s "$SU - part n of m" $TO" ;;
  1425. X    esac
  1426. X    echo "with n ranging from 1 to m; m cannot be determined."
  1427. X    echo "without running for real."
  1428. X    exit 0 ;;
  1429. Xesac 
  1430. X
  1431. Xn=1
  1432. Xset $T3*
  1433. Xfor f  do
  1434. X  SE=false
  1435. X  case $RA in
  1436. X    all)  SE=true ;;
  1437. X    *  )
  1438. X      for p in $RA ; do
  1439. X        case $p in
  1440. X          $n ) SE=true ;;
  1441. X        esac
  1442. X      done ;;
  1443. X  esac
  1444. X  case $SE in
  1445. X    true)
  1446. X    {
  1447. X    echo " "
  1448. X    case $n in
  1449. X    1)
  1450. X      if test ! -s $f ; then
  1451. X        case $DB in 
  1452. X          [5-9]) echo "...whoops!  $SPLIT failed!   Punting..." 1>&2 ;;
  1453. X        esac 
  1454. X        exit 1 ;
  1455. X      fi
  1456. X      case $IJ in
  1457. X        true) cat $T4 ;;
  1458. X      esac
  1459. X      echo " " ;;
  1460. X    esac
  1461. X    echo " "
  1462. X    echo "This file was packed by mailsplit version:"
  1463. X    echo $VE
  1464. X    echo with command:
  1465. X    echo "$CM"
  1466. X    echo "on: `date`"
  1467. X    echo " "
  1468. X    echo "--- start of $SU part $n of $#"
  1469. X    $CAT $f
  1470. X    echo "--- end of $SU part $n of $#"
  1471. X    echo " "
  1472. X    echo " "
  1473. X    } | 
  1474. X    case $MS in
  1475. X      Subj)    $MA $MF -s "$SU - part $n of $#" $TO ;;
  1476. X      archive) $CAT > $TO$SPRT$n ;;
  1477. X      *)       $MA $MF $TO ;;
  1478. X    esac
  1479. X    case $MS in
  1480. X      archive) echo "...output into $TO$SPRT$n..." ;;
  1481. X      *) case $DB in
  1482. X       [5-9]) echo "...sent part $n of $# to $MA..."
  1483. X              echo "...sleeping $DE seconds (waiting for mailer) ..." ;;
  1484. X     esac
  1485. X     sleep $DE ;;
  1486. X    esac
  1487. X  esac
  1488. X  n=`expr $n + 1`
  1489. X  if test `expr $n % 10` -eq 0;  then
  1490. X      SPRT=$SPRT"_"
  1491. X  fi
  1492. Xdone
  1493. X$RM -f $T1.$CE $T2 $T3* $T4
  1494. X!NO!SUBS!
  1495. Xchmod 755 $xfile
  1496. X$eunicefix $xfile
  1497. END_OF_FILE
  1498. echo shar: 2 control characters may be missing from \"'mailsplit.SH'\"
  1499. if test 10274 -ne `wc -c <'mailsplit.SH'`; then
  1500.     echo shar: \"'mailsplit.SH'\" unpacked with wrong size!
  1501. fi
  1502. chmod +x 'mailsplit.SH'
  1503. # end of 'mailsplit.SH'
  1504. fi
  1505. if test -f 'undoc' -a "${1}" != "-c" ; then 
  1506.   echo shar: Will not clobber existing file \"'undoc'\"
  1507. else
  1508. echo shar: Extracting \"'undoc'\" \(6947 characters\)
  1509. sed "s/^X//" >'undoc' <<'END_OF_FILE'
  1510. XSince I tore the comments out of the code, and it is not customary to send
  1511. XSCCS files around the net, I made this auxiliary file of documentation.
  1512. X
  1513. XAn alphabetical list of variables, their use and meaning:
  1514. X
  1515. XAR = argument
  1516. XCM = command line
  1517. XCO = compress program may be arc, etc.
  1518. XDB = Debug level (Verbosity level)
  1519. XDE = Delay between pieces
  1520. XFC = file count
  1521. XFL = File list (build up file list from params on command line in
  1522. XFL = any order (see /usr/bin/spell) for a good example of obfuscated,
  1523. XFL = clever parsing code 
  1524. XLI = the number of lines to split pieces into
  1525. XMA = mail transport agent
  1526. XME = the name of the program running
  1527. XMF = Mail flags to send to transport
  1528. XR  = range of pieces to be re-sent during parse stage
  1529. XRA = range of pieces to be re-sent if mailers on the way failed
  1530. XSE = send flag; if true, send the piece.  If false, don't
  1531. XSP = the name of the split program
  1532. XSU = subject of message  (defaults to first file name)
  1533. XT1 = temporary file containing output of tar and compress.
  1534. XT2 = temporary file containing uuencoded stuff
  1535. XT3 = temporary file(s) containing  split pieces
  1536. XTA = tar program (may be shar, tar, cat, etc ;-)
  1537. XTD = Temporary directory in which temp files should go can be . or /tmp.
  1538. XTM =  Test-mode flag (-n option of make)  Don't do anything, just
  1539. XTM = echo what you would have done if testmode option not on.
  1540. XTO = recipient(s) of message
  1541. XUU = the uuencode program (may be replaced with btoa / atob ;-)
  1542. XVE = version number
  1543. Xf  = file name (piece) during loop which sends pieces
  1544. Xi  = a loop index used during parse of the range of files to be re-sent
  1545. Xmax=  The loop-limit used in parse of range of files to be re-sent
  1546. Xmax= is assumed to be 99 if no top-of-range is given.
  1547. Xn  = piece number during the loop which sends pieces via mail
  1548. Xne =  next param on command line (after flag is set, next param gets
  1549. Xne = eval'd to the var set in ne  (see above)
  1550. Xt  = a specific token containing a range to be expanded (n-m)
  1551. Xtok= Token during parse of range of files to be re-sent
  1552. X
  1553. X
  1554. XHistory:
  1555. X# Coder        Date      Comments
  1556. X#------------  -------- ---------------------------------------------------
  1557. X# M F Wyle     02nov87    Shamelessly stolen from tarmail :-)
  1558. X# WRU          18feb88    changed variable MAILER, added SPLITTER,
  1559. X#                         LINES, USER and a warning about uudecode
  1560. X# M F Wyle     25mar88    Add tar, extract join-script in 1st msg
  1561. X# WRU          03apr88  fixed some quoting problems in "echo"-strings
  1562. X#            cosmetic changes: renamed "mailsplit"
  1563. X#            created THISNAME
  1564. X#                       fixed some typos, added Email-addresses, example,
  1565. X#                       section for suggested improvements
  1566. X# MFW          05apr88  Fix more quoting problems in echo strings (shell
  1567. X#                       variables); added /bin/rm cleanup to join-script
  1568. X# MFW          21jun88  based on WRU's suggestions:
  1569. X#                       1) add file-name to subject
  1570. X#                       2) verbose explanations
  1571. X#                       3) add parts-order checking!  Yippeee!
  1572. X# MFW          08jul88  Fix uudecode setuid bug
  1573. X# MFW          12jul88  Fix empty or no files bug, added FILECOUNT
  1574. X# MFW          17jul88  Added umask 0, delay before mail, check after split
  1575. X# MFW          19jul88  Major re-write for flags, verbose, sccs control
  1576. X# MFW          25jul88  Added a range-parser, more flags, some documentation
  1577. X#                       Up'd release to 2.0 for distribution
  1578. X# MFW          29jul88  Fixed 8 separate bugs; upgraded join-script
  1579. X#                       to accept pieces out of order and duplicate pieces.
  1580. X# MFW          04Aug88  Fixed more bugs; added comments, put sys-specific
  1581. X#                       stuff at the top for configuring.  hacked join
  1582. X#                       script because it leaks bugs like an ant-hill.
  1583. X#
  1584. X#                       All the comments from the net about parsing ranges
  1585. X#                       won't fix the *@&$#& bugs in join.
  1586. X# MFW          11Aug88  Fixed joinr.  Added -N flag, wrote Configure script,
  1587. X#                       tested on a slew of machines
  1588. X# MFW          18Aug88  made joinr compatible with old awk, added exit
  1589. X
  1590. XVerbal description of algorithm:
  1591. X====== =========== == ==========
  1592. XWhen the program starts, it initializes some variables, then parses the
  1593. Xentire command line.  It builds up a list of non-flag options in the F
  1594. Xvariable.  The first parameter in F is the e-mail path.  All others are
  1595. Xfiles or directories.
  1596. X
  1597. XIf no subject is set via the "-s subject"  flag, the subect is assigned
  1598. Xfrom the first file to send.  The three temporary file names (variables
  1599. XT1, T2, and T3) are then assigned.
  1600. X
  1601. XThe range of pieces to be re-sent is parsed.
  1602. X
  1603. XDebugging output is echo'd to standard out as appropriate for the
  1604. Xdebugging level.  If the -t or -n option is set, nothing is really
  1605. Xdone, except printing out what would have happened.
  1606. X
  1607. XThe tar, compress, split commands are performed, with appropriate
  1608. Xverbosity for the debugging level.  Certain checks are made along the
  1609. Xway to verify that the commands did not fail.  If one fails, the
  1610. Xprogram exits with an appropriate failure message.
  1611. X
  1612. XThe files created in $T3* are sent via mail one at a time, with
  1613. Xdelays.  The first file sent has a join-script pre-pended.  A file
  1614. Xcounter $n is used to label the subject lines.
  1615. X
  1616. XThe temporary files are deleted.
  1617. X
  1618. X* * *
  1619. X
  1620. XThe join script which comes with each 1st message sent by mailsplit was
  1621. Xupgraded to accept out-of-order pieces and repeated sequences of
  1622. Xpieces.  It ignores repeats, and glues the pieces together in their
  1623. Xproper order.  These features involve saving each piece in a separate
  1624. Xfile named by it's part number, and saving it only once.  awk(1) can
  1625. Xaccomplish this task easily.  An associative array is formed,
  1626. Xcontaining all of the pieces seen by the script.  If a piece comes
  1627. Xthrough a second time, the script notices by looking in the associative
  1628. Xarray.  Duplicate pieces are piped into the file /tmp/garbage (perhaps
  1629. XI should parameterize this name?) and later deleted.  Since the first
  1630. Xpass is now really a sort filter of the pieces, cat(1) is used to push
  1631. Xthe sorted pieces together into uudecode.  
  1632. X
  1633. XThe join script in 2.4 sucks rocks.  I'm re-writing the @#*@ with
  1634. Xmore error-checking, comments, configurable variables, and maybe it'll
  1635. Xwork on somebody else's *@&#&$ machine!  Can you say, "Test?"
  1636. X
  1637. XNew features in 2.5:  
  1638. X- There is a flag for turning off sending the joinr script.
  1639. X- The joinr script is a "here" document and is spit into a temp directory
  1640. X  at startup.
  1641. X- The package comes with a Configure script (a la Larry Wall) which will
  1642. X  configure site-specific commands, parameters and install the sucker!
  1643. X- sccs blew up.  I may move to rcs.
  1644. X- Expect a better Configure script from metaconfig by 3.0
  1645. X
  1646. XNew features in 2.6:
  1647. X+ joinr is LESS robust for compatibility with old awk.  Expect machine-
  1648. X  specific joinr scripts from an intelligent Config script in 3.0
  1649. X
  1650. XNew features in 2.7:
  1651. X
  1652. X-Use a generic subject name "archive" to strip directory names in long
  1653. X paths.
  1654. END_OF_FILE
  1655. if test 6947 -ne `wc -c <'undoc'`; then
  1656.     echo shar: \"'undoc'\" unpacked with wrong size!
  1657. fi
  1658. # end of 'undoc'
  1659. fi
  1660. if test -f 'joinr.1' -a "${1}" != "-c" ; then 
  1661.   echo shar: Will not clobber existing file \"'joinr.1'\"
  1662. else
  1663. echo shar: Extracting \"'joinr.1'\" \(1715 characters\)
  1664. sed "s/^X//" >'joinr.1' <<'END_OF_FILE'
  1665. X.\" @(#)joinr.1    2.6    88/08/20       M F Wyle
  1666. X.nr N 24
  1667. X.nr D 5
  1668. X.TH JOINR 1 88/08/11
  1669. X.UC 4
  1670. X.SH NAME
  1671. Xjoinr \- re\-assemble mailsplit pieces into original directory tree
  1672. X.SH SYNOPSIS
  1673. X.B joinr 
  1674. X[ \< ] 
  1675. X.B files
  1676. X.SH DESCRIPTION
  1677. X.\" ---------------------------------------------------------------
  1678. X.\" This defines appropriate quote strings for nroff and troff
  1679. X.ds lq \&"
  1680. X.ds rq \&"
  1681. X.if t .ds lq ``
  1682. X.if t .ds rq ''
  1683. X.\" Just in case these number registers aren't set yet...
  1684. X.if \nN==0 .nr N 10
  1685. X.if \nD==0 .nr D 5
  1686. X.\" ---------------------------------------------------------------
  1687. X.I Joinr
  1688. Xis a program to re-build files and or directories which have been sent
  1689. Xvia mailsplit(1).   It uses tar(1), uncompress(1) and awk(1) to
  1690. Xcombine, extract, and decypher  the separate pieces of mail created by
  1691. Xmailsplit.  The script accepts the pieces in 
  1692. X.I any 
  1693. Xorder and allows for duplications.  That is, one can send the same pieces
  1694. Xthrough joinr repeatedly, and send the pieces through in any order.
  1695. X.LP
  1696. XIt will accept files on the standard input, so a command of the form:
  1697. X.br
  1698. X.sp
  1699. X\% cat lesson?of? | joinr
  1700. X.br
  1701. X.sp
  1702. Xshould produce the same result as:
  1703. X.br
  1704. X.sp
  1705. X\% joinr lesson?of?
  1706. X.br
  1707. X.sp
  1708. XThe program is configured to run on your system by the Configure script which
  1709. Xcomes with the mailsplit distribution.  However, each mailsplit message sent
  1710. Xalso prepends this script to the first message sent unless mailsplit is
  1711. Xexplicitely instructed not to send joinr.
  1712. X.SH AUTHOR
  1713. XMitchell F. Wyle  (wyle@ethz.uucp)
  1714. X.SH BUGS
  1715. X.LP
  1716. XConfigure doesn't ask about defaults and options
  1717. X.LP
  1718. XShould bootstrap itself at the receiving site (as with configure)
  1719. X.SH SEE ALSO
  1720. Xsplit(1), tar(1), mail(1), uuencode(1), uudecode(1), compress(1),
  1721. Xawk(1), sh(1)
  1722. END_OF_FILE
  1723. if test 1715 -ne `wc -c <'joinr.1'`; then
  1724.     echo shar: \"'joinr.1'\" unpacked with wrong size!
  1725. fi
  1726. # end of 'joinr.1'
  1727. fi
  1728. if test -f 'mailsplit.1' -a "${1}" != "-c" ; then 
  1729.   echo shar: Will not clobber existing file \"'mailsplit.1'\"
  1730. else
  1731. echo shar: Extracting \"'mailsplit.1'\" \(11634 characters\)
  1732. sed "s/^X//" >'mailsplit.1' <<'END_OF_FILE'
  1733. X.\" @(#)mailsplit.1    2.6    88/08/20       M F Wyle
  1734. X.nr N 24
  1735. X.nr D 5
  1736. X.TH MAILSPLIT 1 88/08/20
  1737. X.UC 4
  1738. X.SH NAME
  1739. X.B mailsplit 
  1740. X\- package, split, transmit file directories by electronic mail
  1741. X.SH SYNOPSIS
  1742. X.B mailsplit 
  1743. X[
  1744. X.B options
  1745. X] 
  1746. X.B mail-path files
  1747. X.br
  1748. X  really:
  1749. X.br
  1750. X.B mailsplit
  1751. X[
  1752. X.B \-ANVntv
  1753. X] [
  1754. X.B \-C compress program
  1755. X] [
  1756. X.B \-D temporary directory
  1757. X] [
  1758. X.B \-M Mailer options
  1759. X] [
  1760. X.B \-T archive program
  1761. X] [
  1762. X.B \-b compress-bits
  1763. X] [
  1764. X.B \-d delay time
  1765. X] [
  1766. X.B \-l split lines
  1767. X] [
  1768. X.B \-m mail agent
  1769. X] [
  1770. X.B \-r parts
  1771. X] [
  1772. X.B \-s subject
  1773. X] [
  1774. X.B \-xn set debug-level n
  1775. X] [
  1776. X.B \-u ascii encode program
  1777. X]
  1778. X.I mail-path[,mailpath] 
  1779. X.I files [files] ...
  1780. X.SH DESCRIPTION
  1781. X.\" ---------------------------------------------------------------
  1782. X.\" This defines appropriate quote strings for nroff and troff
  1783. X.ds lq \&"
  1784. X.ds rq \&"
  1785. X.if t .ds lq ``
  1786. X.if t .ds rq ''
  1787. X.\" Just in case these number registers aren't set yet...
  1788. X.if \nN==0 .nr N 10
  1789. X.if \nD==0 .nr D 5
  1790. X.\" ---------------------------------------------------------------
  1791. X.I Mailsplit
  1792. Xis a program to package, compress, document, transmit, and re-assemble
  1793. Xmultiple files and directories to other users via electronic mail.
  1794. XMailsplit uses tar(1), compress(1), split(1) and mail(1) to send the files,
  1795. Xand awk(1) to re-assemble them at the receiving side.  Mailsplit attempts to
  1796. Xpreserve the integrity, structure, mode, protection, and ownership of the
  1797. Xtransmitted directories.
  1798. X.SH OPTIONS
  1799. XCommand line options can be used to override the default options in the source
  1800. Xcode of
  1801. X.I mailsplit.
  1802. XOptions and flags can be specified in any order on the command line.
  1803. XThe first non-option or flag token on the command line is interpretted
  1804. Xto be the mail path whither the data should be sent.  All other
  1805. Xnon-option or flag tokens are considered files or directories to be
  1806. Xsent.  Since the program is a shell-script, users might want to tune
  1807. Xthe defaults for their sites.  All suggestions, improvements,
  1808. Xbug-reports, etc. would be greatly appreciated.  Send them to
  1809. Xwyle@ethz.uucp.
  1810. X.IP -N
  1811. Xtells mailsplit Not to send the joinr script prepended to the first
  1812. Xmessage.  The default is to prepend your version of the joinr script
  1813. Xwith each mailsplit batch sent.  Use this option to suppress sending
  1814. Xthe joinr script.  This option is useful if one is sending directories
  1815. Xto a recipient who already has the mailsplit package installed on her
  1816. Xsystem.
  1817. X.IP -V
  1818. Xsets the 
  1819. X.I verbose 
  1820. Xoption, and is equivilant to -x9 (maximum debugging).  When this option is
  1821. Xset,
  1822. X.I mailsplit
  1823. Xwill echo everything he does while he's doing it.  This option will generate
  1824. Xan awful lot of useless debugging information and is not recommended unless
  1825. Xyou are debugging.
  1826. X.IP -n
  1827. Xputs
  1828. X.I mailsplit
  1829. Xinto "test" mode.  This mode is analogous to make(1) -n where
  1830. X.I mailsplit
  1831. Xtells you which commands he would have issued without actually doing anything.
  1832. XThis mode is also good for debugging, or when you're curious what mailsplit
  1833. Xmight do with a complicated path or directory.
  1834. X.IP -t
  1835. Xsame as -n
  1836. X.IP -v
  1837. Xdisplays version number and exits.  This option is useful only for finding out
  1838. Xwhich version / patch level your mailsplit is.
  1839. X.IP -A
  1840. Xwill use the generic name "archive" for the subject instead of a long
  1841. Xpathname.
  1842. X.IP -C compress program
  1843. Xtells
  1844. X.I mailsplit
  1845. Xto use the next argument as the program to use instead of compress(1)
  1846. Xfor compressing the archive stream.  In some circumstances, using
  1847. Xcompress(1) may expand the size of a stream, in which case one would
  1848. Xmight want to use cat(1) to send the archive through unchanged.  The author is
  1849. Xdubious of this option.
  1850. X.IP -D directory
  1851. Xinstructs
  1852. X.I mailsplit
  1853. Xto use
  1854. X.I directory
  1855. Xinstead of /tmp for temporary files created during the archival, compression,
  1856. Xand encoding process.  This option is necessary if there is very little space
  1857. Xin /tmp, one is sending very large directories, or the file tree on this
  1858. Xsystem is bizare.
  1859. X.IP -M mailer options
  1860. XWhen this option is used,
  1861. X.I mailsplit
  1862. Xpasses the
  1863. X.I mailer options
  1864. Xargument(s) to the mail program.  Some mailers need options to get the job
  1865. Xdone (we won't mention an infamous X.400 mailer).  Other times, one would
  1866. Xprefer to set options for efficiency, tell the mailer not to run
  1867. Xinteractively, etc.  To set more than one option, enclose
  1868. X.I mailer options
  1869. Xin quotes.  Be careful about the shell's eating quotes.  One might have to
  1870. Xexperiment a bit to set all the options needed or desired. 
  1871. X.IP -T archive program
  1872. XIf this option is set,
  1873. X.I mailsplit
  1874. Xuses
  1875. X.I archive program
  1876. Xinstead of tar(1) to archive all the files and directories.  If the system
  1877. Xdoes not have tar(1), it is unlikely that
  1878. X.I mailsplit
  1879. Xwill work.  On the other hand, tar(1) expands binary files enormously, so one
  1880. Xmight substitute cat(1) instead of tar(1) to reduce the size of the archive.
  1881. X.IP -b compress-bits
  1882. Xuses
  1883. X.I b
  1884. Xbits for compression.  Some e-mail reachable users have bizare
  1885. XLempel-Ziv implementations or flakey hardware which requires fewer than
  1886. Xthe BSD default 16 bits for the common compression string code.  The
  1887. Xdefault value of this parameter is set to 12 when mailsplit is
  1888. Xdistributed, which seems to be pretty universal.  If one knows that the
  1889. Xdata are being sent to a BSD site or a site with 16-bit compression,
  1890. Xone should change the default in the code to 16.
  1891. X.IP -d seconds
  1892. Xtells
  1893. X.I mailsplit
  1894. Xto wait
  1895. X.I seconds
  1896. Xseconds after each time he invokes the mailer.  Some mailers (a certain
  1897. XX.400 system with "MTA congestion problems" will remain nameless) have
  1898. Xproblems dealing with sudden, large bursts of messages.  One might want
  1899. Xto set the default in the code to some non-zero value if the mailer on
  1900. Xhis system has such problems.  If
  1901. X.I mailsplit
  1902. Xis usually used for small directories, and the default delay is small,
  1903. Xone should use this flag to set the delay higher if a large number of files or
  1904. Xlarge directory is sent.
  1905. X.IP -l lines
  1906. XThis option sets the maximum number of lines for a single mail
  1907. Xmessage.  The default as distributed is set to keep a message smaller
  1908. Xthan 60 Kilobytes.  See the discussion below.  One might want to set
  1909. Xthe default higher, and use this option to set a smaller number when
  1910. Xsending mail through mailers which don't like large messages.  (A
  1911. Xcertain X.400 mailer...)  Remember that if the archive pieces have to pass
  1912. X.I through
  1913. Xa mailer which wants small messages, the lines size must be set smaller.
  1914. X.IP -m mailer
  1915. XIf the system on which
  1916. X.I mailsplit
  1917. Xis running has more than one mailer (user agent) one can use this flag
  1918. Xto choose a mailer other than the default (/usr/ucb/Mail as
  1919. Xdistributed).  
  1920. X.IP -r parts
  1921. XThe -r(esend) option is used to re-send pieces which became lost in the
  1922. Xwide-area mail networks.
  1923. X.I parts
  1924. Xis a list of pieces to be re-sent to the recipient.
  1925. X.I Parts
  1926. Xcan be a comma-separated list, or numbers between dashes, or just one number
  1927. Xand a dash, or any combination.  The formal BNF of
  1928. X.I parts
  1929. Xis:
  1930. X.nf
  1931. X.br
  1932. X
  1933. Xparts :== <number>
  1934. X      |   number,parts
  1935. X      |   number-number
  1936. X      |   number-
  1937. X
  1938. Xnumber:== <digit>
  1939. X      |   <digit><number>
  1940. X
  1941. Xdigit :== 0|1|2|3|4|5|6|7|8|9
  1942. X
  1943. X.br
  1944. X.fi
  1945. XOnly those pieces in
  1946. X.I parts
  1947. Xwill be sent.  This option is useful for re-transmitting part 3 of 27 instead
  1948. Xof having to re-transmit all 27 pieces.  One must be sure that the other
  1949. Xoptions are set
  1950. X.I exactly the same
  1951. Xas the first transmission, including line-length, etc.
  1952. X.IP -s subject
  1953. Xsets the subject to
  1954. X.I subject
  1955. Xinstead of using the first file argument for the subject of each mail message
  1956. Xgenerated.
  1957. X.IP -xn
  1958. Xsets the debugging level to n, where n is a number from 0 to 9.  The higher
  1959. Xthe number, the more debug output.  Setting n to 0 causes
  1960. X.I mailsplit
  1961. Xto work silently.  No output will be sent to standard out, and only failure
  1962. Xmessages will be sent to standard error.  Setting n to 9 is equivilant to -V
  1963. X(verbose), and gives maximum debug output.
  1964. X.IP u encoding program
  1965. XThis option sets the encoding program to something other than
  1966. Xuuencode(1c).  The encoding program must be able to take 8-bit binary
  1967. Xand produce 7-bit ASCII data.
  1968. X.SH DISCUSSION
  1969. X.PP
  1970. XA few
  1971. X.I de
  1972. X.I facto
  1973. Xstandards have evolved on wide-area (e-mail) networks to guarantee the safe
  1974. Xtransmission of information:
  1975. X.sp
  1976. X.IP -
  1977. XThe information must be text-only, i.e. 7-bit ASCII
  1978. X.IP -
  1979. XLines of text may not exceed 80 characters.  A message must therefore
  1980. Xcontain an end-of-line character at least after every 80 characters.
  1981. X.IP -
  1982. XA single message may not exceed 64 Kilobytes.
  1983. X.IP -
  1984. XLines of text starting with the word "From" will be translated
  1985. Xto ">From."
  1986. X.IP -
  1987. XBlank lines at the end of a mail message are deleted.
  1988. X.IP -
  1989. XA message containing a period "." on a line by itself will be terminated
  1990. Xabnormally.
  1991. X.PP
  1992. XUpon invocation, the program parses all flags and options, then looks
  1993. Xfor at least two parameters on the command line:  The e-mail path(s) of
  1994. Xthe receiver(s), and the file or directory name(s) to send.  If one or
  1995. Xboth of these parameters is missing, a help message is displayed with a
  1996. Xshort "usage" description and an example.
  1997. X.PP
  1998. XThe directories or files are recursively archived and compressed into a
  1999. Xtemporary binary file.  The binary file is then sent through uuencode
  2000. Xso that it is encoded into 7-bit ASCII with end-of-lines every 79
  2001. Xcharacters.  The resulting ASCII file is then split into several
  2002. Xdifferent files, each of which is smaller than 64 Kilobytes.
  2003. X.PP
  2004. XThe first file is prepended with instructions as well as the program
  2005. Xneeded to unpackage the transmitted message or messages.  All messages
  2006. Xare pre- and post-pended with special start and end text, to assist both
  2007. Xthe person receiving the message and the unpackaging program.  Finally,
  2008. Xeach message is sent via electronic mail to the recipient, and all
  2009. Xtemporary files are deleted.
  2010. X.PP
  2011. XDuring these operations, status information is displayed after each
  2012. Xsuccessful step.  If there are no files to send, an error message is
  2013. Xdisplayed.
  2014. X.PP
  2015. XAt the receiving end, a first-time user must extract the unpackaging
  2016. Xprogram from the first e-mail message, and make the program available
  2017. Xfor his use.  A user must perform this step only once, as the packaging
  2018. Xformat should not change.  Depending on the size of the transmitted files
  2019. Xor directories, the receiver may get one or several mail messages.  The
  2020. Xmessages contain subject headers of the form:
  2021. X.br
  2022. X.\" .nf
  2023. X.sp
  2024. X"--- start of <package> part <n> of <m>"
  2025. X.sp
  2026. X.br
  2027. Xwhere <package> is the first file or directory name, <m> is the total
  2028. Xnumber of messages into which the package was split, and <n> is in the
  2029. Xrange 1 to m.
  2030. X.PP
  2031. XThe receiver must then send all of the parts through the unpackaging
  2032. Xprogram in their proper order.  This is accomplished either from within
  2033. Xthe mail reading program, or by saving the messages into a file and
  2034. Xinvoking the unpackaging program on the saved file.  Because e-mail
  2035. Xsystems will often deliver messages out of order, the re-assembler
  2036. Xprogram detects and corrects when pieces are sent through it repeatedly
  2037. Xor out of order.  Only the first part number <n> is used; all others are
  2038. Xignored.
  2039. X.PP
  2040. XThe re-assembler program first filters out repeated pieces and sorts
  2041. Xthem into their correct order before it joins them together to decode,
  2042. Xuncompress, and extract the individual files or directories.
  2043. X.SH EXAMPLES
  2044. X.LP
  2045. X% mailsplit wyle@ethz.uucp /etc/hosts
  2046. X.LP
  2047. X% mailsplit wyle@ethz.uucp sources -r 5,7,17-21
  2048. X.LP
  2049. X% mailsplit -l 700 -x9 wyle@ethz.uucp goodies -s "examples"
  2050. X.LP
  2051. X% mailsplit -l 700 -x9 -r 19- wyle@ethz.uucp goodies
  2052. X
  2053. X.SH AUTHOR
  2054. XMitchell F. Wyle  (wyle@ethz.uucp)
  2055. X.SH BUGS
  2056. X.LP
  2057. XBSD specific?
  2058. X.LP
  2059. XRe-assembler should accept pieces out of order
  2060. X.LP
  2061. XShould be packaged with a configurer, makefile, install script
  2062. X.SH "SEE ALSO"
  2063. Xsplit(1), tar(1), mail(1), uuencode(1), uudecode(1), compress(1),
  2064. Xawk(1), sh(1)
  2065. END_OF_FILE
  2066. if test 11634 -ne `wc -c <'mailsplit.1'`; then
  2067.     echo shar: \"'mailsplit.1'\" unpacked with wrong size!
  2068. fi
  2069. # end of 'mailsplit.1'
  2070. fi
  2071. echo shar: End of shell archive.
  2072. exit 0
  2073.  
  2074.  
  2075.