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

  1. Listing Three
  2.  
  3. upld
  4.  
  5.  
  6.  
  7.     # verify that a file name has been entered (in argument 1 - $1)
  8.  
  9. 1    if [ -n "$1" ]
  10. 2    then
  11.  
  12.     # verify that a file with the same name isn't already stored in the Uploads directory
  13.  
  14. 3        if [ -f /u/bbs/Uploads/$1 ]
  15. 4        then
  16.  
  17.     # the file name already exists
  18. 5            echo "Please give your file another name.  $1 already exists."
  19. 6        else
  20.  
  21.     # collect the file transfer protocol
  22.  
  23. 7            echo 'who am i | cut -f1 -d" " ' 'date | cut -c1-16' "upld" $1 >>/u/bbs/log.file
  24. 8            echo "Transfer protocol (X = Xmodem; A = ASCII): \c"
  25. 9            read method
  26. 10            if [ "$method" = X -o "$method" = x ]
  27. 11            then
  28.  
  29.     # receive a binary file using the XModem protocol
  30.  
  31. 12                xmodem -rb /u/bbs/Uploads/$1
  32. 13            else
  33.  
  34.     # receive an ASCII file
  35.  
  36. 14                echo
  37. 15                echo "Begin sending ASCII file."
  38. 16                echo "Type a CNTRL-d when finished transmitting."
  39. 17                echo
  40. 18                cat > /u/bbs/Uploads/temp
  41. 19                cp /u/bbs/Uploads/temp /u/bbs/Uploads/$1
  42. 20            fi
  43.  
  44.     # collect the file description
  45.  
  46. 21            echo "Please enter a one line description of your file."
  47. 22            read desc
  48. 23            echo $1 $desc >>/u/bbs/Uploads/Doc.file
  49. 24        fi
  50. 25    else
  51.     # no file name was entered
  52.  
  53. 26        echo "Please enter the name of the file you wish to upload on"
  54. 27        echo "the command line."
  55. 28    fi
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.