home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume39 / slurp / part03 < prev    next >
Encoding:
Text File  |  1993-08-21  |  6.4 KB  |  248 lines

  1. Newsgroups: comp.sources.misc
  2. From: steveh@orbital.demon.co.uk (Stephen Hebditch)
  3. Subject: v39i039:  slurp - A passive NNTP transfer client, v1.08, Part03/03
  4. Message-ID: <1993Aug22.013251.28647@sparky.sterling.com>
  5. X-Md4-Signature: 435ec2b2056796af11bef56b6edceaf1
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Sun, 22 Aug 1993 01:32:51 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: steveh@orbital.demon.co.uk (Stephen Hebditch)
  12. Posting-number: Volume 39, Issue 39
  13. Archive-name: slurp/part03
  14. Environment: ANSI-C, UNIX
  15. Supersedes: slurp: Volume 36, Issue 13-14
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  fakesyslog.h slurp.sys time.c
  22. # Wrapped by kent@sparky on Sat Aug 21 20:28:15 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 3 (of 3)."'
  26. if test -f 'fakesyslog.h' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'fakesyslog.h'\"
  28. else
  29.   echo shar: Extracting \"'fakesyslog.h'\" \(953 characters\)
  30.   sed "s/^X//" >'fakesyslog.h' <<'END_OF_FILE'
  31. X/*
  32. X * Fake syslog definitions.
  33. X *
  34. X * @(#)fakesyslog.h    1.1    (Berkeley) 12/18/87
  35. X */
  36. X
  37. X#ifdef FAKESYSLOG
  38. X
  39. X/*
  40. X *  Facility codes
  41. X */
  42. X
  43. X#define LOG_KERN    0
  44. X#define LOG_USER    0
  45. X#define LOG_MAIL    0
  46. X#define LOG_DAEMON    0
  47. X#define LOG_AUTH    0
  48. X#define LOG_SYSLOG    0
  49. X#define LOG_LPR        0
  50. X#define LOG_NEWS    0
  51. X#define LOG_LOCAL0    0
  52. X#define LOG_LOCAL1    0
  53. X#define LOG_LOCAL2    0
  54. X#define LOG_LOCAL3    0
  55. X#define LOG_LOCAL4    0
  56. X#define LOG_LOCAL5    0
  57. X#define LOG_LOCAL6    0
  58. X#define LOG_LOCAL7    0
  59. X
  60. X#define LOG_NFACILITIES    0
  61. X#define LOG_FACMASK    0
  62. X
  63. X/*
  64. X *  Priorities
  65. X */
  66. X
  67. X#define LOG_EMERG    0
  68. X#define LOG_ALERT    0
  69. X#define LOG_CRIT    0
  70. X#define LOG_ERR        0
  71. X#define LOG_WARNING    0
  72. X#define LOG_NOTICE    0
  73. X#define LOG_INFO    0
  74. X#define LOG_DEBUG    0
  75. X
  76. X#define LOG_PRIMASK    0
  77. X
  78. X/*
  79. X * arguments to setlogmask.
  80. X */
  81. X
  82. X#define    LOG_MASK(pri)    0
  83. X#define    LOG_UPTO(pri)    0
  84. X
  85. X/*
  86. X *  Option flags for openlog.
  87. X */
  88. X
  89. X#define    LOG_PID        1
  90. X#define    LOG_CONS    0
  91. X#define    LOG_ODELAY    0
  92. X#define LOG_NDELAY    0
  93. X#define LOG_NOWAIT    0
  94. X
  95. X#endif FAKESYSLOG
  96. END_OF_FILE
  97.   if test 953 -ne `wc -c <'fakesyslog.h'`; then
  98.     echo shar: \"'fakesyslog.h'\" unpacked with wrong size!
  99.   fi
  100.   # end of 'fakesyslog.h'
  101. fi
  102. if test -f 'slurp.sys' -a "${1}" != "-c" ; then 
  103.   echo shar: Will not clobber existing file \"'slurp.sys'\"
  104. else
  105.   echo shar: Extracting \"'slurp.sys'\" \(1205 characters\)
  106.   sed "s/^X//" >'slurp.sys' <<'END_OF_FILE'
  107. X# slurp.sys - which newsgroups we wish to take from each NNTP server
  108. X#
  109. X# Format is
  110. X#   hostname/sublist:groups/distributions:flags:username/password
  111. X#
  112. X# * Entries for a particular host can be continued on more than one
  113. X#   line by using a '\' at the end of the line.
  114. X# * There is no limit on the length of each line.
  115. X# * Whitespace is only allowed in comments - nowhere else!
  116. X# * Comments begin with a '#'.
  117. X# * Distributions are *not* recommended if you want a reasonable
  118. X#   throughput and don't want to increase the server load too much...
  119. X# * Possible flags are
  120. X#      i  don't load /save unretrieved messsage IDs
  121. X#      l  use local time, not that at the server
  122. X#      r  do a 'mode reader' command
  123. X# * If username/password are supplied then they will be used with the
  124. X#   NNTP simple authorisation protocol.
  125. X#      
  126. X
  127. X# Demon feed
  128. Xnews.demon.co.uk:demon*,!demon.msdos.announce,alt.fan.chicken.wrestling,\
  129. Xuk.*,!uk.net.maps,rec.video.satellite,comp.unix.sys5.r4,\
  130. Xrec.arts.tv.uk,ba.broadcast
  131. X
  132. X# Orbital feed #1
  133. Xorbital.demon.co.uk/1:cix.*,alt.bbs.*,!alt.bbs.lists*
  134. X
  135. X# Orbital feed #2
  136. Xorbital.demon.co.uk/2:rec.radio.*,alt.bbs,alt.bbs.internet,alt.irc,\
  137. Xnews.software.*:il:newserv/lick21
  138. X
  139. X# END OF FILE
  140. END_OF_FILE
  141.   if test 1205 -ne `wc -c <'slurp.sys'`; then
  142.     echo shar: \"'slurp.sys'\" unpacked with wrong size!
  143.   fi
  144.   # end of 'slurp.sys'
  145. fi
  146. if test -f 'time.c' -a "${1}" != "-c" ; then 
  147.   echo shar: Will not clobber existing file \"'time.c'\"
  148. else
  149.   echo shar: Extracting \"'time.c'\" \(1691 characters\)
  150.   sed "s/^X//" >'time.c' <<'END_OF_FILE'
  151. X/*
  152. X * time - obtain the time from the remote server
  153. X *
  154. X * Copyright (C) 1992/93 Stephen Hebditch. All rights reserved.
  155. X * TQM Communications, BCM Box 225, London, WC1N 3XX.
  156. X * steveh@orbital.demon.co.uk  +44 836 825962
  157. X *
  158. X * See README for more information and disclaimers
  159. X *
  160. X * Obtain the current time from the remote server in standard unix time
  161. X * format for use with the next NEWNEWS. If the client is unable to
  162. X * connect to the time server or the read fails then the error is
  163. X * reported and the program is exited.
  164. X *
  165. X * $Id: time.c,v 1.7 1993/06/07 11:20:27 root Exp $
  166. X *
  167. X * $Log: time.c,v $
  168. X * Revision 1.7  1993/06/07  11:20:27  root
  169. X * Removed unistd.h inclusion.
  170. X * Display time since epoch at server as unsigned.
  171. X *
  172. X * Revision 1.5  1993/03/01  18:09:12  root
  173. X * Made the epoch constant an unsigned long.
  174. X *
  175. X * Revision 1.4  1993/02/14  15:10:01  root
  176. X * No changes.
  177. X *
  178. X * Revision 1.0  1992/08/92
  179. X * Initial coding.
  180. X *
  181. X */
  182. X
  183. X#include "slurp.h"
  184. X
  185. X#include <netinet/in.h>
  186. X
  187. X
  188. X    time_t
  189. Xserver_time (char *hostname)
  190. X    {
  191. X    int server, ret;
  192. X    u_long timebuf;
  193. X
  194. X/* First open the socket */
  195. X
  196. X    if ((server = tcp_open (hostname, "time")) < 0)
  197. X        return ((time_t) 0);
  198. X
  199. X    ret = read (server, &timebuf, 4);
  200. X
  201. X/* Close the socket and check we got 4 bytes */
  202. X
  203. X    (void) close (server);
  204. X
  205. X    if (ret != 4)
  206. X        {
  207. X        log_ret ("server_time: Read error on time server socket");
  208. X        return ((time_t) 0);
  209. X        }
  210. X
  211. X/* Convert byte order if needed */
  212. X
  213. X    timebuf = ntohl (timebuf);
  214. X
  215. X    if (debug_flag)
  216. X        (void) fprintf (stderr, "time is currently %lu at server %s\n",
  217. X                        timebuf, hostname);
  218. X
  219. X/* Convert the time from seconds since 1900 to seconds since 1970 */
  220. X
  221. X    return ((time_t) (timebuf - 2208988800UL));
  222. X    }
  223. X
  224. X/* END-OF-FILE */
  225. END_OF_FILE
  226.   if test 1691 -ne `wc -c <'time.c'`; then
  227.     echo shar: \"'time.c'\" unpacked with wrong size!
  228.   fi
  229.   # end of 'time.c'
  230. fi
  231. echo shar: End of archive 3 \(of 3\).
  232. cp /dev/null ark3isdone
  233. MISSING=""
  234. for I in 1 2 3 ; do
  235.     if test ! -f ark${I}isdone ; then
  236.     MISSING="${MISSING} ${I}"
  237.     fi
  238. done
  239. if test "${MISSING}" = "" ; then
  240.     echo You have unpacked all 3 archives.
  241.     rm -f ark[1-9]isdone
  242. else
  243.     echo You still must unpack the following archives:
  244.     echo "        " ${MISSING}
  245. fi
  246. exit 0
  247. exit 0 # Just in case...
  248.