home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1987 / 06 / bbs.l5 < prev    next >
Text File  |  1987-05-05  |  1KB  |  71 lines

  1. Listing Five
  2.  
  3. send
  4.  
  5.  
  6.  
  7. 1    echo 'who am i | cut -f1 -d" " ' 'date | cut -c1-16' "send" >>/u/bbs/log.file
  8. 2    SCAN=/u/bbs/msg/.index
  9. 3    LAST=/u/bbs/.last
  10. 4    MSG=/u/bbs/msg
  11. 5    L='cat $LAST'
  12. 6    D='date'
  13.  
  14.     # increment the number of the last message entered
  15.  
  16. 7    L='expr $L + 1'
  17.  
  18.     # save the new "last message" value
  19.  
  20. 8    echo $L >$LAST
  21. 9    echo
  22.  
  23.     # collect message header information
  24.  
  25. 10    echo "To: \c"
  26. 11    read to
  27. 12    echo "Subject: \c"
  28. 13    read subject
  29. 14    echo "From: \c"
  30. 15    read who
  31. 16    trap 'rm -f $MSG/$L;continue' 2 3
  32. 17    ech
  33. 18    echo "Start typing your message.  You have 20 lines available."
  34. 19    echo "Type a period on a new line to end the message."
  35. 20    echo
  36.  
  37.     # store the message header in the message file
  38.  
  39. 21    echo "# $L  From: $who  $D" >$MSG/$L
  40. 22    echo "  To: $to" >>$MSG/$L
  41. 23    echo "  Subject: $subject" >>$MSG/$L
  42. 24    echo >>$MSG/$L
  43.  
  44.     # collect the body of the message
  45.  
  46. 25    NL=0
  47. 26    read newline
  48. 27    while [ "$newline" != "." -a "$NL" -lt 20 ]
  49. 28    do
  50. 29        echo $newline >>$MSG/$L
  51. 30        NL='expr $NL + 1'
  52. 31        read newline
  53. 32    done
  54. 33    echo
  55.  
  56.     # update the message index for use by the scan command
  57.  
  58. 34    echo "Message being posted, please wait... \c"
  59. 35    echo "# $L From: $who  $D" >>$MSG/temp
  60. 36    echo "  To: $to" >>$MSG/temp
  61. 37    echo "  Subject: $subject" >>$MSG/temp
  62. 38    echo    " " >>$MSG/temp
  63. 39    cat $SCAN >>$MSG/temp
  64. 40    mv $MSG/temp $SCAN
  65. 41    echo
  66.  
  67.  
  68.  
  69.  
  70.  
  71.