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

  1. From: purdon@athena.mit.edu (James R. Purdon III)
  2. Newsgroups: alt.sources
  3. Subject: slugnet - multiple user conferencing system: Part 1/6
  4. Message-ID: <1990Dec20.163739.24869@athena.mit.edu>
  5. Date: 20 Dec 90 16:37:39 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. #!/bin/sh
  14. # to extract, remove the header and type "sh filename"
  15. if `test ! -s ./slugnetd.1`
  16. then
  17. echo "writing ./slugnetd.1"
  18. cat > ./slugnetd.1 << '\End\Of\Shar\'
  19. .\" @(#)slugnetd.1    1.1
  20. .TH slugnetd 1
  21. .SH NAME
  22. slugnetd \- slugnet network server, a multiple\-user, interactive
  23. conferencing system
  24. .SH SYNTAX
  25. .B slugnetd
  26. .SH DESCRIPTION
  27. .NXR "slugnetd"
  28. .NXA "multiple\-user" "interactive" "conferencing" "system"
  29. .NXA "network" "slugnet program"
  30. .NXR "message" "interactive"
  31. The
  32. .PN slugnetd
  33. is a network server for the slugnet multiple\-user conferencing system.
  34. With 
  35. .PN slugnetd
  36. running, users do not require logins on the system in order to use the
  37. .PN slugnet
  38. conferencing system.
  39. .PP 
  40. Remote users can connect to the system running
  41. .PN slugnetd
  42. by issuing the command :
  43. .EX
  44. telnet host 2727
  45. .EE
  46. where host is the name of the system running slugnetd.
  47. .PP
  48. .PN slugnetd
  49. should probably be placed in the system startup scripts.
  50. .SH RESTRICTIONS
  51. The number of users which can be serviced is limited to the maximum
  52. number of processes the owner of slugnetd may simultaneously have
  53. executing, and 
  54. .PN slugnetd
  55. users may not be able to execute all of the commands that can be executed by
  56. .PN slugnet
  57. users.
  58. .PP
  59. .SH "SEE ALSO"
  60. slugnet(1),telnet(1c)
  61. \End\Of\Shar\
  62. else
  63.   echo "will not over write ./slugnetd.1"
  64. fi
  65. chmod 400 ./slugnetd.1
  66. if [ `wc -c ./slugnetd.1 | awk '{printf $1}'` -ne 1083 ]
  67. then
  68. echo `wc -c ./slugnetd.1 | awk '{print "Got " $1 ", Expected " 1083}'`
  69. fi
  70. if `test ! -s ./strnicmp.c`
  71. then
  72. echo "writing ./strnicmp.c"
  73. cat > ./strnicmp.c << '\End\Of\Shar\'
  74. /* @(#)strnicmp.c    1.2 */
  75. #include "slugnet.h" 
  76.  
  77. int strnicmp(s1,s2,len)
  78.  
  79. /* compares s1 and s2, ignoring case */
  80.  
  81. char s1[],s2[];
  82. int len;
  83. {
  84.         char *ds1,*ds2,*malloc();
  85.         int i,ls1,ls2;
  86. #ifdef SYSV2
  87.         void free();
  88. #endif SYSV2
  89. #ifdef SYSV3
  90.         void free();
  91. #endif SYSV3
  92. #ifdef ULTRIX
  93.         void free();
  94. #endif ULTRIX
  95.  
  96.         ls1=strlen(s1)+1;
  97.         ds1=malloc((unsigned)ls1);
  98.         ls2=strlen(s2)+1;
  99.         ds2=malloc((unsigned)ls2);
  100.         strcpy(ds1,s1);
  101.         strcpy(ds2,s2);
  102.         lower(ds1);
  103.         lower(ds2);
  104.         i=strncmp(ds1,ds2,len);
  105.         free(ds2);
  106.         free(ds1);
  107.         return(i);
  108. }
  109. \End\Of\Shar\
  110. else
  111.   echo "will not over write ./strnicmp.c"
  112. fi
  113. chmod 400 ./strnicmp.c
  114. if [ `wc -c ./strnicmp.c | awk '{printf $1}'` -ne 643 ]
  115. then
  116. echo `wc -c ./strnicmp.c | awk '{print "Got " $1 ", Expected " 643}'`
  117. fi
  118. if `test ! -s ./task.c`
  119. then
  120. echo "writing ./task.c"
  121. cat > ./task.c << '\End\Of\Shar\'
  122. /* @(#)task.c    1.3 */
  123. #ifdef NETWORK
  124. #include "net.h"
  125.  
  126. /* pass socket descriptor to real application */
  127.  
  128. void task( s )
  129. int s;
  130. {
  131.     slugnet( s, (char *)NULL );    
  132.     shutdown( s, 2 );
  133.     close( s );
  134. }
  135. #endif NETWORK
  136. \End\Of\Shar\
  137. else
  138.   echo "will not over write ./task.c"
  139. fi
  140. chmod 400 ./task.c
  141. if [ `wc -c ./task.c | awk '{printf $1}'` -ne 207 ]
  142. then
  143. echo `wc -c ./task.c | awk '{print "Got " $1 ", Expected " 207}'`
  144. fi
  145. if `test ! -s ./transmit.c`
  146. then
  147. echo "writing ./transmit.c"
  148. cat > ./transmit.c << '\End\Of\Shar\'
  149. /* @(#)transmit.c    1.3 */
  150. #include "slugnet.h"
  151.  
  152. int transmit(socket,string,crlf)
  153.  
  154. /* transmits a string to the output units */
  155.  
  156.  
  157. char string[];
  158. int crlf;
  159. int socket;
  160. {
  161.     char *sp;
  162.         int err, i,len;
  163.         len=strlen(string);
  164.     sp = string;
  165.         for(i=0;i<len;i++)
  166.         {
  167.                 if(socket==NULL)
  168. #ifdef SYSV3
  169.                                 putchar((int)((char)string[i]));
  170. #endif SYSV3
  171. #ifdef SYSV2
  172.                                 putchar((int)((char)string[i]));
  173. #endif SYSV2
  174. #ifdef BSD4
  175.                                 putchar((char)string[i]);
  176. #endif BSD4
  177. #ifdef ULTRIX
  178.                                 putchar((char)string[i]);
  179. #endif ULTRIX
  180.                 else {
  181. #ifdef SYSV3
  182.             err = write( socket, sp, 1 );
  183. #endif SYSV3
  184. #ifdef SYSV2
  185.             err = write( socket, sp, 1 );
  186. #endif SYSV2
  187. #ifdef BSD4
  188.             err = write( socket, sp, 1 );
  189. #endif BSD4
  190. #ifdef ULTRIX
  191.             err = write( socket, sp, 1 );
  192. #endif ULTRIX
  193.             ++sp;
  194.         }
  195.         }
  196.         if(crlf)
  197.         {
  198.  
  199.                if(socket==NULL)
  200.                {
  201.                                 putchar(CR);
  202.                                 putchar(LF);
  203.                }
  204.                else
  205.                {
  206.             err = write( socket, "\r\n", 2 );
  207.                }
  208.         }
  209.         if(socket==NULL)
  210.                 return(len);
  211.         else
  212.                 return(NULL);
  213. }
  214. \End\Of\Shar\
  215. else
  216.   echo "will not over write ./transmit.c"
  217. fi
  218. chmod 400 ./transmit.c
  219. if [ `wc -c ./transmit.c | awk '{printf $1}'` -ne 1330 ]
  220. then
  221. echo `wc -c ./transmit.c | awk '{print "Got " $1 ", Expected " 1330}'`
  222. fi
  223. if `test ! -s ./unlock.c`
  224. then
  225. echo "writing ./unlock.c"
  226. cat > ./unlock.c << '\End\Of\Shar\'
  227. /* @(#)unlock.c    1.2 */
  228. #include "slugnet.h" 
  229.  
  230. unlock( string )
  231. char string[];
  232. {
  233.     char lstring[FLNMLN+FLNMLN];
  234.     strcpy(lstring,"LCK_");
  235.     strcat(lstring,string);
  236.     unlink( lstring );
  237. }
  238. \End\Of\Shar\
  239. else
  240.   echo "will not over write ./unlock.c"
  241. fi
  242. chmod 400 ./unlock.c
  243. if [ `wc -c ./unlock.c | awk '{printf $1}'` -ne 182 ]
  244. then
  245. echo `wc -c ./unlock.c | awk '{print "Got " $1 ", Expected " 182}'`
  246. fi
  247. if `test ! -s ./verify.c`
  248. then
  249. echo "writing ./verify.c"
  250. cat > ./verify.c << '\End\Of\Shar\'
  251. /* @(#)verify.c    1.3 */
  252. #include "net.h"
  253.  
  254. int verify( un, host )
  255.  
  256. /* attempts to use finger service to verify a un at a host */
  257.  
  258. char *un, *host;
  259. {
  260. #ifdef LOCAL
  261.     return( 0 );
  262. }
  263. #endif LOCAL
  264. #ifdef NETWORK
  265.     char buffer[ 64 ];
  266.     int i, j, portnum, socket;
  267.     struct servent *finger;
  268.  
  269.     /* get the port of the finger service */
  270.  
  271.     /* finger = getservbyname( "finger", (char *)NULL ); */
  272.  
  273.     /* portnum = ( int )ntohl( finger->s_port ); */
  274.  
  275.     portnum = 79;
  276.  
  277.         /* try to connect to the socket */
  278.  
  279.     if(!( socket = callbyhost(host,portnum)))
  280.         if(!( socket = callbyaddr(host,portnum)))
  281.             return( 0 );
  282.  
  283.     /* write the request */
  284.  
  285.     strcpy( buffer, "@" );
  286.     strcat( buffer, host );
  287.     strcat( buffer, "\n" );
  288.     
  289.     i = strlen( buffer );
  290.     if( write( socket, buffer, i ) != i )
  291.         return( 0 );
  292.  
  293.     /* read until return is encountered, then try to compare */
  294.  
  295.     j = strlen( un );
  296.     for(;;) {
  297.         
  298.         /* look for returns */
  299.  
  300.         i = read( socket, buffer, 1 );
  301.         if( i != 1 ){
  302.             close( socket );
  303.             return( 0 );
  304.         } else {
  305.             if( buffer[ 0 ] == '\n' ){
  306.             
  307.                 /* try to read a un's length */
  308.  
  309.                 i = read( socket, buffer, j );
  310.                 if( i != j ){
  311.                     close( socket );
  312.                     return( 0 );
  313.                 }
  314.                 if(strncmp( un, buffer, j ) == NULL ){
  315.                     close( socket );
  316.                     return( 1 );
  317.                 }
  318.             }
  319.         }
  320.     }
  321. }
  322. #endif NETWORK
  323. \End\Of\Shar\
  324. else
  325.   echo "will not over write ./verify.c"
  326. fi
  327. chmod 400 ./verify.c
  328. if [ `wc -c ./verify.c | awk '{printf $1}'` -ne 1278 ]
  329. then
  330. echo `wc -c ./verify.c | awk '{print "Got " $1 ", Expected " 1278}'`
  331. fi
  332. echo "Finished archive 1 of 6"
  333. exit
  334.