home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / armlinux / alpha / PARTITIONS / USR_GZ / usr / lib / trn / Pnews.header < prev    next >
Encoding:
Text File  |  1995-05-14  |  4.8 KB  |  209 lines

  1. case $# in
  2. 0)
  3.     ng=h
  4.     while $test "X$ng" = Xh ; do
  5.     $echo ""
  6.     $echo $n "Newsgroup(s): $c"
  7.     read ng
  8.     case $ng in
  9.     h)
  10.         $cat <<'EOH'
  11.  
  12. Type the name of one or more newsgroups to which you wish to post an article.
  13. If you want to post to multiple newsgroups, it is better to do them all at
  14. once than to post to each newsgroup individually, which defeats the news
  15. reading programs' strategies of eliminating duplicates.
  16.  
  17. Separate multiple newsgroup names with commas.
  18. EOH
  19.         ;;
  20.     esac
  21.     done
  22.     ;;
  23. *)
  24.     ng=$1
  25.     shift
  26.     ;;
  27. esac
  28. case $ng in
  29. *\ *)
  30.     ng=`$echo "$ng" | $sed 's/[, ] */,/g'`
  31.     ;;
  32. esac
  33. case $ng in
  34. ddn.*)
  35.     defdist=inet
  36.     dist=h
  37.     ;;
  38. *.*)
  39.     defdist=''
  40.     dist=h
  41.     ;;
  42. *)
  43.     defdist=''
  44.     dist=''
  45.     ;;
  46. esac
  47.  
  48. while $test "X$dist" = Xh ; do
  49.     if $test -f $lib/distributions; then
  50.     $echo " "
  51.     $echo "Your local distribution prefixes are:"
  52.     $cat $lib/distributions
  53.     $echo " "
  54.     else
  55.     $egrep -v '[     ]none$' <<EOM
  56.  
  57. Your local distribution prefixes are:
  58.     Local organization:    $loc
  59.     Organization:    $org
  60.     City:        $city
  61.     $Stpr:          $state
  62.     $multistpr:    $multistate
  63.     Country:        $cntry
  64.     Continent:        $cont
  65.     Everywhere:        <null> (not "world")
  66.  
  67. EOM
  68.     fi
  69.     $echo $n "Distribution ($defdist): $c"
  70.     read dist
  71.     case $dist in
  72.     '') dist="$defdist" ;;
  73.     esac
  74.     case "$dist" in
  75.     h)
  76.     $cat <<'EOH'
  77.  
  78. The Distribution line may be used to limit the distribution of an article
  79. to some subset of the systems that would receive the article based only on
  80. the Newsgroups line.  For example, if you want to sell your car in talk.auto,
  81. and you live in New Jersey, you might want to put "nj" on the Distribution
  82. line to avoid advertising in California, which has enough problems of its own.
  83. The actual area designators to use depend on where you are, of course.
  84. EOH
  85.     ;;
  86.     world*|comp*|news*|sci*|rec*|misc*|soc*|talk*|alt*)
  87.     dist=''
  88.     ;;
  89.     ''|$loc|$org|$city|$state|$multistate|$cntry|$cont|$defdist)
  90.     ;;
  91.     *)  
  92.     if $test -f $lib/distributions && \
  93.       $egrep "^$dist[     ]" $lib/distributions >$tmpart && \
  94.       $test -s $tmpart; then
  95.         : null
  96.     else
  97.         $echo "Unrecognized distribution prefix--type h for help, CR to use anyway."
  98.         defdist=$dist
  99.         dist=h
  100.     fi
  101.     ;;
  102.     esac
  103. done
  104.  
  105. follow=""
  106.  
  107. # LCP 16-Oct-91 Subject line is required.  Make it a little more
  108. # difficult to omit.  Added "while : ; do", ... "done", and "if"
  109. # at end of while loop.
  110. while : ; do
  111.   case $# in
  112.   0)
  113.     title=h
  114.     while $test "X$title" = Xh ; do
  115.     $echo ""
  116.     $echo $n "Title/Subject: $c"
  117.     read title
  118.     case $title in
  119.     h)
  120.         $cat <<'EOH'
  121.  
  122. Type the title for your article.  Please make it as informative as possible
  123. (within reason) so that people who aren't interested won't have to read the
  124. article to find out they aren't interested.  This includes marking movie
  125. spoilers as (spoiler), and rotated jokes as (rot 13).
  126. EOH
  127.     ;;
  128.     esac
  129.     done
  130.     ;;
  131.   *)
  132.     title="$*"
  133.     # LCP 16-Oct-91 Added "set" and "shift".  Must insure $# is 0
  134.     # in case the title is all white space and we make another
  135.     # pass thru this loop.
  136.     set X
  137.     shift
  138.     ;;
  139.   esac
  140.   if expr "X$title" : "^X[    ]*$" > /dev/null 2>&1
  141.   then
  142.     $cat <<'EOH'
  143.  
  144. Articles without a "Subject:" line will not be accepted by the News
  145. system.  Please give a Title/Subject line for your article.
  146. EOH
  147.   else
  148.      break
  149.   fi
  150. done
  151.  
  152.  
  153. # now build a file with a header for them to edit
  154.  
  155. set X ${USER-${LOGNAME-`$who am i`}}
  156. shift
  157. logname=$1
  158. case $logname in
  159. *!*) logname=`expr "$logname" : '!\(.*\)$'` ;;
  160. esac
  161. case ${NAME-$nametype} in
  162. bsd)
  163.     if $test "X$ypmatch" != X; then
  164.         fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/"`
  165.     elif $test "X$nidump" != X; then
  166.         fullname=`$nidump passwd / | $sed -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  167.     fi
  168.     if $test "X$fullname" = X; then
  169.         fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^,:;]*\).*"'$'"/\1/" -e "q" -e "}" -e "d"`
  170.     fi
  171.     case $fullname in
  172.     *'&'*) : GACK
  173.     lname=`$echo $logname | $tr 'a-z' 'A-Z'`
  174.     lname=`$echo $lname $logname | $sed 's/^\(.\)[^ ]* ./\1/'`
  175.     fullname=`$echo "$fullname" | $sed "s/&/${lname}/"`
  176.     ;;
  177.     esac
  178.     ;;
  179. usg)
  180.     if $test "X$ypmatch" != X; then
  181.     fullname=`$ypmatch $logname passwd 2>/dev/null | $sed -e "s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q"`
  182.     fi
  183.     if $test "X$fullname" = X; then
  184.     fullname=`$sed </etc/passwd -e "/^$logname:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:\([^(:]*\).*"'$'"/\1/" -e "s/^.*-//" -e "q" -e "}" -e "d"`
  185.     fi
  186.     ;;
  187. *)
  188.     fullname=${NAME-`$cat $dotdir/.fullname`}
  189.     ;;
  190. esac
  191.  
  192. case $orgname in
  193. /*) orgname=`$cat $orgname` ;;
  194. esac
  195.  
  196. $sed -e '/^Reply-To: $/d' > $tmpart <<EOHeader
  197. Newsgroups: $ng
  198. Subject: $title
  199. Summary: 
  200. Reply-To: $REPLYTO
  201. Followup-To: $follow
  202. Distribution: $dist
  203. Organization: $orgname
  204. Keywords: 
  205. Cc: 
  206.  
  207. EOHeader
  208.  
  209.