home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 147_01 / utilfn.c < prev    next >
Text File  |  1985-03-10  |  16KB  |  667 lines

  1. /****************************************************************
  2. * UTILFN.C                            *
  3.  
  4. Release 7: RBBS 4.1 Edit 02 - Changed the SYSOP's entry to have
  5.                   a "!" instead of "+" as the MF Flag.
  6.                 - Changed getname prompt in superuser.
  7. Release 6: RBBS 4.1 Edit 01 - Added continuous modes for updating
  8.                   USERS.CCC and .MSG files
  9. Release 5: RBBS 4.1 Edit 00 - Names now one large field
  10.                 - Activated lstmsg for 1st 7 non-PERSONALs
  11.                 - Inserted PERSONLY conditional
  12.  
  13. * Functions included in this file are:
  14.  
  15. * rite_active    (Case 1) creates cmsgfile.$$$, selectively copies
  16.                 each message, one at a time from cmsgfile.MSG.
  17.                 Then renames cmsgfile.MSG to cmsgfile.BAK, and
  18.                 cmsgfile.$$$ to cmsgfile.MSG.
  19.  
  20. * prnt_ndx    displays the index data
  21.  
  22. * read_msgs    (Case 2) offers to display any particular message
  23.  
  24. * chk_user    checks to see if USERS.CCC exists, and calls nu_user
  25.         to create it if it doesn't.
  26.  
  27. * nu_user    (Case 3) deletes any existing USERS.CCC and creates a
  28.         fresh one, with SYSOP as the first entry.
  29.  
  30. * rite_user    (Case 7) creates USER.$$$, selectively copies each
  31.         user, one at a time from USER.CCC. Then renames
  32.         USER.CCC to USER.BAK and USER.$$$ to USER.BAK
  33.  
  34. * subject    checks to see if SUBJECTS.CCC exists, and calls
  35.         creat_subj if not.  Then calls displ_subj to
  36.         display the available subjects.
  37.  
  38. * creat_subj    creates SUBJECT.CCC with two initial entries:
  39.         PERSONAL and GENERAL.
  40.  
  41. * add_subj    (Case 5) calls creat_subject if SUBJECT.CCC
  42.         doesn't exist and prompts the user to add a
  43.         new entry
  44.  
  45. * select_subj    (Case 4) reads and displays SUBJECT.CCC and
  46.         prompts user to select one to be the current
  47.         .MSG file.
  48.  
  49. * superuser    sysop only functions
  50.  
  51. * printuser    called by superuser
  52.  
  53. * ntrlong    enter a long message into the subject file that
  54.         is active
  55.  
  56. * prnt_instr    print instructions about long text entry
  57.  
  58. * txtlong    enter the long text from a file
  59.  
  60. * rite_line    write a single line of text
  61.  
  62. ****************************************************************/
  63.  
  64. #include    <bdscio.h>
  65. #include    "rbbs4.h"
  66.  
  67. /****************************************************************/
  68. rite_active(ct,s)
  69. int    ct;
  70. struct    _sum    *s;
  71. {
  72.     int    i,j,k;
  73.     int    auto,rite_it;
  74.     int    fdin,fdout;
  75.     int    blks,msgnum,tmsgnum;
  76.  
  77.     auto = FALSE;
  78.     if ( getyn("Write active records w/o asking"))
  79.         auto = TRUE;
  80.     msgnum = 0;
  81.     fdin = openfile(msgfile);
  82. #if    LOCKEM
  83.     if (lokrec(fdin,-1))
  84.         ioerr("locking .MSG");
  85. #endif
  86.     sprintf(tmpstr,"%s%s%s",DRIVE,capstr(cmsgfile),".$$$");
  87.     if ( (fdout = creat(tmpstr)) == ERROR)
  88.         ioerr("Creating $$$ file");
  89.     if ( seek(fdout,0,0) == ERROR)
  90.         ioerr("Seek in $$$");
  91.     for ( i = 1; i <= ct; i++)
  92.     {
  93.         sprintf(tmpstr,"mno[%d]: %d",i,mno[i]);
  94.         outstr(tmpstr,1);
  95.         if (mno[i])
  96.         {
  97.         readsum(fdin,mndx[i],s);
  98.         if (!auto)
  99.         {
  100.             outstr("**********",1);
  101.             prnt_sum(s);
  102.             crlf(1);
  103.             rite_it = FALSE;
  104.             if (getyn("Write rec")) 
  105.                 rite_it = TRUE;
  106.         }    
  107.         if (auto || rite_it)
  108.         {
  109.             tmsgnum = ritesum(fdout,msgnum,s);
  110.             blks = (s->lct+1)/2;
  111.             for ( j = 1; j <= blks; j++)
  112.             {
  113.                 readrec(fdin,mndx[i]+j,tmpstr,1);
  114.                 Rriterec(fdout,msgnum+j,1,tmpstr);
  115.             }
  116.         }
  117.         msgnum = tmsgnum;
  118.         }
  119.     }
  120.     if (close(fdout) == ERROR)
  121.         ioerr("Closing .$$$");
  122. #if    LOCKEM
  123.     frerec(fdin,-1);
  124. #endif
  125.     if (close(fdin) == ERROR)
  126.         ioerr("Closing .MSG");
  127.     sprintf(tmpstr,"%s%s%s",DRIVE,capstr(cmsgfile),".BAK");
  128.     unlink(tmpstr);
  129.     if ( rename(msgfile,tmpstr) == ERROR)
  130.         ioerr("Renaming .MSG to .BAK");
  131.     sprintf(tmpstr,"%s%s%s",DRIVE,capstr(cmsgfile),".$$$");
  132.     if ( rename(tmpstr,msgfile) == ERROR)
  133.         ioerr("Renaming .$$$ to .CCC");
  134. }
  135. /***************************************************************/
  136. prnt_ndx(i)
  137. int    i;
  138. {
  139.     sprintf(tmpstr,"no(%2d): %3d, ndx(%2d): %3d  ",i,mno[i],i,mndx[i]);
  140.     outstr(tmpstr,0);
  141.     if ( !(i % 2))
  142.         crlf(1);
  143. }
  144. /****************************************************************/
  145. read_msgs(msgct,s)
  146. int    msgct;
  147. struct    _sum    *s;
  148. {
  149.     int    i,j,k;
  150.     int    msgfd;
  151.     int    msglim;
  152.     char    input[5];
  153.  
  154.     msgfd = openfile(msgfile);
  155.     k = msgct+1;
  156.     while (k)
  157.     {
  158.         while (k > msgct)
  159.         {
  160.             sprintf(tmpstr,"Msg # (1:%d, or 0 to quit): ",msgct);
  161.             outstr(tmpstr,4);
  162.             instr("",input,3);
  163.             k = atoi(input);
  164.          }
  165.         if (!k)
  166.         {
  167.             close(msgfd);
  168.             break;
  169.         }
  170.         readsum(msgfd,mndx[k],s);
  171.         outstr("**********",1);
  172.         prnt_sum(s);
  173.         readtxt(msgfd,mndx[k],s);
  174.         crlf(1);
  175.         k = msgct+1;
  176.     }
  177. }
  178. /****************************************************************/
  179. chk_user()
  180. {
  181.     int    fd;
  182.     int    bias;
  183.     char    input[10];
  184.  
  185.     crlf(1);
  186.     if ( (fd = open(DSK(USERS.CCC),2)) == ERROR)
  187.         nu_user();
  188.     else
  189.         close(fd);    
  190.     if ( (fd = open(DSK(CALLERS.CCC),2)) == ERROR)
  191.         if ( (fd = creat(DSK(CALLERS.CCC))) == ERROR)
  192.             ioerr("Cannot create CALLERS.CCC");
  193.         else
  194.         {
  195. outstr("Enter highest caller number of old CALLERS file, or 0 if new: ",4);
  196.             instr("",input,10);
  197.             bias = atoi(input);
  198.             formrec(tmpstr,SECSIZ);
  199.             sprintf(tmpstr,"MAX CALR: %d %d",0,bias);
  200.             Rriterec(fd,0,1,tmpstr);
  201.         }
  202.     close(fd);    
  203. }
  204. /****************************************************************/
  205. nu_user()
  206. {
  207.     int    fd;
  208.  
  209.     outstr("Creating new USERS.CCC...",2);
  210.     unlink(DSK(USERS.CCC));
  211.     if ( (fd = creat(DSK(USERS.CCC))) == ERROR)
  212.         ioerr("Creating USERS.CCC");
  213.     formrec(tmpstr,SECSIZ);
  214.     sprintf(tmpstr+NM,"%s","SYSOP");    /* NM:    */
  215.     sprintf(tmpstr+PRV,"%c%c",'!',0);    /* PRV:    */
  216.     sprintf(tmpstr+UBL,"%1d",FALSE);    /* UBL:    */
  217.     sprintf(tmpstr+UXP,"%1d",TRUE);        /* UXP:    */
  218.     sprintf(tmpstr+PWD,"%s","123456");    /* PWD:    */
  219.     sprintf(tmpstr+LLG,"%s",sysdate);    /* LLG:    */
  220.     sprintf(tmpstr+FRM,"%s",SYSITE);    /* FRM:    */
  221.     sprintf(tmpstr+LMG0,"%03d",0);        /* LMG0:*/
  222.     sprintf(tmpstr+LMG1,"%03d",0);        /* LMG1:*/
  223.     sprintf(tmpstr+LMG2,"%03d",0);        /* LMG2:*/
  224.     sprintf(tmpstr+LMG3,"%03d",0);        /* LMG3:*/
  225.     sprintf(tmpstr+LMG4,"%03d",0);        /* LMG4:*/
  226.     sprintf(tmpstr+LMG5,"%03d",0);        /* LMG5:*/
  227.     sprintf(tmpstr+LMG6,"%03d",0);        /* LMG6:*/
  228.     Rriterec(fd,1,1,tmpstr);
  229.  
  230.     formrec(tmpstr,SECSIZ);
  231.     sprintf(tmpstr,"MAX REC: %3d",1);
  232.     Rriterec(fd,0,1,tmpstr);
  233.     close(fd);
  234. }
  235. /****************************************************************/
  236. rite_user(u)
  237. struct    _user    *u;
  238. {
  239.     int    i,j,k;
  240.     int     auto;
  241.     int    fdin,fdout;
  242.     int    inct,outct;
  243.  
  244.     outct = 1;
  245.     auto = FALSE;
  246.     if ( getyn("Write deleted records w/o asking"))
  247.         auto = TRUE;
  248.     if ( (fdin = open(DSK(USERS.CCC),2)) == ERROR)
  249.         ioerr("Cannot open USERS.CCC");
  250. #if    LOCKEM
  251.     if (lokrec(fdin,-1))
  252.         ioerr("locking USERS.CCC");
  253. #endif
  254.     if ((fdout= creat(DSK(USERS.$$$)))== ERROR)
  255.         ioerr("Creating USERS.$$$ file");
  256.     if ( seek(fdout,1,0) == ERROR)
  257.         ioerr("Seek in USERS.$$$");
  258.     readrec(fdin,0,tmpstr,1);
  259.     sscanf(tmpstr,"MAX REC: %d",&inct);
  260.     for ( i = 1; i <= inct; i++)
  261.     {
  262.         formrec(tmpstr,SECSIZ);
  263.         readrec(fdin,i,tmpstr,1);
  264.         sscanf(tmpstr+NM,"%s",u->nm);        /* NM:    */
  265.         sscanf(tmpstr+LLG,"%s",u->lastlog);    /* LLG:    */
  266.         sscanf(tmpstr+FRM,"%s",u->from);    /* FRM:    */
  267.         sscanf(tmpstr+PRV,"%s",u->ustat);    /* PRV: */
  268.         if (auto && (*(u->ustat) != '#'))/* GOODBYE TWITS*/
  269.         {
  270.             printuser(u);
  271.             Rriterec(fdout,outct++,1,tmpstr);
  272.         }
  273.         if (!auto)
  274.         {
  275.             printuser(u);
  276.             crlf(1);
  277.             if ( getyn("Write rec"))
  278.             {
  279.                 Rriterec(fdout,outct++,1,tmpstr);
  280.             }
  281.         }
  282.     }
  283.     formrec(tmpstr,SECSIZ);
  284.     sprintf(tmpstr,"MAX REC: %d",--outct);
  285.     Rriterec(fdout,0,1,tmpstr);
  286.     if ( close(fdout) == ERROR)
  287.         ioerr("Closing USERS.$$$");
  288.  
  289. #if    LOCKEM
  290.     frerec(fdin,-1);
  291. #endif
  292.     if ( close(fdin) == ERROR)
  293.         ioerr("Closing USERS.CCC");
  294.     unlink(DSK(USERS.BAK));
  295.     if ( rename(DSK(USERS.CCC),DSK(USERS.BAK)) == ERROR)
  296.         ioerr("Renaming USERS.CCC to USERS.BAK");
  297.     if ( rename(DSK(USERS.$$$),DSK(USERS.CCC)) == ERROR)
  298.         ioerr("Renaming USERS.$$$ to USERS.CCC");
  299. }
  300. /****************************************************************/
  301. #if    !PERSONLY
  302. subject()
  303. {
  304.     int    i,fd,n;
  305.  
  306.     crlf(1);
  307.     if ( (fd = open(DSK(SUBJECTS.CCC),2)) == ERROR)
  308.         fd = creat_subj(fd);
  309.     if ( readrec(fd,0,tmpstr,1) == ERROR)
  310.         ioerr("reading the subject record");
  311.     sscanf(tmpstr,"%d",&n);
  312.     displ_subj(fd,n,tmpstr);
  313.     close(fd);    
  314. }
  315. /****************************************************************/
  316. creat_subj(fd)
  317. int    fd;
  318. {
  319.     int    i;
  320.  
  321.     outstr("Creating new SUBJECTS.CCC...",1);
  322.     if ( (fd = creat(DSK(SUBJECTS.CCC))) == ERROR)
  323.         ioerr("creating SUBJECTS.CCC");
  324.     for ( i = 0; i < SECSIZ; i++)
  325.         *(tmpstr+i) = ' ';
  326.     sprintf(tmpstr,"%02d",2);
  327.     sprintf(tmpstr+8,"PERSONAL");
  328.     sprintf(tmpstr+16,"GENERAL ");
  329.     Rriterec(fd,0,1,tmpstr);
  330.     return fd;
  331. }
  332. /****************************************************************/
  333. add_subj()
  334. {
  335.     int    i,fd,n;
  336.     char    input[17];
  337.     char    rec[SECSIZ];
  338.  
  339.     if ( (fd = open(DSK(SUBJECTS.CCC),2)) == ERROR)
  340.         ioerr("opening subject");
  341. #if    LOCKEM
  342.     if (lokrec(fd,-1))
  343.         ioerr("locking SUBJECTS.CCC");
  344. #endif
  345.     if ( readrec(fd,0,rec,1) == ERROR)
  346.         ioerr("reading the subject record");
  347.     sscanf(rec,"%d",&n);
  348.     displ_subj(fd,n,rec);
  349.         do
  350.         {
  351.         outstr("Enter new subject <Max 8 chars>: ",4);
  352.         instr("",input,8);
  353.         capstr(input);
  354.         } while (!strlen(input));
  355.     strcat(input,"        ");
  356.     sprintf(rec+8*(++n),"%8.8s",input);
  357.     sprintf(rec,"%02d",n);
  358.     Rriterec(fd,0,1,rec);
  359. #if    LOCKEM
  360.     frerec(fd,-1);
  361. #endif
  362.     close(fd);    
  363. }
  364. /****************************************************************/
  365. select_subj(choice,s)
  366. int    choice;
  367. struct    _sum    *s;
  368. {
  369.     int    fd,n;
  370.     char    input[3];
  371.     char    rec[SECSIZ];
  372.  
  373.     if ( (fd = open(DSK(SUBJECTS.CCC),2)) == ERROR)
  374.         ioerr("opening SUBJECTS.CCC");
  375.     if (readrec(fd,0,rec,1) == ERROR)
  376.         ioerr("reading SUBJECTS.CCC");
  377.     sscanf(rec,"%d",&n);
  378.     if (!choice)
  379.     {
  380.         outstr("Subjects are:",2);
  381.         displ_subj(fd,n,rec);
  382.         outstr("File number: ",4);
  383.         instr("",input,3);
  384.         crlf(1);
  385.         choice = atoi(input);
  386.     }
  387.     setmem(cmsgfile,9,0);
  388.     movmem(rec+8*choice,cmsgfile,8);
  389.     sprintf(msgfile,"%s%s%s",DRIVE,capstr(cmsgfile),".MSG");
  390.     sprintf(tmpstr,"Current SUBJECT File: %s",msgfile);
  391.     outstr(tmpstr,2);
  392.     crlf(1);
  393.     close(fd);    
  394. }
  395. #endif
  396. /****************************************************************/
  397. superuser()
  398. {
  399.     char    name[NAMELGTH+1];
  400.     char    input[5];
  401.     struct    _user    u2;
  402.     int    ufd;
  403.     int    i;
  404.  
  405.     if ( (ufd = open(DSK(USERS.CCC),2)) == ERROR)
  406.         ioerr("opening USERS");
  407.     crlf(1);
  408. #if    LOCKEM
  409.     if (lokrec(ufd,-1))
  410.         ioerr("locking USERS");
  411. #endif
  412.     while ( (getname(name,"Enter user name: ")) )
  413.         crlf(1);
  414.     if (!checkuser(ufd,name,u2,0))
  415.     {
  416.         crlf(1);
  417.         if (getyn("User not found.  Add this user") )
  418.         {
  419.             belflg = FALSE;
  420.             expert = FALSE;
  421.             newuser(u2,name,ufd);
  422.         }
  423. #if    LOCKEM
  424.         frerec(ufd,-1);
  425. #endif
  426.         close(ufd);
  427.         return;
  428.     }
  429.     else
  430.     {
  431.         printuser(u2);
  432.         for ( i = 2; i <= 8; ++i)
  433.         {
  434.     sprintf(tmpstr,"Last msg (File #%d): %d, change it",i,u2.lstmsg[i-2]);
  435.             while(getyn(tmpstr))
  436.             {
  437.                 outstr("Enter new value: ",5);
  438.                 instr("",input,4);
  439.                 u2.lstmsg[i-2] = atoi(input);
  440.     sprintf(tmpstr,"Last msg (File #%d): %d, change it",i,u2.lstmsg[i-2]);
  441.                 crlf(1);
  442.             }
  443.         }
  444.         sprintf(tmpstr,"MF stat: %s, change it",u2.ustat);
  445.         while(getyn(tmpstr))
  446.         {
  447.             outstr("Enter new value: ",5);
  448.             instr("",u2.ustat,1);
  449.             sprintf(tmpstr,"MF stat: %s, change it",u2.ustat);
  450.             crlf(1);
  451.         }
  452.         sprintf(tmpstr,"Password: %s, change it",u2.pwd);
  453.         while(getyn(tmpstr))
  454.         {
  455.             outstr("Enter: ",5);
  456.             instr("",u2.pwd,6);
  457.             sprintf(tmpstr,"Password: %s, change it",u2.pwd);
  458.             crlf(1);
  459.         }
  460.         belflg = u2.bellflag;
  461.         expert = u2.xpert;
  462.         updtuser(u2,ufd);
  463.     }
  464. #if    LOCKEM
  465.     frerec(ufd,-1);
  466. #endif
  467.     close(ufd);
  468. }
  469. /****************************************************************/
  470. printuser(u)
  471. struct    _user    *u;
  472. {
  473.     char    temp[SECSIZ];
  474.  
  475.     crlf(1);
  476.     sprintf(temp,"USER NAME:  %s",u->nm);
  477.     outstr(temp,3);
  478.     sprintf(temp,"USER SITE:  %s",u->from);
  479.     outstr(temp,3);
  480.     sprintf(temp,"LAST LOGON: %s",u->lastlog);
  481.     outstr(temp,2);
  482.     crlf(1);
  483. }
  484. /****************************************************************/
  485. newuser(u,name,fd)        /*DOUBLE CHECKS NEW USER & GETS    */
  486. struct    _user    *u;        /*INFO TO ADD NEW USER. ADDS    */
  487. char    *name;            /*NEW USER TO FILE. DOES NOT    */
  488. int    fd;            /*CLOSE USER FILE        */
  489. {
  490.     int    correct;
  491.     char    place[31];
  492.     char    passwd[7];
  493. #if    LOCKEM
  494.     char    temp[SECSIZ];
  495. #endif
  496.  
  497.     correct = FALSE;
  498.     crlf(1);
  499.     do
  500.     {
  501.         sprintf(tmpstr,"Enter user's %s: ",SITEPROMPT);
  502.         outstr(tmpstr,4);
  503.         instr("",place,30);
  504.         capstr(place);
  505.         crlf(1);
  506.         sprintf(tmpstr,"Is the name, %s, correct",place);
  507.         correct = getyn(tmpstr);
  508.     }while(!correct);
  509.     chkpwd(passwd);
  510.  
  511.     formrec(tmpstr,SECSIZ);
  512.     sprintf(tmpstr+NM,"%s",name);        /* NM:    */
  513.     sprintf(tmpstr+PRV,"%c%c",'+',0);    /* PRV:    */
  514.     sprintf(tmpstr+UBL,"%1d",belflg);    /* UBL:    */
  515.     sprintf(tmpstr+UXP,"%1d",expert);    /* UXP:    */
  516.     sprintf(tmpstr+PWD,"%s",passwd);    /* PWD:    */
  517.     sprintf(tmpstr+LLG,"%s",logdate);    /* LLG:    */
  518.     sprintf(tmpstr+FRM,"%s",place);        /* FRM:    */
  519.     sprintf(tmpstr+LMG0,"%03d",0);        /* LMG0:*/
  520.     sprintf(tmpstr+LMG1,"%03d",0);        /* LMG1:*/
  521.     sprintf(tmpstr+LMG2,"%03d",0);        /* LMG2:*/
  522.     sprintf(tmpstr+LMG3,"%03d",0);        /* LMG3:*/
  523.     sprintf(tmpstr+LMG4,"%03d",0);        /* LMG4:*/
  524.     sprintf(tmpstr+LMG5,"%03d",0);        /* LMG5:*/
  525.     sprintf(tmpstr+LMG6,"%03d",0);        /* LMG6:*/
  526. #if    LOCKEM
  527.     formrec(temp,SECSIZ);
  528.     if (lokrec(fd,-1))
  529.         ioerr("locking USERS.CCC");
  530.     readrec(fd,0,temp,1);
  531.     sscanf(temp,"MAX REC: %d",&u->maxno);
  532. #endif
  533.     Rriterec(fd,++u->maxno,1,tmpstr);
  534.  
  535.     formrec(tmpstr,SECSIZ);
  536.     sprintf(tmpstr,"MAX REC: %3d",u->maxno);
  537.     Rriterec(fd,0,1,tmpstr);
  538. #if    LOCKEM
  539.     frerec(fd,-1);
  540. #endif
  541.  
  542.     return (TRUE);
  543. }
  544. /****************************************************************/
  545. ntrlong(ufd,u,s)    
  546. int    ufd;
  547. struct    _user    *u;
  548. struct    _sum    *s;
  549. {
  550.     struct    _sum    s2;
  551.     int    msgfd;
  552.  
  553.     msgfd = openfile(msgfile);
  554.     s->mstat = TRUE;
  555.     strcpy(s->date,sysdate);
  556.     if (!check_to(ufd,s,TRUE))
  557.         return;
  558.     strcpy(s->fnm,u->nm);
  559.     *(s->subj) = 0;
  560.     get_subj(s);
  561. #if    LOCKEM
  562.     if (lokrec(msgfd,-1))
  563.         ioerr("locking .MSG file");
  564. #endif
  565.     msgct = loadsum(msgfd,s2); /* Loads last msg no if updated    */
  566.     msg_info(msgct,FALSE);
  567.     s->msgno = ++lastmsg;
  568.     ++msgct;
  569.     if ( (s->lct = longtxt(msgfd,mndx[msgct])) == ERROR)
  570.     {
  571. #if        LOCKEM
  572.         frerec(msgfd,-1);
  573. #endif
  574.         return;
  575.     }
  576.     mndx[msgct+1] = ritesum(msgfd,mndx[msgct],s);
  577.     mno[msgct] = s->msgno;
  578.     mno[msgct+1] = 0;
  579. #if    LOCKEM
  580.     frerec(msgfd,-1);
  581. #endif
  582.     sprintf(tmpstr,"Message stored as #%d.",s->msgno);
  583.     outstr(tmpstr,1);
  584.     return TRUE;
  585. }
  586. /***************************************************************/
  587. prnt_instr()
  588. {
  589.     int    test;
  590.  
  591. outstr("To enter text this way, all line should be 60 chars or less",1);
  592. outstr("with no high order bits set.  Otherwise, exit now:  ",0);
  593.     test = getyn("Continue");
  594.     crlf(1);
  595.     return test;
  596. }
  597. /***************************************************************/    
  598. longtxt(fd,start)
  599. int    fd,start;
  600. {
  601.     int    lnct;
  602.     char    file[18];
  603.     char    name[13];
  604.     char    buf[BUFSIZ];
  605.     char    line[SECSIZ];
  606.  
  607.     lnct = 0;
  608.     outstr("File name to read: ",0);
  609.     instr("",name,13);
  610.     crlf(1);
  611.     capstr(name);
  612.     sprintf(file,"%s%s",DRIVE,name);
  613.     outstr(file,1);
  614.     if (fopen(file,buf) != ERROR)
  615.     {
  616.         while ( (fgets(line,buf)))
  617.         {
  618.             if(strlen(line) > 61)
  619.                 *(line + 61) = 0;
  620.             else
  621.                 *(line+strlen(line)-1) = 0;
  622.             if ( !((lnct++)%2))
  623.             {
  624.                 formrec(tmpstr,SECSIZ);
  625.                 movmem(line,tmpstr,SECSIZ/2);
  626.             }
  627.             else
  628.             {
  629.                 movmem(line,tmpstr+SECSIZ/2,SECSIZ/2);
  630.                 rite_line(fd,++start,tmpstr);
  631.             }
  632.         }
  633.         if (!lnct)
  634.         {
  635.             rite_line(fd,++start,tmpstr);
  636.             fclose(buf);
  637.             return lnct;
  638.         }
  639.         else
  640.         {
  641.             fclose(buf);
  642.             return --lnct;
  643.         }
  644.     }
  645.     return ERROR;
  646. }
  647. /***************************************************************/    
  648. rite_line(fd,line,source)
  649. int    fd,line;
  650. char    *source;
  651. {
  652.     outstr(tmpstr,1);
  653.     outstr(tmpstr+SECSIZ/2,1);
  654.     seek_blk(fd,line);
  655.     if ( write(fd,source,1) == ERROR)
  656.     {
  657.         sprintf(tmpstr,"Rite err in fd: %d, rec: %d",fd,line);
  658.         outstr(tmpstr,1);
  659.         rexit();
  660.     }
  661. }
  662. /***************************************************************/    
  663. );
  664.     crlf(1);
  665.     capstr(name);
  666.     sprintf(file,"%s%s",DRIVE,name);
  667.     outstr