home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2380 < prev    next >
Encoding:
Text File  |  1990-12-28  |  56.7 KB  |  2,221 lines

  1. Newsgroups: alt.sources
  2. From: purdon@athena.mit.edu (James R. Purdon III)
  3. Subject: slugnet - Multiple user conferencing system: Part 5 of 6
  4. Message-ID: <1990Dec20.164900.25603@athena.mit.edu>
  5. Date: Thu, 20 Dec 90 16:49:00 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 ./chgusr.c`
  17. then
  18. echo "writing ./chgusr.c"
  19. cat > ./chgusr.c << '\End\Of\Shar\'
  20. /* @(#)chgusr.c    1.7 */
  21. #include "slugnet.h"
  22.  
  23. int chgusr(name,un,jsn,confer,rcvfil,usrfil,exitit,host,pid,mode)
  24.  
  25. /* changes directory entry */
  26.  
  27. char name[NAMLEN],un[UNLEN],jsn[JSNLEN],confer[CFRLEN],rcvfil[FLNMLN],usrfil[FLNMLN],host[HOSTLEN],pid[PIDLEN],mode[MODELN];
  28. int exitit; /* if exit is ON, jsn is replaced by blanks */
  29. {
  30.  
  31.         struct slugdir inpstr, outstr;
  32.         int found,i,numbyt,reclen,usr;
  33.  
  34.         long fpos,lseek();
  35.  
  36.         /* initialize variables */
  37.  
  38.         found=OFF;
  39.         reclen=sizeof( struct slugdir );
  40.         strncpy(inpstr.jsn,"    ",JSNLEN-1);
  41.         strcpy(outstr.name,name);
  42.         strcpy(outstr.un,un);
  43.         strcpy(outstr.jsn,jsn);
  44.         strcpy(outstr.confer,confer);
  45.         strcpy(outstr.rcvfil,rcvfil);
  46.         strcpy(outstr.host,host);
  47.         strcpy(outstr.pid,pid);
  48.         strcpy(outstr.mode,mode);
  49.  
  50.         /* open the user directory file */
  51.  
  52.     lock(usrfil);
  53. #ifdef SYSV2
  54.         usr=open(usrfil,O_RDWR|O_SYNC);
  55. #endif SYSV2
  56. #ifdef SYSV3
  57.         usr=open(usrfil,O_RDWR|O_SYNC);
  58. #endif SYSV3
  59. #ifdef BSD4
  60.         usr=open(usrfil,O_RDWR|O_FSYNC);
  61. #endif BSD4
  62. #ifdef ULTRIX
  63.         usr=open(usrfil,O_RDWR|O_FSYNC);
  64. #endif ULTRIX
  65.         if(usr<NULL)
  66.         {
  67. #ifdef SYSV2
  68.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_SYNC);
  69. #endif SYSV2
  70. #ifdef SYSV3
  71.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_SYNC);
  72. #endif SYSV3
  73. #ifdef BSD4
  74.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_FSYNC);
  75. #endif BSD4
  76. #ifdef ULTRIX
  77.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_FSYNC);
  78. #endif ULTRIX
  79.                 i=close(usr);
  80. #ifdef SYSV2
  81.                 usr=open(usrfil,O_RDWR|O_SYNC);
  82. #endif SYSV2
  83. #ifdef SYSV3
  84.                 usr=open(usrfil,O_RDWR|O_SYNC);
  85. #endif SYSV3
  86. #ifdef BSD4
  87.                 usr=open(usrfil,O_RDWR|O_FSYNC);
  88. #endif BSD4
  89. #ifdef ULTRIX
  90.                 usr=open(usrfil,O_RDWR|O_FSYNC);
  91. #endif ULTRIX
  92.                 if(usr<NULL) 
  93.         {
  94.             unlock(usrfil);
  95.             return(-1);
  96.         }
  97.         }
  98.  
  99.         /* make sure user isn't already there */
  100.  
  101. #ifndef SYSV2
  102.         fpos=lseek(usr,(long)NULL,SEEK_SET);
  103. #endif SYSV2
  104. #ifdef SYSV2
  105.         fpos=lseek(usr,(long)NULL,BEGINNING);
  106. #endif SYSV2
  107.         if(fpos<(long)NULL) 
  108.     {
  109.         unlock(usrfil);
  110.         return(-3);
  111.     }
  112.         for(;;)
  113.         {
  114. #ifdef SYSV2
  115.                 numbyt=read(usr,&inpstr,(unsigned)reclen);
  116. #endif SYSV2
  117. #ifdef SYSV3
  118.                 numbyt=read(usr,&inpstr,(unsigned)reclen);
  119. #endif SYSV3
  120. #ifdef BSD4
  121.                 numbyt=read(usr,&inpstr,reclen);
  122. #endif BSD4
  123. #ifdef ULTRIX
  124.                 numbyt=read(usr,&inpstr,reclen);
  125. #endif ULTRIX
  126.         if(numbyt == NULL )
  127.             break;
  128.                 else if(numbyt!=reclen) 
  129.         {
  130.             unlock(usrfil);
  131.             return(-4);
  132.         }
  133.                 if(strncmp(inpstr.jsn,jsn,JSNLEN-1)==NULL 
  134.         &&strncmp(inpstr.host,host,HOSTLEN-1)==NULL ){
  135. #ifndef SYSV2
  136.                         fpos=lseek(usr,-(long)reclen,SEEK_CUR);
  137. #endif SYSV2
  138. #ifdef SYSV2
  139.                         fpos=lseek(usr,-(long)reclen,CURRENT);
  140. #endif SYSV2
  141.                         if(fpos<(long)NULL) 
  142.             {
  143.                 unlock(usrfil);
  144.                 return(-5);
  145.             }
  146.  
  147.             /* make sure we don't replace a real rcvfil
  148.                with a "*" (this happens if an internodal
  149.                client is hooked to an internodal server
  150.                on the same host */
  151.  
  152.             if( strcmp( outstr.rcvfil, "*" ) == NULL
  153.              && strcmp( inpstr.rcvfil, "*" ) != NULL )
  154.                 strcpy( outstr.rcvfil, inpstr.rcvfil );
  155.  
  156.             /* user is logging out */
  157.                         if(exitit==ON) strcpy(outstr.jsn,"    ");
  158.  
  159. #ifdef SYSV2
  160.                         numbyt=write(usr,&outstr,(unsigned)reclen);
  161. #endif SYSV2
  162. #ifdef SYSV3
  163.                         numbyt=write(usr,&outstr,(unsigned)reclen);
  164. #endif SYSV3
  165. #ifdef BSD4
  166.                         numbyt=write(usr,&outstr,reclen);
  167. #endif BSD4
  168. #ifdef ULTRIX
  169.                         numbyt=write(usr,&outstr,reclen);
  170. #endif ULTRIX
  171.                         if(numbyt!=reclen) 
  172.             {
  173.                 unlock(usrfil);
  174.                 return(-6);
  175.             }
  176.                         found=ON;
  177.             break;
  178.                 }
  179.         }
  180.  
  181.         /* add new user */
  182.  
  183.         if(found==OFF)
  184.         {
  185. #ifndef SYSV2
  186.                 fpos=lseek(usr,(long)NULL,SEEK_SET);
  187. #endif SYSV2
  188. #ifdef SYSV2
  189.                 fpos=lseek(usr,(long)NULL,BEGINNING);
  190. #endif SYSV2
  191.                 if(fpos<(long)NULL) 
  192.             {
  193.             unlock(usrfil);
  194.             return(-7);
  195.         }
  196.                 for(;;)
  197.                 {
  198. #ifdef SYSV2
  199.                         numbyt=read(usr,&inpstr,(unsigned)reclen);
  200. #endif SYSV2
  201. #ifdef SYSV3
  202.                         numbyt=read(usr,&inpstr,(unsigned)reclen);
  203. #endif SYSV3
  204. #ifdef BSD4
  205.                         numbyt=read(usr,&inpstr,reclen);
  206. #endif BSD4
  207. #ifdef ULTRIX
  208.                         numbyt=read(usr,&inpstr,reclen);
  209. #endif ULTRIX
  210.             if(numbyt == NULL )
  211.                 break;
  212.                         else if(numbyt!=reclen) 
  213.             {
  214.                 unlock(usrfil);
  215.                 return(-8);
  216.             }
  217.                         if(strncmp(inpstr.jsn,"    ",JSNLEN-1)==NULL)
  218.                         {
  219. #ifndef SYSV2
  220.                                 fpos=lseek(usr,-(long)reclen,SEEK_CUR);
  221. #endif SYSV2
  222. #ifdef SYSV2
  223.                                 fpos=lseek(usr,-(long)reclen,CURRENT);
  224. #endif SYSV2
  225.                                 if(fpos<(long)NULL) 
  226.                 {
  227.                     unlock(usrfil);
  228.                     return(-9);
  229.                 }
  230. #ifdef SYSV2
  231.                                 numbyt=write(usr,&outstr,(unsigned)reclen);
  232. #endif SYSV2
  233. #ifdef SYSV3
  234.                                 numbyt=write(usr,&outstr,(unsigned)reclen);
  235. #endif SYSV3
  236. #ifdef BSD4
  237.                                 numbyt=write(usr,&outstr,reclen);
  238. #endif BSD4
  239. #ifdef ULTRIX
  240.                                 numbyt=write(usr,&outstr,reclen);
  241. #endif ULTRIX
  242.                                 if(numbyt!=reclen) 
  243.                 {
  244.                     unlock(usrfil);
  245.                     return(-10);
  246.                 }
  247.                                 found=ON;
  248.                 break;
  249.                         }
  250.                 }
  251.  
  252.         /* we must be at eof! */
  253.  
  254.         if( found != ON ) {
  255. #ifndef SYSV2
  256.                     fpos=lseek(usr,(long)NULL,SEEK_END);
  257. #endif SYSV2
  258. #ifdef SYSV2
  259.                        fpos=lseek(usr,(long)NULL,END);
  260. #endif SYSV2
  261.                         if(fpos<(long)NULL) 
  262.             {
  263.                 unlock(usrfil);
  264.                 return(-11);
  265.             }
  266. #ifdef SYSV2
  267.                         numbyt=write(usr,&outstr,(unsigned)reclen);
  268. #endif SYSV2
  269. #ifdef SYSV3
  270.                         numbyt=write(usr,&outstr,(unsigned)reclen);
  271. #endif SYSV3
  272. #ifdef BSD4
  273.                         numbyt=write(usr,&outstr,reclen);
  274. #endif BSD4
  275. #ifdef ULTRIX
  276.                         numbyt=write(usr,&outstr,reclen);
  277. #endif ULTRIX
  278.                         if(numbyt!=reclen) 
  279.             {
  280.                 unlock(usrfil);
  281.                 return(-12);
  282.             }
  283.                         found=ON;
  284.         }
  285.         }
  286.  
  287.         /* make sure he got in */
  288.  
  289.         if(found==OFF) 
  290.     {
  291.         unlock(usrfil);
  292.         return(-13);
  293.     }
  294.  
  295.         /* close it */
  296.  
  297.         i=close(usr);
  298.     unlock(usrfil);
  299.         if(i!=NULL) return(-14);
  300.         return(NULL);
  301. }
  302. \End\Of\Shar\
  303. else
  304.   echo "will not over write ./chgusr.c"
  305. fi
  306. chmod 400 ./chgusr.c
  307. if [ `wc -c ./chgusr.c | awk '{printf $1}'` -ne 6808 ]
  308. then
  309. echo `wc -c ./chgusr.c | awk '{print "Got " $1 ", Expected " 6808}'`
  310. fi
  311. if `test ! -s ./cleanup.c`
  312. then
  313. echo "writing ./cleanup.c"
  314. cat > ./cleanup.c << '\End\Of\Shar\'
  315. /* @(#)cleanup.c    1.4 */
  316. #ifdef NETWORK
  317. #include "net.h"
  318.  
  319. /* as children die we should get catch their returns or else we get
  320.    zombies, A Bad Thing.  cleanup() catches falling children.
  321. */
  322.  
  323. void cleanup()
  324. {
  325.     int i;
  326. #ifdef BDS4
  327.     union wait wstatus;
  328. #endif BSD4
  329. #ifdef ULTRIX
  330.     union wait wstatus;
  331. #endif ULTRIX
  332.  
  333. #ifdef BDS4
  334.     while(( i = wait3(&wstatus,WNOHANG,NULL)) > 0); 
  335. #endif BSD4
  336. #ifdef ULTRIX
  337.     while(( i = wait3(&wstatus,WNOHANG,NULL)) > 0); 
  338. #endif ULTRIX
  339. }
  340. #endif NETWORK
  341. \End\Of\Shar\
  342. else
  343.   echo "will not over write ./cleanup.c"
  344. fi
  345. chmod 400 ./cleanup.c
  346. if [ `wc -c ./cleanup.c | awk '{printf $1}'` -ne 480 ]
  347. then
  348. echo `wc -c ./cleanup.c | awk '{print "Got " $1 ", Expected " 480}'`
  349. fi
  350. if `test ! -s ./clnusr.c`
  351. then
  352. echo "writing ./clnusr.c"
  353. cat > ./clnusr.c << '\End\Of\Shar\'
  354. /* @(#)clnusr.c    1.6 */
  355. #include "slugnet.h"
  356.  
  357. int clnusr(name,un,jsn,confer,rcvfil,usrfil,host,pid,mode)
  358.  
  359. /* cleans up zombie user directory entries */
  360.  
  361. char name[NAMLEN],un[UNLEN],jsn[JSNLEN],confer[CFRLEN],rcvfil[FLNMLN],usrfil[FLNMLN],host[HOSTLEN],pid[PIDLEN],mode[MODELN];
  362. {
  363.         struct slugdir inpstr, outstr;
  364.  
  365.     char zmbfil[ FLNMLN + 1 ];
  366.  
  367.         int i, ipid, numbyt,reclen,usr;
  368.  
  369.         long fpos,lseek();
  370.  
  371.         /* initialize variables */
  372.     
  373.         reclen=sizeof( struct slugdir );
  374.         strncpy(inpstr.jsn,"    ",JSNLEN-1);
  375.         strcpy(outstr.name,name);
  376.         strcpy(outstr.un,un);
  377.         strcpy(outstr.jsn,jsn);
  378.         strcpy(outstr.confer,confer);
  379.         strcpy(outstr.rcvfil,rcvfil);
  380.         strcpy(outstr.host,host);
  381.         strcpy(outstr.pid,pid);
  382.         strcpy(outstr.mode,mode);
  383.  
  384.         /* open the user directory file */
  385.  
  386.     lock(usrfil);
  387. #ifdef SYSV2
  388.         usr=open(usrfil,O_RDWR|O_SYNC);
  389. #endif SYSV2
  390. #ifdef SYSV3
  391.         usr=open(usrfil,O_RDWR|O_SYNC);
  392. #endif SYSV3
  393. #ifdef BSD4
  394.         usr=open(usrfil,O_RDWR|O_FSYNC);
  395. #endif BSD4
  396. #ifdef ULTRIX
  397.         usr=open(usrfil,O_RDWR|O_FSYNC);
  398. #endif ULTRIX
  399.         if(usr<NULL)
  400.         {
  401. #ifdef SYSV2
  402.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_SYNC);
  403. #endif SYSV2
  404. #ifdef SYSV3
  405.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_SYNC);
  406. #endif SYSV3
  407. #ifdef BSD4
  408.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_FSYNC);
  409. #endif BSD4
  410. #ifdef ULTRIX
  411.                 usr=creat(usrfil,S_IREAD|S_IWRITE|O_FSYNC);
  412. #endif ULTRIX
  413.                 i=close(usr);
  414.                 usr=open(usrfil,O_RDWR);
  415.                 if(usr<NULL) 
  416.         {
  417.             unlock(usrfil);
  418.             return(-1);
  419.         }
  420.         }
  421.  
  422.         /* Look for zombies */
  423.  
  424. #ifndef SYSV2
  425.         fpos=lseek(usr,(long)NULL,SEEK_SET);
  426. #endif SYSV2
  427. #ifdef SYSV2
  428.         fpos=lseek(usr,(long)NULL,BEGINNING);
  429. #endif SYSV2
  430.         if(fpos<(long)NULL) 
  431.     {
  432.         unlock(usrfil);
  433.         return(-3);
  434.     }
  435.         for(;;)
  436.         {
  437. #ifdef SYSV2
  438.                 numbyt=read(usr,&inpstr,(unsigned)reclen);
  439. #endif SYSV2
  440. #ifdef SYSV3
  441.                 numbyt=read(usr,&inpstr,(unsigned)reclen);
  442. #endif SYSV3
  443. #ifdef BSD4
  444.                 numbyt=read(usr,&inpstr,reclen);
  445. #endif BSD4
  446. #ifdef ULTRIX
  447.                 numbyt=read(usr,&inpstr,reclen);
  448. #endif ULTRIX
  449.         if(numbyt== NULL )
  450.             break;
  451.                 else if(numbyt!=reclen) 
  452.         {
  453.             close( usr );
  454.             unlock(usrfil);
  455.             return(NULL);
  456.         }
  457.                 if(strncmp(inpstr.jsn,"    ",JSNLEN-1)!=NULL)
  458.                 {
  459. #ifndef SYSV2
  460.                         fpos=lseek(usr,-(long)reclen,SEEK_CUR);
  461. #endif SYSV2
  462. #ifdef SYSV2
  463.                         fpos=lseek(usr,-(long)reclen,CURRENT);
  464. #endif SYSV2
  465.                         if(fpos<(long)NULL) 
  466.             {
  467.                 unlock(usrfil);
  468.                 return(-5);
  469.             }
  470.             
  471.             /* see if its a zombie */
  472.         
  473.             sscanf( inpstr.pid, "%d", &ipid );
  474.                         if(kill(ipid,NULL)<NULL) {
  475.                 strcpy(outstr.jsn,"    ");
  476. #ifdef SYSV2
  477.                             numbyt=write(usr,&outstr,(unsigned)reclen);
  478. #endif SYSV2
  479. #ifdef SYSV3
  480.                             numbyt=write(usr,&outstr,(unsigned)reclen);
  481. #endif SYSV3
  482. #ifdef BSD4
  483.                                 numbyt=write(usr,&outstr,reclen);
  484. #endif BSD4
  485. #ifdef ULTRIX
  486.                             numbyt=write(usr,&outstr,reclen);
  487. #endif ULTRIX
  488.                             if(numbyt!=reclen) 
  489.                 {
  490.                     unlock(usrfil);
  491.                     return(-6);
  492.                 }
  493.  
  494.                 strncpy( zmbfil, inpstr.rcvfil, FLNMLN );
  495.                 i = unlink( zmbfil );
  496.             } else {
  497. #ifndef SYSV2
  498.                             fpos=lseek(usr,(long)reclen,SEEK_CUR);
  499. #endif SYSV2
  500. #ifdef SYSV2
  501.                                    fpos=lseek(usr,(long)reclen,CURRENT);
  502. #endif SYSV2
  503.             }
  504.                 }
  505.         }
  506.  
  507.         /* close it */
  508.  
  509.         i=close(usr);
  510.     unlock(usrfil);
  511.         if(i!=NULL) return(-12);
  512.         return(NULL);
  513. }
  514. \End\Of\Shar\
  515. else
  516.   echo "will not over write ./clnusr.c"
  517. fi
  518. chmod 400 ./clnusr.c
  519. if [ `wc -c ./clnusr.c | awk '{printf $1}'` -ne 3782 ]
  520. then
  521. echo `wc -c ./clnusr.c | awk '{print "Got " $1 ", Expected " 3782}'`
  522. fi
  523. if `test ! -s ./copyright.h`
  524. then
  525. echo "writing ./copyright.h"
  526. cat > ./copyright.h << '\End\Of\Shar\'
  527. /* @(#)copyright.h    1.3 */
  528.  static char copyright[] = "Slugnet COPYRIGHT 1988 James R. Purdon III";
  529.  
  530. /*
  531.                                 Slugnet
  532.  
  533.                     COPYRIGHT 1988 James R. Purdon III
  534.  
  535.                            All rights reserved.
  536.  
  537. This program may be used with the following conditions:
  538.  
  539. 1.  This program may be installed on any system.
  540.  
  541. 2.  If installed on a particular system, the author must be notified 
  542.     within 30 days of installation via postal sevice or electronic mail.
  543.     Such notification should include the following information:
  544.  
  545.     A.  Postal service address.
  546.  
  547.     B.  Electronic mail address, if available.
  548.  
  549.     C.  OS and hardware types.
  550.  
  551.     D.  Contact name and phone number.
  552.  
  553.     This information will be kept strictly confidential.
  554.  
  555. 3.  Changes may be free made to the code with the following exceptions:
  556.  
  557.     A.  Copyright notices must be left unchanged.
  558.  
  559.     B.  The file copyright.h must be left unchanged.
  560.  
  561. 4.  Copies of this code may be freely distributed with the following provisions:
  562.  
  563.     A.  Copies must include all files originally  provided.
  564.  
  565.     B.  No charge may be made, except for the cost of media and postage.
  566.  
  567. 5.  This code is used at your own risk.  The author assumes no liability for any
  568.     and all damages which may result from the use of this  program.
  569.  
  570. 6.  The conditions described above may be changed at any time by the author,
  571.     without notification.
  572.  
  573. Contact:
  574.  
  575. The author may be contacted at the following addresses:
  576.  
  577. 1.  INTERNET: purdon@cons1.mit.edu
  578.  
  579. 2.  Phone:    617-253-7954
  580.     
  581. 3.  Address:  James R. Purdon III
  582.               M.I.T.
  583.           Building 11-124A
  584.               Cambridge, MA 02178
  585. */
  586. \End\Of\Shar\
  587. else
  588.   echo "will not over write ./copyright.h"
  589. fi
  590. chmod 400 ./copyright.h
  591. if [ `wc -c ./copyright.h | awk '{printf $1}'` -ne 1672 ]
  592. then
  593. echo `wc -c ./copyright.h | awk '{print "Got " $1 ", Expected " 1672}'`
  594. fi
  595. if `test ! -s ./establish.c`
  596. then
  597. echo "writing ./establish.c"
  598. cat > ./establish.c << '\End\Of\Shar\'
  599. /* @(#)establish.c    1.3 */
  600. #ifdef NETWORK
  601. #include "net.h"
  602.  
  603. /* code to establish a socket  */
  604.  
  605. int establish( portnum )
  606. u_short portnum;
  607. {
  608.     char myname[ MAXHOSTNAMELEN + 1 ];
  609.     int on = 1;
  610.     int s;
  611.     struct sockaddr_in sa;
  612.     struct hostent *hp;
  613.  
  614.     bzero(&sa,sizeof(struct sockaddr_in));      /* clear our address */
  615.     gethostname(myname,MAXHOSTNAMELEN);            /* who are we? */
  616.     hp= gethostbyname(myname);                  /* get our address info */
  617.     if (hp == NULL)                             /* we don't exist !? */
  618.       return(-1);
  619.     sa.sin_family= hp->h_addrtype;              /* this is our host address */
  620.     sa.sin_port= htons(portnum);                /* this is our port number */
  621.     if ((s= socket(AF_INET,SOCK_STREAM,0)) < 0) /* create socket */
  622.       return(-1);
  623.     setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
  624.     if (bind(s,&sa,sizeof sa,0) < 0)
  625.       return(-1);                               /* bind address to socket */
  626.     listen(s, 3);                               /* max # of queued connects */
  627.     return(s);
  628. }
  629. #endif NETWORK
  630. \End\Of\Shar\
  631. else
  632.   echo "will not over write ./establish.c"
  633. fi
  634. chmod 400 ./establish.c
  635. if [ `wc -c ./establish.c | awk '{printf $1}'` -ne 1035 ]
  636. then
  637. echo `wc -c ./establish.c | awk '{print "Got " $1 ", Expected " 1035}'`
  638. fi
  639. if `test ! -s ./find.c`
  640. then
  641. echo "writing ./find.c"
  642. cat > ./find.c << '\End\Of\Shar\'
  643. /* @(#)find.c    1.2 */
  644. #include "slugnet.h"
  645.  
  646. int find(string,c,line)
  647.  
  648. /* returns position of c in string as integer */
  649.  
  650. char string[],c;
  651. int line;
  652. {
  653.         int i;
  654.         i=0;
  655.         while(string[i]!=(char)NULL&&i<line)
  656.         {
  657.                 if(string[i]==c) return(i);
  658.                 ++i;
  659.         }
  660.         return(-1);
  661. }
  662. \End\Of\Shar\
  663. else
  664.   echo "will not over write ./find.c"
  665. fi
  666. chmod 400 ./find.c
  667. if [ `wc -c ./find.c | awk '{printf $1}'` -ne 327 ]
  668. then
  669. echo `wc -c ./find.c | awk '{print "Got " $1 ", Expected " 327}'`
  670. fi
  671. if `test ! -s ./get_connect.c`
  672. then
  673. echo "writing ./get_connect.c"
  674. cat > ./get_connect.c << '\End\Of\Shar\'
  675. /* @(#)get_connect.c    1.2 */
  676. #ifdef NETWORK
  677. #include "net.h"
  678.  
  679. int get_connection(s)
  680. int s;                    /* socket created with establish() */
  681. {
  682.     struct sockaddr_in isa; /* address of socket */
  683.     int i;                  /* size of address */
  684.     int t;                  /* socket of connection */
  685.  
  686.     i = sizeof(isa);                   /* find socket's address */
  687.     getsockname(s,&isa,&i);            /* for accept() */
  688.  
  689.     if ((t = accept(s,&isa,&i)) < 0)   /* accept connection if there is one */
  690.       return(-1);
  691.     return(t);
  692. }
  693. #endif NETWORK
  694. \End\Of\Shar\
  695. else
  696.   echo "will not over write ./get_connect.c"
  697. fi
  698. chmod 400 ./get_connect.c
  699. if [ `wc -c ./get_connect.c | awk '{printf $1}'` -ne 538 ]
  700. then
  701. echo `wc -c ./get_connect.c | awk '{print "Got " $1 ", Expected " 538}'`
  702. fi
  703. if `test ! -s ./getcfg.c`
  704. then
  705. echo "writing ./getcfg.c"
  706. cat > ./getcfg.c << '\End\Of\Shar\'
  707. /* @(#)getcfg.c    1.4 */
  708. #include "slugnet.h"
  709.  
  710. int getcfg(sysfil,access,actfil,bgnfil,billing,bilfil,deffil,dirfil,hlpfil,jsnfil,logset,modem,newfil,portstr,privs,profil,usrfil,valfil)
  711.  
  712. /* gets system configuration from sysfil */
  713.  
  714. char sysfil[FLNMLN]; /* system configuration file */
  715. char access[FLNMLN]; /* access mode for new users */
  716. char actfil[FLNMLN]; /* system accounting file name */
  717. char bgnfil[FLNMLN]; /* prelogin file name */
  718. char billing[4];     /* billing option flag */
  719. char bilfil[FLNMLN]; /* billing options file name */
  720. char deffil[FLNMLN]; /* user definition file name */
  721. char dirfil[FLNMLN]; /* user directory file name */
  722. char hlpfil[FLNMLN]; /* help file name */
  723. char jsnfil[FLNMLN]; /* jsn file name */
  724. char logset[4];      /* login flag */
  725. char modem[LINLEN];  /* modem initialization string */
  726. char newfil[FLNMLN]; /* news file name */
  727. char portstr[4];     /* port number in string form */
  728. char privs[FLNMLN];  /* default privileges */
  729. char profil[FLNMLN]; /* user prologue file name */
  730. char usrfil[FLNMLN]; /* user directory file name */
  731. char valfil[FLNMLN]; /* validated user list file name */
  732.  
  733. {
  734.  
  735.         char line[LINLEN];
  736.  
  737.       FILE *sys;
  738. #ifdef SYSV2
  739.     FILE *fopen();
  740. #endif SYSV2  
  741.  
  742.         int acc,act,bgn,bil,blf,def,dir,hlp,i,jsn,log,mod,new,por,pri,pro,usr,val;
  743.  
  744.         /* set flags */
  745.  
  746.         acc=OFF;
  747.         act=OFF;
  748.         bgn=OFF;
  749.         bil=OFF;
  750.         blf=OFF;
  751.         def=OFF;
  752.         dir=OFF;
  753.         hlp=OFF;
  754.         jsn=OFF;
  755.         log=OFF;
  756.         mod=OFF;
  757.         new=OFF;
  758.         por=OFF;
  759.         pri=OFF;
  760.         pro=OFF;
  761.         usr=OFF;
  762.         val=OFF;
  763.  
  764.         /* check sysfil and set file names */
  765.  
  766.         sys=fopen(sysfil,"r");
  767.         if(sys!=NULL)
  768.         {
  769.                 while(feof(sys)==NULL)
  770.                 {
  771.                         fscanf(sys,"%79s",line);
  772.  
  773.                         /* default access mode */
  774.  
  775.                         if(strncmp(line,"acc=",4)==NULL)
  776.                         {
  777.                                 strncpy(access,line+4,FLNMLN-1);
  778.                                 access[FLNMLN-1]=(char)NULL;
  779.                                 acc=ON;
  780.                         }
  781.  
  782.                         /* accounting file name */
  783.  
  784.                         else if(strncmp(line,"act=",4)==NULL)
  785.                         {
  786.                                 strncpy(actfil,line+4,FLNMLN-1);
  787.                                 actfil[FLNMLN-1]=(char)NULL;
  788.                                 act=ON;
  789.                         }
  790.  
  791.                         /* prelogin file name */
  792.  
  793.                         else if(strncmp(line,"bgn=",4)==NULL)
  794.                         {
  795.                                 strncpy(bgnfil,line+4,FLNMLN-1);
  796.                                 bgnfil[FLNMLN-1]=(char)NULL;
  797.                                 bgn=ON;
  798.                         }
  799.  
  800.                         /* billing option flag */
  801.  
  802.                         else if(strncmp(line,"bil=",4)==NULL)
  803.                         {
  804.                                 strncpy(billing,line+4,3);
  805.                                 billing[4]=(char)NULL;
  806.                                 bil=ON;
  807.                         }
  808.  
  809.                         /* billing options file name */
  810.  
  811.                         else if(strncmp(line,"blf=",4)==NULL)
  812.                         {
  813.                                 strncpy(bilfil,line+4,FLNMLN-1);
  814.                                 bilfil[FLNMLN-1]=(char)NULL;
  815.                                 blf=ON;
  816.                         }
  817.  
  818.  
  819.                         /* default user definition file name */
  820.  
  821.                         else if(strncmp(line,"def=",4)==NULL)
  822.                         {
  823.                                 strncpy(deffil,line+4,FLNMLN-1);
  824.                                 deffil[FLNMLN-1]=(char)NULL;
  825.                                 def=ON;
  826.                         }
  827.  
  828.                         /* directory file name */
  829.  
  830.                         else if(strncmp(line,"dir=",4)==NULL)
  831.                         {
  832.                                 strncpy(dirfil,line+4,FLNMLN-1);
  833.                                 dirfil[FLNMLN-1]=(char)NULL;
  834.                                 dir=ON;
  835.                         }
  836.  
  837.                         /* help file name */
  838.  
  839.                         else if(strncmp(line,"hlp=",4)==NULL)
  840.                         {
  841.                                 strncpy(hlpfil,line+4,FLNMLN-1);
  842.                                 hlpfil[FLNMLN-1]=(char)NULL;
  843.                                 hlp=ON;
  844.                         }
  845.  
  846.                         /* jsn file name */
  847.  
  848.                         else if(strncmp(line,"jsn=",4)==NULL)
  849.                         {
  850.                                 strncpy(jsnfil,line+4,FLNMLN-1);
  851.                                 jsnfil[FLNMLN-1]=(char)NULL;
  852.                                 jsn=ON;
  853.                         }
  854.  
  855.                         /* login flag */
  856.  
  857.                         else if(strncmp(line,"log=",4)==NULL)
  858.                         {
  859.                                 strncpy(logset,line+4,3);
  860.                                 logset[4]=(char)NULL;
  861.                                 log=ON;
  862.                         }
  863.  
  864.                         /* modem initialization string */
  865.  
  866.                         else if(strncmp(line,"mod=",4)==NULL)
  867.                         {
  868.                                 strncpy(modem,line+4,LINLEN-1);
  869.                                 modem[LINLEN-1]=(char)NULL;
  870.                                 repchar(modem,'_',' ');
  871.                                 mod=ON;
  872.                         }
  873.  
  874.                         /* news file name */
  875.  
  876.                         else if(strncmp(line,"new=",4)==NULL)
  877.                         {
  878.                                 strncpy(newfil,line+4,FLNMLN-1);
  879.                                 newfil[FLNMLN-1]=(char)NULL;
  880.                                 new=ON;
  881.                         }
  882.  
  883.                         /* port number */
  884.  
  885.                         else if( strncmp(line,"por=",4)==NULL)
  886.                         {
  887.                                 strncpy(portstr,line+4,3);
  888.                                 portstr[3]=(char)NULL;
  889.                                 por=ON;
  890.                                 if(sscanf(portstr,"%u",&i)==NULL)
  891.                                         por=OFF;
  892.                         }
  893.  
  894.                         /* default privileges */
  895. #ifndef NETWORK
  896.             else if(strncmp(line,"net=",4)==NULL)
  897.             {
  898.                 pri=pri;
  899.             }
  900.                         else if(strncmp(line,"pri=",4)==NULL)
  901.                         {
  902.                                 strncpy(privs,line+4,FLNMLN-1);
  903.                                 privs[FLNMLN-1]=(char)NULL;
  904.                                 pri=ON;
  905.                         }
  906. #else
  907.             else if(strncmp(line,"pri=",4)==NULL)
  908.             {
  909.                 pri=pri;
  910.             }
  911.                         else if(strncmp(line,"net=",4)==NULL)
  912.                         {
  913.                                 strncpy(privs,line+4,FLNMLN-1);
  914.                                 privs[FLNMLN-1]=(char)NULL;
  915.                                 pri=ON;
  916.                         }
  917. #endif
  918.                         /* default user prologue file name */
  919.  
  920.                         else if(strncmp(line,"pro=",4)==NULL)
  921.                         {
  922.                                 strncpy(profil,line+4,FLNMLN-1);
  923.                                 profil[FLNMLN-1]=(char)NULL;
  924.                                 pro=ON;
  925.                         }
  926.  
  927.                         /* default user directory file name */
  928.  
  929.                         else if(strncmp(line,"usr=",4)==NULL)
  930.                         {
  931.                                 strncpy(usrfil,line+4,FLNMLN-1);
  932.                                 usrfil[FLNMLN-1]=(char)NULL;
  933.                                 usr=ON;
  934.                         }
  935.  
  936.                         /* user validation list file name */
  937.  
  938.                         else if(strncmp(line,"val=",4)==NULL)
  939.                         {
  940.                                 strncpy(valfil,line+4,FLNMLN-1);
  941.                                 valfil[FLNMLN-1]=(char)NULL;
  942.                                 val=ON;
  943.                         }
  944.                         else
  945.                         {
  946.                                 printf("%s\n",line);
  947.                                 return(-1);
  948.                         }
  949.                 }
  950.         }
  951.         if(sys!=NULL) fclose(sys);
  952.  
  953.         /* if flag is not set, set default */
  954.  
  955.         if(acc==OFF)strcpy(access,"immediate");
  956.         if(act==OFF)strcpy(actfil,"slugact.dat");
  957.         if(bgn==OFF)strcpy(bgnfil,"slugbgn.dat");
  958.         if(bil==OFF)strcpy(billing,"off");
  959.         if(blf==OFF)strcpy(bilfil,"slugbil.dat");
  960.         if(def==OFF)strcpy(deffil,"slugdef.dat");
  961.         if(dir==OFF)strcpy(dirfil,"slugdir.dat");
  962.         if(hlp==OFF)strcpy(hlpfil,"slughlp.dat");
  963.         if(jsn==OFF)strcpy(jsnfil,"slugjsn.dat");
  964.         if(log==OFF)strcpy(logset,"off");
  965.         if(mod==OFF)strcpy(modem,"ATZ S0=1 X1 E0 V0 S2=128");
  966.         if(new==OFF)strcpy(newfil,"slugnew.dat");
  967. #ifdef SYSV2
  968.         if(pri==OFF)strcpy(privs,PRIVS);
  969. #endif SYSV2
  970. #ifdef SYSV3
  971.         if(pri==OFF)strcpy(privs,PRIVS);
  972. #endif SYSV3
  973. #ifdef BSD4
  974.         if(pri==OFF)strcpy(privs,PRIVS);
  975. #endif BSD4
  976. #ifdef ULTRIX
  977.         if(pri==OFF)strcpy(privs,PRIVS);
  978. #endif ULTRIX
  979.         if(pro==OFF)strcpy(profil,"slugpro.dat");
  980.         if(usr==OFF)strcpy(usrfil,"slugusr.dat");
  981.         if(val==OFF)strcpy(valfil,"slugval.dat");
  982.  
  983.         return(NULL);
  984.  
  985. }
  986. \End\Of\Shar\
  987. else
  988.   echo "will not over write ./getcfg.c"
  989. fi
  990. chmod 400 ./getcfg.c
  991. if [ `wc -c ./getcfg.c | awk '{printf $1}'` -ne 9386 ]
  992. then
  993. echo `wc -c ./getcfg.c | awk '{print "Got " $1 ", Expected " 9386}'`
  994. fi
  995. if `test ! -s ./getjsn.c`
  996. then
  997. echo "writing ./getjsn.c"
  998. cat > ./getjsn.c << '\End\Of\Shar\'
  999. /* @(#)getjsn.c    1.2 */
  1000. #include "slugnet.h"
  1001.  
  1002. int getjsn(jsn,jsnfil,rcvfil)
  1003.  
  1004. /* creates  the user's jsn and receiver file according to info found in sysfil */
  1005.  
  1006. char jsn[JSNLEN],jsnfil[FLNMLN],rcvfil[FLNMLN];
  1007. {
  1008.         FILE *djsn,*rcv;
  1009. #ifdef SYSV2
  1010.     FILE *fopen();
  1011. #endif SYSV2
  1012.         int i;
  1013.  
  1014.  
  1015.         /* read jsn from jsn file */
  1016.  
  1017.         lock(jsnfil);
  1018.     djsn=fopen(jsnfil,"r");
  1019.         if(djsn==NULL)
  1020.                 strcpy(jsn,"aaaa");
  1021.         else
  1022.         {
  1023.                 fscanf(djsn,"%4s",jsn);
  1024.                 fclose(djsn);
  1025.                 i=3;
  1026.                 while(i>=0)
  1027.                 {
  1028.                         if(jsn[i]=='z')
  1029.                         {
  1030.                                 jsn[i]='a';
  1031.                                 --i;
  1032.                         }
  1033.                         else
  1034.                         {
  1035.                                 jsn[i]=(char)((int)jsn[i]+1);
  1036.                                 i= -1;
  1037.                         }
  1038.                 }
  1039.         }
  1040.  
  1041.         /* printf("%s\n",jsnfil); */
  1042.  
  1043.         djsn=fopen(jsnfil,"w");
  1044.         if(djsn==NULL)
  1045.         {
  1046.         unlock(jsnfil);
  1047.                 return(-1);
  1048.         }
  1049.         else
  1050.         {
  1051.                 chmod(jsnfil,00600);
  1052.                 fprintf(djsn,"%4s",jsn);
  1053.                 fclose(djsn);
  1054.         unlock(jsnfil);
  1055.         }
  1056.  
  1057.         /* create receive file */
  1058.  
  1059.         strcpy(rcvfil,jsn);
  1060.         strcat(rcvfil,"rcv.dat");
  1061.  
  1062.         /* printf("%s\n",rcvfil); */
  1063.  
  1064.     lock(rcvfil);
  1065.     /* mknod( rcvfil, 0010000 | 0000400 | 0000200, NULL ); */
  1066.         rcv=fopen(rcvfil,"w");
  1067.         if(rcv==NULL)
  1068.         {
  1069.         unlock(rcvfil);
  1070.                 return(-2);
  1071.         }
  1072.         chmod(rcvfil,00600);
  1073.         fclose(rcv);
  1074.     unlock(rcvfil);
  1075.         return(NULL);
  1076.  
  1077. }
  1078. \End\Of\Shar\
  1079. else
  1080.   echo "will not over write ./getjsn.c"
  1081. fi
  1082. chmod 400 ./getjsn.c
  1083. if [ `wc -c ./getjsn.c | awk '{printf $1}'` -ne 1721 ]
  1084. then
  1085. echo `wc -c ./getjsn.c | awk '{print "Got " $1 ", Expected " 1721}'`
  1086. fi
  1087. if `test ! -s ./lock.c`
  1088. then
  1089. echo "writing ./lock.c"
  1090. cat > ./lock.c << '\End\Of\Shar\'
  1091. /* @(#)lock.c    1.2 */
  1092. #include "slugnet.h" 
  1093.  
  1094. lock( string )
  1095.  
  1096. /* psuedo file locking */
  1097.  
  1098. char string[];
  1099. {
  1100.     char lstring[FLNMLN+FLNMLN];
  1101.     int i,j;
  1102. #ifdef SYSV2
  1103.     unsigned sleep(),u;
  1104. #endif SYSV2
  1105. #ifdef SYSV3
  1106.     unsigned sleep(),u;
  1107. #endif SYSV3
  1108. #ifdef ULTRIX
  1109.     void sleep();
  1110. #endif ULTRIX
  1111.  
  1112.     strcpy(lstring,"LCK_");
  1113.     strcat(lstring,string);
  1114.     i = (int)NULL;
  1115.     j = (int)NULL;
  1116.     while( i <= (int)NULL )
  1117.     {
  1118.         i = creat( lstring, O_CREAT | O_EXCL );
  1119.         if( i <= (int)NULL )
  1120.         {
  1121. #ifdef SYSV2
  1122.             sleep((unsigned)1);
  1123. #endif SYSV2
  1124. #ifdef SYSV3
  1125.             u=sleep((unsigned)1);
  1126. #endif SYSV3
  1127. #ifdef BSD4
  1128.              sleep((unsigned)1);
  1129. #endif BSD4
  1130. #ifdef ULTRIX
  1131.              sleep((unsigned)1);
  1132. #endif ULTRIX
  1133.             ++j;
  1134.             /* if wait is longer than timeout, stop */
  1135.             if(j > TIMEOUT)
  1136.                 goto quit;
  1137.         }
  1138.     }
  1139.         chmod(lstring,00600);
  1140.     close(i);
  1141.     quit:;
  1142. }
  1143. \End\Of\Shar\
  1144. else
  1145.   echo "will not over write ./lock.c"
  1146. fi
  1147. chmod 400 ./lock.c
  1148. if [ `wc -c ./lock.c | awk '{printf $1}'` -ne 807 ]
  1149. then
  1150. echo `wc -c ./lock.c | awk '{print "Got " $1 ", Expected " 807}'`
  1151. fi
  1152. if `test ! -s ./lower.c`
  1153. then
  1154. echo "writing ./lower.c"
  1155. cat > ./lower.c << '\End\Of\Shar\'
  1156. /* @(#)lower.c    1.2 */
  1157. #include "slugnet.h"
  1158.  
  1159. int lower(string)
  1160.  
  1161. /* converts lower case to upper case */
  1162.  
  1163. char string[];
  1164. {
  1165.         static char low[27]="abcdefghijklmnopqrstuvwxyz";
  1166.         static char high[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  1167.         int i,j;
  1168.         j=0;
  1169.         for(i=0;i<26;i++) j=j+repchar(string,high[i],low[i]);
  1170.         return(j);
  1171. }
  1172. \End\Of\Shar\
  1173. else
  1174.   echo "will not over write ./lower.c"
  1175. fi
  1176. chmod 400 ./lower.c
  1177. if [ `wc -c ./lower.c | awk '{printf $1}'` -ne 351 ]
  1178. then
  1179. echo `wc -c ./lower.c | awk '{print "Got " $1 ", Expected " 351}'`
  1180. fi
  1181. if `test ! -s ./main.c`
  1182. then
  1183. echo "writing ./main.c"
  1184. cat > ./main.c << '\End\Of\Shar\'
  1185. /* @(#)main.c    1.6 */
  1186. #ifdef NETWORK
  1187. #ifdef INTERLAN
  1188. #include <signal.h>
  1189. #define SIGCHLD SIGCLD
  1190. #define SIGURG SIGUSR2
  1191. #endif INTERLAN
  1192.  
  1193. #include "net.h"
  1194.  
  1195. void cleanup(), task();
  1196.  
  1197. main( argc, argv )
  1198. int argc;
  1199. char *argv[];
  1200. {
  1201.     char *rhost;
  1202.     extern int optind;
  1203.     extern char *optarg;
  1204.     int a, i, n, s, t;
  1205.  
  1206.     a = 0; n= 0; rhost = (char *)NULL;
  1207.     
  1208.     while(( i = getopt( argc, argv, "a:n:" )) != EOF ){
  1209.         switch( i ) {
  1210.         
  1211.         /* address */
  1212.  
  1213.         case 'a':
  1214.             a = 1; n = 0; rhost = optarg; break;
  1215.  
  1216.         case 'n':
  1217.             a = 0; n = 1; rhost = optarg; break;
  1218.         }
  1219.     }
  1220.  
  1221.     if( rhost != (char *)NULL ){
  1222.         for(;;){
  1223.             s = 0;
  1224.             while( s == 0 ){
  1225.                 if( a )
  1226.                     s = callbyaddr( rhost, PORTNUM );
  1227.                 if( n ) 
  1228.                     s = callbyhost( rhost, PORTNUM );
  1229.             }
  1230.             i = slugnet( s, rhost );
  1231.             close( s );
  1232.             fprintf( stderr, "slugnet: Error %d\n", i );
  1233.             exit(1);
  1234.         }
  1235.     }
  1236.  
  1237.             
  1238.  
  1239.     if ((s= establish(PORTNUM)) < 0) {  /* plug in the phone */
  1240.         perror("establish");
  1241.         exit(1);
  1242.     }
  1243.  
  1244.     signal(SIGCHLD, cleanup); /* this eliminates zombies */
  1245.  
  1246.     /* loop for phone calls */
  1247.  
  1248.     for (;;) {                         
  1249.  
  1250.         /* get a connection */
  1251.  
  1252.         if ((t= get_connection(s)) < 0) {
  1253.  
  1254.             /* EINTR might happen on accept(), */
  1255.  
  1256.             if (errno == EINTR)             
  1257.  
  1258.                 /* try again */
  1259.  
  1260.                 continue;   
  1261.             
  1262.             /* bad */                  
  1263.  
  1264.             perror("accept");               
  1265.             exit(1);
  1266.         }
  1267.  
  1268.         /* try to handle connection */
  1269.  
  1270.         switch(fork()) {                 
  1271.  
  1272.         /* bad news.  scream and die */
  1273.  
  1274.         case -1 :                         
  1275.             perror("fork");
  1276.             close(s);
  1277.             exit(1);
  1278.  
  1279.         /* we're the child, do something */
  1280.  
  1281.         case 0 :                          
  1282.             task(t);
  1283.             exit(0);
  1284.  
  1285.         /* we're the parent so look for another connection */
  1286.                       
  1287.         default :                         
  1288.             close( t );
  1289.             continue; 
  1290.         }
  1291.     }
  1292. }
  1293. #endif NETWORK
  1294. \End\Of\Shar\
  1295. else
  1296.   echo "will not over write ./main.c"
  1297. fi
  1298. chmod 400 ./main.c
  1299. if [ `wc -c ./main.c | awk '{printf $1}'` -ne 1786 ]
  1300. then
  1301. echo `wc -c ./main.c | awk '{print "Got " $1 ", Expected " 1786}'`
  1302. fi
  1303. if `test ! -s ./net.h`
  1304. then
  1305. echo "writing ./net.h"
  1306. cat > ./net.h << '\End\Of\Shar\'
  1307. /* @(#)net.h    1.5 */
  1308. /* net include file */
  1309.  
  1310. #include <sys/param.h>
  1311. #include <errno.h>
  1312.  
  1313. #ifdef INTERLAN
  1314. #include <interlan/il_errno.h>
  1315. #endif
  1316.  
  1317. #include <signal.h>
  1318. #include <stdio.h>
  1319.  
  1320. #ifdef SYSV2
  1321. #include <sys/types.h>
  1322. #endif SYSV2
  1323.  
  1324. #ifdef SYSV3
  1325. #ifdef INTERLAN
  1326. #include <interlan/il_types.h>
  1327. #else
  1328. #include <sys/types.h>
  1329. #endif
  1330. #endif SYSV3
  1331.  
  1332. #ifdef INTERLAN
  1333. #include <interlan/socket.h>
  1334. #else
  1335. #include <sys/socket.h>
  1336. #endif
  1337.  
  1338. #ifdef BSD4
  1339. #include <sys/wait.h>
  1340. #endif BSD4
  1341.  
  1342. #ifdef ULTRIX
  1343. #include <sys/wait.h>
  1344. #endif ULTRIX
  1345.  
  1346. #ifdef INTERLAN
  1347. #include <interlan/in.h>
  1348. #include <interlan/netdb.h>
  1349. #define MAXHOSTNAMELEN 64
  1350. #else
  1351. #include <netinet/in.h>
  1352. #include <netdb.h>
  1353. #endif
  1354.  
  1355. #define PORTNUM 2727 /* use chat port number */
  1356.  
  1357. \End\Of\Shar\
  1358. else
  1359.   echo "will not over write ./net.h"
  1360. fi
  1361. chmod 400 ./net.h
  1362. if [ `wc -c ./net.h | awk '{printf $1}'` -ne 724 ]
  1363. then
  1364. echo `wc -c ./net.h | awk '{print "Got " $1 ", Expected " 724}'`
  1365. fi
  1366. if `test ! -s ./rdline.c`
  1367. then
  1368. echo "writing ./rdline.c"
  1369. cat > ./rdline.c << '\End\Of\Shar\'
  1370. /* @(#)rdline.c    1.2 */
  1371. #include "slugnet.h"
  1372.  
  1373. int rdline( fp, string, strln )
  1374.  
  1375. /* reads a file a line at a time */
  1376.  
  1377. FILE *fp;
  1378. char string[];
  1379. int strln;
  1380. {
  1381.         int c,i;
  1382.  
  1383.     for( i = 0; i < strln; ++i )
  1384.         string[ i ] = (char)NULL;
  1385.         c=0;
  1386.         i=0;
  1387.         strln=strln-1;
  1388.     for(i = 0; i < strln; ++i ){ 
  1389.                 c=fgetc(fp);
  1390.         if( c == CR || c == LF ) {
  1391.                 string[i]=(char)NULL;
  1392.             break; 
  1393.         } else if( feof(fp)==NULL )
  1394.                     string[i]=(char)c;
  1395.         else {
  1396.                 string[i]=(char)NULL;
  1397.             break;
  1398.         }
  1399.         }
  1400.         string[i]=(char)NULL;
  1401.     
  1402.         return(i);
  1403. }
  1404. \End\Of\Shar\
  1405. else
  1406.   echo "will not over write ./rdline.c"
  1407. fi
  1408. chmod 400 ./rdline.c
  1409. if [ `wc -c ./rdline.c | awk '{printf $1}'` -ne 594 ]
  1410. then
  1411. echo `wc -c ./rdline.c | awk '{print "Got " $1 ", Expected " 594}'`
  1412. fi
  1413. if `test ! -s ./receive.c`
  1414. then
  1415. echo "writing ./receive.c"
  1416. cat > ./receive.c << '\End\Of\Shar\'
  1417. /* @(#)receive.c    1.5 */
  1418. #include "slugnet.h"
  1419.  
  1420. #define VLDLEN 129
  1421.  
  1422. int receive( socket, string, maxlen, echoplex )
  1423.  
  1424. /* reads until a return is encountered, or maxlen-1 characters entered */
  1425.  
  1426. int socket;
  1427. char string[];
  1428. int maxlen,echoplex;
  1429. {
  1430.                                 /* 12345678911234567892123456789312345678941234567895123456789612345678971 23 456 78 9812345678991234 5 6 7 8 */
  1431.         static char valid[VLDLEN]=" 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./;'[]\`-=\\<>\?:\"{}~!@#$%^&*()+|_";
  1432.         char buffer[2];
  1433.         int c,err,i,tlen;
  1434.         tlen=0;
  1435.         for( i=0;i < maxlen; i++ ) string[i] = (char)NULL;
  1436.         --maxlen;
  1437.         i = 1;
  1438.         while( buffer[ 0 ] != '\n'  ){
  1439.         i = read( socket, buffer, 1 );
  1440.         if( i > 0 ){
  1441.             if(echoplex==ON){
  1442. #ifdef SYSV2
  1443.                  err = write( socket, buffer, i );
  1444. #endif SYSV2
  1445. #ifdef SYSV3
  1446.                  err = write( socket, buffer, i );
  1447. #endif SYSV3
  1448. #ifdef BSD4
  1449.                  err = write( socket, buffer, i );
  1450. #endif BSD4
  1451. #ifdef ULTRIX
  1452.                  err = write( socket, buffer, i );
  1453. #endif ULTRIX
  1454.             }
  1455.  
  1456.             if( find(valid,buffer[0],strlen(valid)) != -1 ){
  1457.                 string[tlen] = buffer[ 0 ];
  1458.                 ++tlen;
  1459.             }
  1460.             if( tlen == maxlen )
  1461.                 buffer[ 0 ] = '\n';
  1462.         
  1463.         } else if( i == 0 ){
  1464.             strcpy( string, "exit" );
  1465.             tlen = 5;
  1466.             break;
  1467.         } else {
  1468.             string[ 0 ] = ( char )NULL;
  1469.             tlen = 0;
  1470.             break;
  1471.         }
  1472.     }
  1473.         return(tlen);
  1474. }
  1475.  
  1476. #undef VLDLEN
  1477. \End\Of\Shar\
  1478. else
  1479.   echo "will not over write ./receive.c"
  1480. fi
  1481. chmod 400 ./receive.c
  1482. if [ `wc -c ./receive.c | awk '{printf $1}'` -ne 1392 ]
  1483. then
  1484. echo `wc -c ./receive.c | awk '{print "Got " $1 ", Expected " 1392}'`
  1485. fi
  1486. if `test ! -s ./repchar.c`
  1487. then
  1488. echo "writing ./repchar.c"
  1489. cat > ./repchar.c << '\End\Of\Shar\'
  1490. /* @(#)repchar.c    1.2 */
  1491. #include "slugnet.h"
  1492.  
  1493. int repchar(string,old,new)
  1494.  
  1495. /* replaces old character in a string with the new character */
  1496.  
  1497. char string[],old,new;
  1498. {
  1499.         int c,i;
  1500.         c=0;
  1501.         i=0;
  1502.         while(string[i]!=(char)NULL)
  1503.         {
  1504.                 if(string[i]==old)
  1505.                 {
  1506.                         string[i]=new;
  1507.                         ++c;
  1508.                 }
  1509.                 ++i;
  1510.         }
  1511.         return(c);
  1512. }
  1513. \End\Of\Shar\
  1514. else
  1515.   echo "will not over write ./repchar.c"
  1516. fi
  1517. chmod 400 ./repchar.c
  1518. if [ `wc -c ./repchar.c | awk '{printf $1}'` -ne 446 ]
  1519. then
  1520. echo `wc -c ./repchar.c | awk '{print "Got " $1 ", Expected " 446}'`
  1521. fi
  1522. if `test ! -s ./send_file.c`
  1523. then
  1524. echo "writing ./send_file.c"
  1525. cat > ./send_file.c << '\End\Of\Shar\'
  1526. /* @(#)send_file.c    1.2 */
  1527. #include "slugnet.h"
  1528.  
  1529. int send_file(socket,filnam)
  1530.  
  1531. /* transmits a file as an ascii stream */
  1532.  
  1533. int socket;
  1534. char filnam[];
  1535. {
  1536.         static char line[32]="\0";
  1537.         FILE *d_file;
  1538. #ifdef SYSV2
  1539.     FILE *fopen();
  1540. #endif SYSV2
  1541.         int c,len;
  1542.  
  1543.         len=0;
  1544.         d_file=fopen(filnam,"r");
  1545.         if(d_file!=NULL)
  1546.         {
  1547.                 c=NULL;
  1548.                 while(c!=EOF)
  1549.                 {
  1550.                         c=fgetc(d_file);
  1551.                         sprintf(line,"%c",(char)c);
  1552.                         len=len+transmit(socket,line,NOCRLF);
  1553.                 }
  1554.                 fclose(d_file);
  1555.         }
  1556.         len=len+transmit(socket," ",CRLF);
  1557.         return(len);
  1558. }
  1559. \End\Of\Shar\
  1560. else
  1561.   echo "will not over write ./send_file.c"
  1562. fi
  1563. chmod 400 ./send_file.c
  1564. if [ `wc -c ./send_file.c | awk '{printf $1}'` -ne 706 ]
  1565. then
  1566. echo `wc -c ./send_file.c | awk '{print "Got " $1 ", Expected " 706}'`
  1567. fi
  1568. if `test ! -s ./setjsn.c`
  1569. then
  1570. echo "writing ./setjsn.c"
  1571. cat > ./setjsn.c << '\End\Of\Shar\'
  1572. /* @(#)setjsn.c    1.2 */
  1573. #include "slugnet.h"
  1574.  
  1575. int setjsn(jsn,jsnfil)
  1576.  
  1577. /* updates the local jsn to jsn, if conditions are met */
  1578.  
  1579. char jsn[JSNLEN],jsnfil[FLNMLN];
  1580. {
  1581.     char ojsn[ JSNLEN ];
  1582.         FILE *djsn;
  1583. #ifdef SYSV2
  1584.     FILE *fopen();
  1585. #endif SYSV2
  1586.         int i;
  1587.  
  1588.  
  1589.         /* read jsn from jsn file */
  1590.  
  1591.         lock(jsnfil);
  1592.     djsn=fopen(jsnfil,"r");
  1593.         if(djsn==NULL)
  1594.                 strcpy(ojsn,"zzzz");
  1595.         else
  1596.         {
  1597.                 fscanf(djsn,"%4s",ojsn);
  1598.                 fclose(djsn);
  1599.     }
  1600.  
  1601.     /* decide whether to update jsn or not */
  1602.  
  1603.     for( i = 0; i < JSNLEN; ++i ){
  1604.     
  1605.         if( i == 0 ){
  1606.             if( jsn[ i ] == 'z' ){
  1607.                 if( ojsn[ i ] == 'a' )
  1608.                     break;
  1609.             } else if( jsn[ i ] > ojsn [ i ] ){
  1610.                 strcpy( ojsn, jsn );
  1611.                 break;
  1612.             }
  1613.         } else if( jsn[ i ] > ojsn [ i ] ){
  1614.             strcpy( ojsn, jsn );
  1615.             break;
  1616.         }
  1617.         }
  1618.  
  1619.         djsn=fopen(jsnfil,"w");
  1620.         if(djsn==NULL)
  1621.         {
  1622.         unlock(jsnfil);
  1623.                 return(-1);
  1624.         }
  1625.         else
  1626.         {
  1627.                 chmod(jsnfil,00600);
  1628.                 fprintf(djsn,"%4s",ojsn);
  1629.                 fclose(djsn);
  1630.         unlock(jsnfil);
  1631.         }
  1632.  
  1633.         return(NULL);
  1634.  
  1635. }
  1636. \End\Of\Shar\
  1637. else
  1638.   echo "will not over write ./setjsn.c"
  1639. fi
  1640. chmod 400 ./setjsn.c
  1641. if [ `wc -c ./setjsn.c | awk '{printf $1}'` -ne 1140 ]
  1642. then
  1643. echo `wc -c ./setjsn.c | awk '{print "Got " $1 ", Expected " 1140}'`
  1644. fi
  1645. if `test ! -s ./sighang.c`
  1646. then
  1647. echo "writing ./sighang.c"
  1648. cat > ./sighang.c << '\End\Of\Shar\'
  1649. /* @(#)sighang.c    1.2 */
  1650. #include "slugnet.h"
  1651.  
  1652. #ifdef SYSV2
  1653. void sighang()
  1654. #endif SYSV2
  1655. #ifdef SYSV3
  1656. void sighang()
  1657. #endif SYSV3
  1658. #ifdef BSD4
  1659. sighang()
  1660. #endif BSD4
  1661. #ifdef ULTRIX
  1662. sighang()
  1663. #endif ULTRIX
  1664. {
  1665.     signal(SIGHUP, sighang);
  1666.     if(hungup==OFF)
  1667.         hungup=ON;
  1668. }
  1669. \End\Of\Shar\
  1670. else
  1671.   echo "will not over write ./sighang.c"
  1672. fi
  1673. chmod 400 ./sighang.c
  1674. if [ `wc -c ./sighang.c | awk '{printf $1}'` -ne 260 ]
  1675. then
  1676. echo `wc -c ./sighang.c | awk '{print "Got " $1 ", Expected " 260}'`
  1677. fi
  1678. if `test ! -s ./sigquit.c`
  1679. then
  1680. echo "writing ./sigquit.c"
  1681. cat > ./sigquit.c << '\End\Of\Shar\'
  1682. /* @(#)sigquit.c    1.2 */
  1683. #include "slugnet.h"
  1684.  
  1685. #ifdef SYSV2
  1686. void sigquit()
  1687. #endif SYSV2
  1688. #ifdef SYSV3
  1689. void sigquit()
  1690. #endif SYSV3
  1691. #ifdef BSD4
  1692. sigquit()
  1693. #endif BSD4
  1694. #ifdef ULTRIX
  1695. sigquit()
  1696. #endif ULTRIX
  1697. {
  1698.     signal(SIGQUIT,sigquit);
  1699.     if( hungup==OFF)
  1700.         hungup=ON;
  1701. }
  1702. \End\Of\Shar\
  1703. else
  1704.   echo "will not over write ./sigquit.c"
  1705. fi
  1706. chmod 400 ./sigquit.c
  1707. if [ `wc -c ./sigquit.c | awk '{printf $1}'` -ne 261 ]
  1708. then
  1709. echo `wc -c ./sigquit.c | awk '{print "Got " $1 ", Expected " 261}'`
  1710. fi
  1711. if `test ! -s ./sigstop.c`
  1712. then
  1713. echo "writing ./sigstop.c"
  1714. cat > ./sigstop.c << '\End\Of\Shar\'
  1715. /* @(#)sigstop.c    1.2 */
  1716. #include "slugnet.h"
  1717.  
  1718. #ifdef SYSV2
  1719. void sigstop()
  1720. #endif SYSV2
  1721. #ifdef SYSV3
  1722. void sigstop()
  1723. #endif SYSV3
  1724. #ifdef BSD4
  1725. sigstop()
  1726. #endif BSD4
  1727. #ifdef ULTRIX
  1728. sigstop()
  1729. #endif ULTRIX
  1730. {
  1731.         signal(SIGINT , sigstop);
  1732.     if( stopscroll==OFF)
  1733.         stopscroll=ON;
  1734. }
  1735. \End\Of\Shar\
  1736. else
  1737.   echo "will not over write ./sigstop.c"
  1738. fi
  1739. chmod 400 ./sigstop.c
  1740. if [ `wc -c ./sigstop.c | awk '{printf $1}'` -ne 277 ]
  1741. then
  1742. echo `wc -c ./sigstop.c | awk '{print "Got " $1 ", Expected " 277}'`
  1743. fi
  1744. if `test ! -s ./sigterm.c`
  1745. then
  1746. echo "writing ./sigterm.c"
  1747. cat > ./sigterm.c << '\End\Of\Shar\'
  1748. /* @(#)sigterm.c    1.2 */
  1749. #include "slugnet.h"
  1750.  
  1751. #ifdef SYSV2
  1752. void sigterm()
  1753. #endif SYSV2
  1754. #ifdef SYSV3
  1755. void sigterm()
  1756. #endif SYSV3
  1757. #ifdef BSD4
  1758. sigterm()
  1759. #endif BSD4
  1760. #ifdef ULTRIX
  1761. sigterm()
  1762. #endif ULTRIX
  1763. {
  1764.     signal(SIGTERM,sigterm);
  1765. }
  1766. \End\Of\Shar\
  1767. else
  1768.   echo "will not over write ./sigterm.c"
  1769. fi
  1770. chmod 400 ./sigterm.c
  1771. if [ `wc -c ./sigterm.c | awk '{printf $1}'` -ne 230 ]
  1772. then
  1773. echo `wc -c ./sigterm.c | awk '{print "Got " $1 ", Expected " 230}'`
  1774. fi
  1775. if `test ! -s ./sigtstp.c`
  1776. then
  1777. echo "writing ./sigtstp.c"
  1778. cat > ./sigtstp.c << '\End\Of\Shar\'
  1779. /* @(#)sigtstp.c    1.2 */
  1780. #include "slugnet.h"
  1781.  
  1782. #ifdef SYSV2
  1783. void sigtstp()
  1784. #endif SYSV2
  1785. #ifdef SYSV3
  1786. void sigtstp()
  1787. #endif SYSV3
  1788. #ifdef BSD4
  1789. sigtstp()
  1790. #endif BSD4
  1791. #ifdef ULTRIX
  1792. sigtstp()
  1793. #endif ULTRIX
  1794. {
  1795. #ifdef ULTRIX
  1796.         signal(SIGTSTP , sigtstp);
  1797. #endif ULTRIX
  1798. #ifdef BSD4
  1799.         signal(SIGTSTP , sigtstp);
  1800. #endif BSD4
  1801.     if( stopscroll==OFF)
  1802.         stopscroll=ON;
  1803. }
  1804. \End\Of\Shar\
  1805. else
  1806.   echo "will not over write ./sigtstp.c"
  1807. fi
  1808. chmod 400 ./sigtstp.c
  1809. if [ `wc -c ./sigtstp.c | awk '{printf $1}'` -ne 365 ]
  1810. then
  1811. echo `wc -c ./sigtstp.c | awk '{print "Got " $1 ", Expected " 365}'`
  1812. fi
  1813. if `test ! -s ./sigurg.c`
  1814. then
  1815. echo "writing ./sigurg.c"
  1816. cat > ./sigurg.c << '\End\Of\Shar\'
  1817. /* @(#)sigurg.c    1.2 */
  1818. #ifdef NETWORK
  1819. #include "slugnet.h"
  1820.  
  1821. #ifdef SYSV2
  1822. void sigurg()
  1823. #endif SYSV2
  1824. #ifdef SYSV3
  1825. void sigurg()
  1826. #endif SYSV3
  1827. #ifdef BSD4
  1828. sigurg()
  1829. #endif BSD4
  1830. #ifdef ULTRIX
  1831. sigurg()
  1832. #endif ULTRIX
  1833. {
  1834.     signal(SIGURG,sigurg);
  1835.     if( hungup==OFF)
  1836.         hungup=ON;
  1837. }
  1838. #endif NETWORK
  1839. \End\Of\Shar\
  1840. else
  1841.   echo "will not over write ./sigurg.c"
  1842. fi
  1843. chmod 400 ./sigurg.c
  1844. if [ `wc -c ./sigurg.c | awk '{printf $1}'` -ne 284 ]
  1845. then
  1846. echo `wc -c ./sigurg.c | awk '{print "Got " $1 ", Expected " 284}'`
  1847. fi
  1848. if `test ! -s ./slughlp.dat`
  1849. then
  1850. echo "writing ./slughlp.dat"
  1851. cat > ./slughlp.dat << '\End\Of\Shar\'
  1852. *BELL: 
  1853.        Bell                Send a control-G to the user's terminal.
  1854.   
  1855. *BROADCAST: 
  1856.        Broadcast           Sends a message to all conferences.
  1857.   
  1858. *BYE: 
  1859.        Bye                 Log off Slugnet ( and system ).
  1860.   
  1861. *CLEAR:
  1862.        Clear               Clears the user's message buffer.
  1863.  
  1864. *COPYRIGHT:
  1865.                             Slugnet
  1866.  
  1867.               COPYRIGHT 1988 James R. Purdon III
  1868.  
  1869.                       All rights reserved.
  1870.  
  1871. *DELAY: 
  1872.        Delay               Rolls out the terminal for a period of
  1873.                            time ( default is 15 seconds ).  This
  1874.                            time can be changed using the 'Set delay'
  1875.                            command.
  1876.   
  1877. *EXIT: 
  1878.        Exit                Exit Slugnet.
  1879.   
  1880. *HELP: 
  1881.        Help n              Displays help for n, where n is a Slugnet
  1882.                            command or topic. A list of topics can be
  1883.                            obtained by typing 'help' with no arguments.
  1884.   
  1885. *JOIN: 
  1886.        Join n              Leave current conference and join or
  1887.                            create n, where n is a conference name.
  1888.                            Join will create new conferences.  If a
  1889.                            conference name begins with '-', it will
  1890.                            not be displayed by a "Show conferences"
  1891.                            command. If no conference name is given,
  1892.                            the conference "Root" is joined.
  1893.   
  1894. *REWIND: 
  1895.        Rewind              Rewinds the input stream.
  1896.   
  1897. *RING: 
  1898.        Ring n              Sends a control-G sequence to n, where
  1899.                            n is the JSN.
  1900. *SCROLL:
  1901.        Scroll              Enter scroll mode.  In scroll mode, the
  1902.                            user's receive buffer is scanned without
  1903.                            pausing for input.  When using a local 
  1904.                            copy of slugnet, scroll mode may be 
  1905.                            cancelled by entering the INTR control 
  1906.                            character.  When using a remote copy the 
  1907.                            RETURN character should be used.
  1908.  
  1909. *SEND: 
  1910.        Send n              Send a private message to n, where n is a
  1911.                            JSN.  If n is blank, message will be
  1912.                            broadcast to all conference members.
  1913.  
  1914. *SET CONFIGURATION:
  1915.        Set configuration   Saves the user's configuration in a file
  1916.                            called "slugcon.dat" in the current working
  1917.                            directory.  Slugnet will use this file to
  1918.                            restore the user's configuration whenever
  1919.                            it is invoked.
  1920.  
  1921. *SET CONTINUOUS:
  1922.        Set continuous n    Sets continuous mode to n, where n is ON
  1923.                            or OFF.  When continuous mode is ON, new
  1924.                            messages are displayed automatically, and
  1925.                            the prompt is not displayed (unless the
  1926.                            user issues a "set prompt on" after entering
  1927.                            continuous mode - this is NOT recommended).
  1928.                            Setting continuous mode OFF will also set
  1929.                            prompt mode on.  The time between checks
  1930.                            for new messages is specified by the
  1931.                            SET DELAY command.
  1932.  
  1933. *SET DEFINITION:
  1934.        Set definition n    Sets the user definition file name
  1935.                            to n.  The default name is SLUGDEF.DAT.
  1936.                            The user definition file should already
  1937.                            exist and be a permanent file ( see the
  1938.                            help entry for a description of the user
  1939.                            definition file ).
  1940.  
  1941. *SET DELAY: 
  1942.        Set delay n         Set the delay time to n seconds, where n
  1943.                            is an integer between 0 and 9999>  The
  1944.                            delay time is used by scroll mode, the
  1945.                            delay command, and continuous mode.
  1946.   
  1947. *SET ECHO: 
  1948.        Set echo n          Set echo mode to n, where n is ON or OFF.
  1949.                            If echo mode is set to OFF, messages sent
  1950.                            by the user and lines from a redirected
  1951.                            input file are not echoed.
  1952.  
  1953. *SET LOGIN:
  1954.        Set login n         Set the user's login name to n, where n is
  1955.                            a text string.  This option is only available
  1956.                            when Slugnet is operating as a network server.
  1957.                            If no login is specified, or Slugnet is unable
  1958.                            to verify the specified login, the login will
  1959.                            be set to 'unknown'.
  1960.  
  1961. *SET NAME: 
  1962.        Set name n          Set the user's name to n, where n is a
  1963.                            text string.  If no name is specified,
  1964.                            the name will be set to 'Anonymous'.
  1965.   
  1966. *SET NOVICE: 
  1967.        Set novice n        Set novice mode to n, where n is ON or
  1968.                            OFF.  When novice mode is OFF, it is no
  1969.                            longer necessary to precede message text
  1970.                            with a blank.
  1971.   
  1972. *SET PROMPT: 
  1973.        Set prompt n        Set prompt mode to n, where n is ON or
  1974.                            OFF.  When prompt mode is OFF, the name
  1975.                            of the current conference is no longer
  1976.                            printed on an input request.
  1977.   
  1978. *SET RING: 
  1979.        Set ring n          Set ring mode to n, where n is ON or OFF.
  1980.                            When ring mode is OFF, the user's terminal
  1981.                            will not respond to 'Ring' commands given
  1982.                            by other users.
  1983.   
  1984. *SET TIMER: 
  1985.        Set timer n         Sets timer mode to n, where n is ON or OFF.
  1986.                            When timer mode is ON, a time stamp is sent
  1987.                            to the output stream while in scroll and wait
  1988.                            wait modes.
  1989.   
  1990. *SET WAIT: 
  1991.        Set wait n          Sets the string used by the 'wait' command
  1992.                            to n.  The default string is "From".
  1993.   
  1994. *SHOW BUFFER
  1995.        Show buffer         Displays the user's message buffer.
  1996.  
  1997. *SHOW CONFERENCES: 
  1998.        Show conferences    Displays active conferences ( except
  1999.                            for conferences whose name begins
  2000.                            with '-' ).
  2001.   
  2002. *SHOW CONFIGURATION:
  2003.        Show configuration  Displays the user's current configuration.
  2004.  
  2005. *SHOW HOSTS:
  2006.        Show hosts          Displays the host names of the members of the
  2007.                            current conference.
  2008.  
  2009. *SHOW LOGINS:
  2010.        Show logins         Displays the login names of the members of the
  2011.                            current conference.  This information may not
  2012.                            be completely accurate.
  2013.  
  2014. *SHOW MEMBERS: 
  2015.        Show members        Displays the JSN, login, host name, and name of 
  2016.                            all members of your current conference.  The
  2017.                            login name and host name may be truncated to
  2018.                            fit on a line.
  2019.   
  2020. *WAIT: 
  2021.        Wait                Enters scroll mode until a specified
  2022.                            text string is received.  The default
  2023.                            text string is "From".  The string
  2024.                            can be set with the 'Set wait' command.
  2025.                            When using a local copy of slugnet, wait 
  2026.                            mode may be cancelled by entering the INTR 
  2027.                            control character.  When using a remote 
  2028.                            copy the RETURN character should be used.
  2029.   
  2030. *WRITE:
  2031.        Write n             Writes the user's message buffer to the
  2032.                            file n.
  2033.  
  2034. *OS COMMANDS:
  2035.        !n                  Pass n to the OS for processing, where n
  2036.                            is a OS command ( n should be followed
  2037.                            by a period ).  After the command has
  2038.                            been processed, Slugnet will resume.
  2039.   
  2040. *ENTERING COMMANDS AND TEXT: 
  2041.   
  2042.                   Entering Commands and Message Text
  2043.   
  2044.        All input starting in column 1 will be interpreted as
  2045.        Slugnet commands.  Input intended as message text should
  2046.        begin in column 2.  A blank line or a "Send" command will
  2047.        flush the message buffer and send the text.
  2048.   
  2049.        If novice mode is set to OFF, message text does not have
  2050.        to begin in column 2.  However, if the text contains an
  2051.        embedded command string starting in column 1, Slugnet will
  2052.        attempt to process the command.
  2053.   
  2054. *RESERVED CHARACTERS: 
  2055.   
  2056.                         Reserved Characters
  2057.   
  2058.        Slugnet reserves the characters '<', '>', '*', and '!'
  2059.        in column 1 for input redirection, output redirection,
  2060.        comments, and OS command flag.
  2061.   
  2062. *FILE REDIRECTION: 
  2063.   
  2064.                              File Redirection
  2065.   
  2066.        Slugnet allows redirection of the input and output streams,
  2067.        using <n or >n, where n is a valid name of a local Nos file
  2068.        ( >n will create the file ).  The output stream is restored
  2069.        to the terminal by entering '>output' or '>'.  The input
  2070.        stream is restored to the terminal when a file partition,
  2071.        '<input', or '<' is encountered in an input stream.
  2072.   
  2073. *USER DEFINITION FILE:
  2074.   
  2075.                      The User Definition File
  2076.   
  2077.        Slugnet allows the user to define his or her own command
  2078.        phrases by means of a definition file.  When Slugnet
  2079.        encounters a command it does not understand, it attempts
  2080.        to open a definition file "slugdef.dat" ( SLUGnet DEFinition
  2081.        file ). If successful, it scans the contents of the file
  2082.        for a match with the user's command, and replaces the
  2083.        user's command with the definition.
  2084.   
  2085.        This allows for a great deal of freedom on the part of
  2086.        the user.  For example, a user who was used to the "/"
  2087.        command signal of many conference programs might make the
  2088.        following definition file:
  2089.   
  2090.        *
  2091.        * "/" definition file for users who love "/" commands
  2092.        * commands
  2093.        *
  2094.        /who=show members;
  2095.        /w=show members;
  2096.        *
  2097.        /name=set name;
  2098.        /n=set name;
  2099.        *
  2100.        /h=help;
  2101.        *
  2102.        /s=send;
  2103.        *
  2104.        /b=bye;
  2105.   
  2106.        With this file, the user would be able use /b, /h, /n, /s,
  2107.        and /w as commands. If several different users share the
  2108.        same login, they can create definition files with names
  2109.        other than "slugdef.dat" and use the 'Set definition'
  2110.        command to set the definition file name.
  2111.   
  2112.        Definitions should start in column 1 of the definition
  2113.        file and terminate with a semicolon ( ';' ).  The user's
  2114.        command should be separated from the definition by an
  2115.        equal sign ( '=' ).  Neither the user's command or the
  2116.        definition should contain equal signs or semicolons, other
  2117.        than the separator and terminator.  The definition does
  2118.        not have to be a Slugnet command, but may be any text
  2119.        string ( it will be interpreted just the same as if the
  2120.        user entered it directly ).
  2121.   
  2122. *ADDITIONAL NOTES: 
  2123.   
  2124.                           Additional Notes
  2125.   
  2126.        1. Slugnet Server messages may be recognized because they
  2127.           have the Server's user number in the "From" message.
  2128.   
  2129.        2. Slugnet allows the installer to set various options,
  2130.           such as permissions to access certain commands.  You
  2131.           may not be able to execute all of the commands for
  2132.           this reason.
  2133.  
  2134. *USER PROLOGUE FILE: 
  2135.   
  2136.                           The User Prologue File
  2137.   
  2138.           A user prologue file is file of Slugnet commands that
  2139.           the user wants executed when Slugnet is started.  By
  2140.           default, Slugnet looks for a file called "slugpro.dat",
  2141.           but the user may specify his own file name by using the
  2142.           "set prologue" command, followed by a "set configuration"
  2143.           command.
  2144.   
  2145. *EOF: 
  2146.  Help is available for the following commands and topics: 
  2147.   
  2148.  Additional notes    Bell      Broadcast           Bye       Clear
  2149.  Copyright           Delay     Entering commands and text    Exit
  2150.  File redirection    Help      Join      OS commands
  2151.  Reserved characters           Rewind    Ring      Scroll    Send
  2152.  Set configuration   Set continuous      Set definition      Set delay
  2153.  Set echo            Set login           Set name            Set novice
  2154.  Set prologue        Set prompt          Set ring            Set timer
  2155.  Set wait            Show buffer         Show conferences    
  2156.  Show configuration  Show hosts          Show logins         Show members
  2157.  User definition file          User prologue file            Wait      Write
  2158.   
  2159.  To view the help for a particular topic, type 'help n', where n is
  2160.  the topic.
  2161.  
  2162. \End\Of\Shar\
  2163. else
  2164.   echo "will not over write ./slughlp.dat"
  2165. fi
  2166. chmod 400 ./slughlp.dat
  2167. if [ `wc -c ./slughlp.dat | awk '{printf $1}'` -ne 12822 ]
  2168. then
  2169. echo `wc -c ./slughlp.dat | awk '{print "Got " $1 ", Expected " 12822}'`
  2170. fi
  2171. if `test ! -s ./slugnet.1`
  2172. then
  2173. echo "writing ./slugnet.1"
  2174. cat > ./slugnet.1 << '\End\Of\Shar\'
  2175. .\" @(#)slugnet.1    1.1
  2176. .TH slugnet 1
  2177. .SH NAME
  2178. slugnet \- use slugnet, a multiple\-user, interactive conferencing system
  2179. .SH SYNTAX
  2180. .B slugnet
  2181. .SH DESCRIPTION
  2182. .NXR "slugnet"
  2183. .NXA "multiple\-user" "interactive" "conferencing" "system"
  2184. .NXA "local" "slugnet program"
  2185. .NXR "message" "interactive"
  2186. The
  2187. .PN slugnet
  2188. is a multiple\-user conferencing system which allows users to
  2189. simultaneously carry on conversations with several users at once, in much
  2190. the same way that the write(1) or talk(1) commands allow a single user
  2191. to communicate with just one other user.
  2192. .PP 
  2193. Users limit the number of other users they are communicating with by
  2194. joining conferences.  Conferences are arbitrarily named groups of users.
  2195. Messages from a user in a conference are by default only sent to other
  2196. users in the same conference, although it is possible to send messages
  2197. to a single user or all the users.
  2198. .PP
  2199. .PN slugnet
  2200. has many installation\-dependent features.  The program has its own help
  2201. files which may be accessed by the
  2202. .PN slugnet
  2203. command "help".
  2204. .SH RESTRICTIONS
  2205. Access to some of commands described in the internal help may be
  2206. installation\-dependent.
  2207. .PP
  2208. .SH "SEE ALSO"
  2209. slugnetd(1)
  2210. \End\Of\Shar\
  2211. else
  2212.   echo "will not over write ./slugnet.1"
  2213. fi
  2214. chmod 400 ./slugnet.1
  2215. if [ `wc -c ./slugnet.1 | awk '{printf $1}'` -ne 1170 ]
  2216. then
  2217. echo `wc -c ./slugnet.1 | awk '{print "Got " $1 ", Expected " 1170}'`
  2218. fi
  2219. echo "Finished archive 5 of 6"
  2220. exit
  2221.