home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2381 < prev    next >
Encoding:
Internet Message Format  |  1990-12-28  |  8.1 KB

  1. From: purdon@athena.mit.edu (James R. Purdon III)
  2. Newsgroups: alt.sources
  3. Subject: slugnet - Multiple user conferencing system: Part 6 of 6
  4. Message-ID: <1990Dec20.165044.25733@athena.mit.edu>
  5. Date: 20 Dec 90 16:50:44 GMT
  6.  
  7. The slugnet program is a multiple-user, interactive conferencing
  8. facility.  It currently runs under a variety of System V-based and
  9. BSD-based operating systems (although certain functions may not be
  10. possible under some of these operating systems).
  11.  
  12. Cut here----------------------------------------------------------
  13.  
  14. #!/bin/sh
  15. # to extract, remove the header and type "sh filename"
  16. if `test ! -s ./Makefile`
  17. then
  18. echo "writing ./Makefile"
  19. cat > ./Makefile << '\End\Of\Shar\'
  20. #
  21. # Makefile for slugnet package
  22. #
  23. # Where the unformatted man pages are
  24. #
  25. MAN = /usr/man/man1
  26. # Where the slugnet binary lives
  27. #
  28. SLUGBIN = /usr/local/bin
  29. #
  30. # Where the slugnet directory lives ( change slugnet.h to match )
  31. #
  32. SLUGDIR = /usr/users/slugnet
  33. #
  34. # who owns slugnet
  35. #
  36. SLUGUID = slugnet
  37. #
  38. # Select OS type 
  39. #
  40. # BSD 
  41. #
  42. # OS = -DBSD4
  43. #
  44. # SUNOS 
  45. #
  46. # OS = -DBSD4 -OSUNOS
  47. #
  48. # System V R2.x (slugnetd probably won't work)
  49. #
  50. # OS = -DSYSV2
  51. #
  52. # System V R3 (with BSD network extensions )
  53. #
  54. # OS = -DSYSV3
  55. #
  56. # System V R3 (with interlan network extensions )
  57. #
  58. # OS = -DSYSV3 -DINTERLAN
  59. # LDFLAGS = -ltcp
  60. # UNICOS
  61. #
  62. # OS = -DSYSV3 -DUNICOS
  63. # LDFLAGS = -lnet
  64. #
  65. # Ultrix 
  66. #
  67. OS = -DULTRIX
  68. #
  69. instructions:
  70.     @echo "make slugnet    Builds local program"
  71.     @echo "make slugnetd    Builds network server"
  72.     @echo "make install    Installs slugnet"
  73.     @echo "make clean    Removes objects"
  74. #
  75. # local program
  76. #
  77. slugnet: clean
  78.     @echo "Making slugnet..."
  79.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  80.     OS="$(OS)" ;SLUGNET=slugnet ;NETFLG="-DLOCAL" ;\
  81.     LDFLAGS=$(LDFLAGS) ;\
  82.     export LDFLAGS NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  83.     make -e -f slugnet.mk slugnet
  84.  
  85. #
  86. # network server
  87. #
  88. slugnetd: clean
  89.     @echo "Making slugnetd..."
  90.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  91.     OS="$(OS)" ;SLUGNET=slugnetd ;NETFLG="-DNETWORK" ;\
  92.     LDFLAGS=$(LDFLAGS) ;\
  93.     export LDFLAGS NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  94.     make -e -f slugnet.mk slugnetd
  95.  
  96. clean:
  97.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  98.     OS="$(OS)" ;SLUGNET=slugnet ;NETFLG="-DLOCAL" ;\
  99.     LDFLAGS=$(LDFLAGS) ;\
  100.     export LDFLAGS NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  101.     make -e -f slugnet.mk clean
  102.  
  103. install: local network
  104.  
  105. local: 
  106.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  107.     OS="$(OS)" ;SLUGNET=slugnet ;NETFLG="-DLOCAL" ;\
  108.     LDFLAGS=$(LDFLAGS) ;MAN=$(MAN) ;\
  109.     export LDFLAGS MAN NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  110.     make -e -f slugnet.mk install
  111.  
  112. network: 
  113.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  114.     OS="$(OS)" ;SLUGNET=slugnetd ;NETFLG="-DNETWORK" ;\
  115.     LDFLAGS=$(LDFLAGS) ;MAN=$(MAN) ;\
  116.     export LDFLAGS MAN NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  117.     make -e -f slugnet.mk install
  118.  
  119. tar: 
  120.     @SLUGBIN=$(SLUGBIN) ;SLUGDIR=$(SLUGDIR) ;SLUGUID=$(SLUGUID) ;\
  121.     OS="$(OS)" ;SLUGNET=slugnetd ;NETFLG="-DNETWORK" ;\
  122.     LDFLAGS=$(LDFLAGS) ;\
  123.     export LDFLAGS NETFLG OS SLUGBIN SLUGDIR SLUGUID SLUGNET ;\
  124.     make -e -f slugnet.mk slugtar
  125. \End\Of\Shar\
  126. else
  127.   echo "will not over write ./Makefile"
  128. fi
  129. chmod 400 ./Makefile
  130. if [ `wc -c ./Makefile | awk '{printf $1}'` -ne 2464 ]
  131. then
  132. echo `wc -c ./Makefile | awk '{print "Got " $1 ", Expected " 2464}'`
  133. fi
  134. if `test ! -s ./Readme`
  135. then
  136. echo "writing ./Readme"
  137. cat > ./Readme << '\End\Of\Shar\'
  138. @(#)Readme    1.2 Contents of the file slugtar and quick start.
  139.  
  140. File            Notes
  141. ------------------------------------------------------------------------------
  142. Makefile        Makefile for slugnet, slugnetd, and installation.
  143. Readme            This file.
  144. call_socket.c        Source.
  145. callbyaddr.c        "
  146. callbyhost.c        "
  147. chgusr.c        "
  148. cleanup.c        "
  149. clnusr.c        "
  150. copyright.h        "
  151. establish.c        "
  152. find.c            "
  153. get_connect.c        "
  154. getcfg.c        "
  155. getjsn.c        "
  156. interlan        "
  157. lock.c            "
  158. lower.c            "
  159. main.c            "
  160. net.h            "
  161. rdline.c        "
  162. receive.c        "
  163. repchar.c        "
  164. send_file.c        "
  165. setjsn.c        "
  166. sighang.c        "
  167. sigquit.c        "
  168. sigstop.c        "
  169. sigterm.c        "
  170. sigtstp.c        "
  171. sigurg.c        "
  172. slughlp.dat        On line help file.
  173. slugnet.1        man page for slugnet.
  174. slugnet.c        Source.
  175. slugnetd.1        man page for slugnetd.
  176. slugnet.doc        Slugnet documentation.
  177. slugnet.h        Source.
  178. slugnet.mk        Prototype makefile, invoked by Makefile.
  179. slugnet.n        Original FTN5 source for CDC 180/865 running NOS.
  180. strnicmp.c        "
  181. task.c            "
  182. transmit.c        "
  183. unlock.c        "
  184. verify.c        "
  185.  
  186. Quick start.
  187.  
  188. 1. In Makefile, be sure that MAN, SLUGBIN, SLUGDIR, SLUGUID, and OS are
  189.    set correctly.
  190. 2. make slugnet
  191. 3. make slugnetd
  192. 4. make install
  193. 5. make clean
  194. 6. nohup slugnetd >& /dev/null
  195. \End\Of\Shar\
  196. else
  197.   echo "will not over write ./Readme"
  198. fi
  199. chmod 400 ./Readme
  200. if [ `wc -c ./Readme | awk '{printf $1}'` -ne 1156 ]
  201. then
  202. echo `wc -c ./Readme | awk '{print "Got " $1 ", Expected " 1156}'`
  203. fi
  204. if `test ! -s ./call_socket.c`
  205. then
  206. echo "writing ./call_socket.c"
  207. cat > ./call_socket.c << '\End\Of\Shar\'
  208. /* @(#)call_socket.c    1.2 */
  209. #ifdef NETWORK
  210. #include "net.h"
  211.  
  212. /* calls a socket */
  213.  
  214. int call_socket(hostname, portnum)
  215. char *hostname;
  216. int portnum;
  217. {
  218.     struct sockaddr_in sa;
  219.     struct hostent     *hp;
  220.     int a, s;
  221.  
  222.     if ((hp= gethostbyname(hostname)) == NULL) { /* do we know the host's */
  223.         errno= ECONNREFUSED;                       /* address? */
  224.         return(0);                                /* no */
  225.      }
  226.  
  227.     bzero(&sa,sizeof(sa));
  228.     bcopy(hp->h_addr,(char *)&sa.sin_addr,hp->h_length); /* set address */
  229.     sa.sin_family= hp->h_addrtype;
  230.     sa.sin_port= htons((u_short)portnum);
  231.  
  232.     if ((s= socket(hp->h_addrtype,SOCK_STREAM,0)) < 0)   /* get socket */
  233.         return(0);
  234.     if (connect(s,&sa,sizeof sa) < 0)                    /* connect */
  235.         return(0);
  236.     return(s);
  237. }
  238. #endif NETWORK
  239.  
  240. \End\Of\Shar\
  241. else
  242.   echo "will not over write ./call_socket.c"
  243. fi
  244. chmod 400 ./call_socket.c
  245. if [ `wc -c ./call_socket.c | awk '{printf $1}'` -ne 765 ]
  246. then
  247. echo `wc -c ./call_socket.c | awk '{print "Got " $1 ", Expected " 765}'`
  248. fi
  249. if `test ! -s ./callbyaddr.c`
  250. then
  251. echo "writing ./callbyaddr.c"
  252. cat > ./callbyaddr.c << '\End\Of\Shar\'
  253. /* @(#)callbyaddr.c    1.1 */
  254. #ifdef NETWORK
  255. #include "net.h"
  256.  
  257. /* calls a socket using the ip address */
  258.  
  259. int callbyaddr(addr, portnum)
  260. char *addr;
  261. int portnum;
  262. {
  263.     struct sockaddr_in sa;
  264.     struct hostent     *hp;
  265.     int a, s;
  266.     long adr;
  267.  
  268.     adr = inet_addr( addr );
  269.     if ((hp= gethostbyaddr(&adr,strlen(addr),AF_INET)) == NULL) { /* do we know the host's */
  270.         errno= ECONNREFUSED;                       /* address? */
  271.         return(0);                                /* no */
  272.      }
  273.  
  274.     bzero(&sa,sizeof(sa));
  275.     bcopy(hp->h_addr,(char *)&sa.sin_addr,hp->h_length); /* set address */
  276.     sa.sin_family= hp->h_addrtype;
  277.     sa.sin_port= htons((u_short)portnum);
  278.  
  279.     if ((s= socket(hp->h_addrtype,SOCK_STREAM,0)) < 0)   /* get socket */
  280.         return(0);
  281.     if (connect(s,&sa,sizeof sa) < 0)                    /* connect */
  282.         return(0);
  283.     return(s);
  284. }
  285. #endif NETWORK
  286. \End\Of\Shar\
  287. else
  288.   echo "will not over write ./callbyaddr.c"
  289. fi
  290. chmod 400 ./callbyaddr.c
  291. if [ `wc -c ./callbyaddr.c | awk '{printf $1}'` -ne 829 ]
  292. then
  293. echo `wc -c ./callbyaddr.c | awk '{print "Got " $1 ", Expected " 829}'`
  294. fi
  295. if `test ! -s ./callbyhost.c`
  296. then
  297. echo "writing ./callbyhost.c"
  298. cat > ./callbyhost.c << '\End\Of\Shar\'
  299. /* @(#)callbyhost.c    1.1 */
  300. #ifdef NETWORK
  301. #include "net.h"
  302.  
  303. /* calls a socket using the host name */
  304.  
  305. int callbyhost(hostname, portnum)
  306. char *hostname;
  307. int portnum;
  308. {
  309.     struct sockaddr_in sa;
  310.     struct hostent     *hp;
  311.     int a, s;
  312.  
  313.     if ((hp= gethostbyname(hostname)) == NULL) { /* do we know the host's */
  314.         errno= ECONNREFUSED;                       /* address? */
  315.         return(0);                                /* no */
  316.      }
  317.  
  318.     bzero(&sa,sizeof(sa));
  319.     bcopy(hp->h_addr,(char *)&sa.sin_addr,hp->h_length); /* set address */
  320.     sa.sin_family= hp->h_addrtype;
  321.     sa.sin_port= htons((u_short)portnum);
  322.  
  323.     if ((s= socket(hp->h_addrtype,SOCK_STREAM,0)) < 0)   /* get socket */
  324.         return(0);
  325.     if (connect(s,&sa,sizeof sa) < 0)                    /* connect */
  326.         return(0);
  327.     return(s);
  328. }
  329. #endif NETWORK
  330. \End\Of\Shar\
  331. else
  332.   echo "will not over write ./callbyhost.c"
  333. fi
  334. chmod 400 ./callbyhost.c
  335. if [ `wc -c ./callbyhost.c | awk '{printf $1}'` -ne 782 ]
  336. then
  337. echo `wc -c ./callbyhost.c | awk '{print "Got " $1 ", Expected " 782}'`
  338. fi
  339. echo "Finished archive 6 of 6"
  340. exit
  341.