home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume1 / 8711 / 20 < prev    next >
Internet Message Format  |  1990-07-13  |  4KB

  1. Path: uunet!husc6!hao!ames!necntc!ncoast!allbery
  2. From: joe@hanauma.stanford.edu (Joe Dellinger)
  3. Newsgroups: comp.sources.misc
  4. Subject: fake inews
  5. Message-ID: <5822@ncoast.UUCP>
  6. Date: 26 Nov 87 04:34:39 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Lines: 89
  9. Approved: allbery@ncoast.UUCP
  10. X-Archive: comp.sources.misc/8711/20
  11.  
  12.  
  13.     Here is a shell I put together a few months ago to allow me to post
  14. news from my Sun. I don't really have news at all on my machine. I just managed
  15. to find a remote site I can nfs the news stuff from, and installed "rn" to read it
  16. with. This shell version of "inews" is short, sweet, and works fine.
  17.  
  18.     People will need to slightly customize it for their site, but it is
  19. easily understandable I think.
  20.  
  21.     - Joe Dellinger, Stanford Exploration Project
  22.  
  23.  
  24.  
  25. #!/bin/sh
  26. # A common situation is for a machine to use NFS to mount /usr/spool/news
  27. # remotely from another machine. This lets you read news via rn,
  28. # but it does not let you post news, since you have no inews program for
  29. # Pnews to call.
  30. # This shell will let you post mail by sendmailing it to another machine.
  31. # It was written to run on Suns, but can probably be made to work on other machines.
  32. #
  33. # You will have to replace the name "oopsvax" with the name of a machine you
  34. # can send mail to that has rnews. (We use labrea, but you shouldn't unless you
  35. # are at Stanford). You will need to replace "mailhandler?" with the name of
  36. # the machine where you get mail (or use the commented out versions of the
  37. # lines if the machine you post from is also the machine you get your mail on).
  38. #
  39. # You will need to create the file /usr/lib/news/counter
  40. # (or wherever you decide to put it) to count message numbers.
  41. # It should start out containing the number "1".
  42. #
  43. # A copy of your article will be left in your home directory, called "article".
  44. #
  45. # You may want to change the return address, path, etc, for your site.
  46. #
  47. # By Joe Dellinger, Stanford Exploration Project, Stanford University, May 1987
  48. # further hacking by Conor Rafferty
  49. #
  50.  
  51. #initialization
  52. counter=/usr/lib/news/counter            # file with article counter
  53. userart=$HOME/article
  54. oopsvax=labrea                    # machine that has the real inews
  55. mailhandlerl=arfsnargle.stanford.edu        # long version of name
  56. mailhandlers=arfsnargle                # short version of name
  57. itmp=/tmp/itmp$$
  58. trap "rm -f /tmp/itmp*" 0 1 2 3 13 15
  59.  
  60. #host and user name. Try the password file, then the yellow pages muck.
  61. if test "$hostname" = "" ; then hostname=`hostname`; fi
  62. passline=`grep :$USER: /etc/passwd` ||
  63. passline=`ypmatch $USER passwd.byname` ||
  64. passline=dummy:dummy:dummy:dummy:$USER
  65. export passline
  66. fullname="`(IFS=:;set $passline; echo $5)`"
  67.  
  68. # Grab stdin
  69. cat > $userart
  70. if \[ -f $HOME/.signature \] ; then
  71. cat $HOME/.signature >> $userart
  72. fi
  73.  
  74. # Increment the message ID number for this system
  75. number=`cat $counter`
  76. number=`expr $number + 1`
  77. echo $number > $counter
  78.  
  79. # simulate inews header
  80. # remote rnews does a lot of the work itself (date reformat, Lines)
  81. echo "Subject: network news posting"            > $itmp
  82. echo "To: rnews@$oopsvax"                      >> $itmp
  83. echo ""                                        >> $itmp
  84. echo "NPath: $mailhandlerl!$USER"                  >> $itmp  #path back to you
  85. #echo "NPath: $hostname!$USER"                  >> $itmp  #path back to you
  86. echo "NFrom: $USER@$mailhandlerl ($fullname)" >> $itmp  #want the full name
  87. #echo "NFrom: $USER@$hostname.UUCP ($fullname)" >> $itmp  #want the full name
  88. echo "NMessage-ID: <$number@$hostname.UUCP>"   >> $itmp  #rnews junks it otherwise
  89. echo "NDate: `date`"                           >> $itmp  #ditto
  90.  
  91. #stuff in the user input
  92. sed 's/^/N/' $userart                          >> $itmp
  93.  
  94.  
  95. # Send it off to $oopsvax to be posted
  96. /usr/lib/sendmail -i rnews%$oopsvax@$mailhandlers < $itmp
  97. #/usr/lib/sendmail -i rnews@$oopsvax < $itmp
  98.  
  99. # That's it. The article is left in your home directory.
  100.