home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BBSING / RBBS / RBBS4102.ARK / UTIL.C < prev    next >
Text File  |  1985-02-09  |  3KB  |  136 lines

  1. /****************************************************************
  2. * UTIL.C                            *
  3.  
  4. Release 5: RBBS 4.1 Edit 00 - Names now one large field
  5.                 - Activated lstmsg for 1st 7 non-PERSONALs
  6.                 - Inserted PERSONLY in main
  7. Release 4: RBBS 4.0 Edit 21 - added confirmation request in creating
  8.                   a new USERS.CCC file
  9.                 - added settable bias value in creating
  10.                   a newer CALLERS.CCC file
  11.                 - repaired superuser
  12. Release 1: RBBS 4.0 Edit 18
  13.  
  14. * Function included in this file is:
  15.  
  16. * main        calls chk_user, subject, select_subj, and performs
  17.         the main command loop
  18.  
  19. ****************************************************************/
  20.  
  21. #include    <bdscio.h>
  22. #include    "rbbs4.h"
  23.  
  24. main()
  25. {
  26.     char    c[2];
  27.     int    i;
  28.     int    fd, ufd;
  29.     struct    _sum    s;
  30.     struct    _user    u;
  31.  
  32. #if    DATETIME
  33.     get_date();
  34.     strcpy(logdate,sysdate);
  35. #endif
  36.     upstr("dummy");
  37.     setptr(m,lp);
  38.     chk_user();
  39. #if    !PERSONLY
  40.     subject();
  41.     select_subj(1,s);
  42. #else
  43.     strcpy(cmsgfile,"PERSONAL");
  44.     sprintf(msgfile,"%s%s%s",DRIVE,capstr(cmsgfile),".MSG");
  45. #endif
  46.     msgct = load_cntrl(0,s);
  47.     msg_info(msgct,TRUE);
  48.     while(TRUE)
  49.     {
  50. outstr("**************************************************************",2);
  51. #if    !PERSONLY
  52. outstr("<1> Write active messages          <5> Add a new subject",2);
  53. #else
  54. outstr("<1> Write active messages",2);
  55. #endif
  56. outstr("<2> Read msgs <Random selection>   <6> Manipulate User Entries",1);
  57. outstr("<3> Setup a new USERS.CCC file     <7> Cleanup USERS.CCC file",1);
  58. #if    !PERSONLY
  59. outstr("<4> Select a Subject file          <8> Enter a long message",1);
  60. #else
  61. outstr("                                   <8> Enter a long message",1);
  62. #endif
  63.         outstr("<9> Quit",2);
  64.         crlf(1);
  65.         outstr("Enter choice: ",4);
  66.         instr("",c,1);
  67.         crlf(1);
  68.         switch(*c-0x30)
  69.         {
  70.             case 1:
  71.                 rite_active(msgct,s);
  72.                 outstr("Loading new control",2);
  73.                 msgct = load_cntrl(msgct,s);
  74.                 msg_info(msgct,TRUE);
  75.                 for ( i = 1; i <= msgct; i++)
  76.                     prnt_ndx(i);
  77.                 break;
  78.  
  79.             case 2:
  80.                 crlf(1);
  81.                 read_msgs(msgct,s);
  82.                 break;    
  83.  
  84.             case 3:
  85.                 if (getyn("Are you sure"))
  86.                     nu_user();
  87.                 break;
  88.  
  89. #if    !PERSONLY
  90.             case 4:
  91.                 select_subj(0,s);
  92.                 msgct = load_cntrl(0,s);
  93.                 msg_info(msgct,FALSE);
  94.                 break;
  95.  
  96.             case 5:
  97.                 add_subj();
  98.                 break;
  99. #endif
  100.  
  101.             case 6:
  102.                 superuser();
  103.                 break;
  104.  
  105.             case 7:
  106.                 rite_user(u);
  107.                 break;
  108.  
  109.             case 8:
  110.                 if ( (ufd = open(DSK(USERS.CCC),2)) == ERROR)
  111.                     ioerr("Cannot open USERS.CCC");
  112.                 logon(ufd,u);
  113. #if    !PERSONLY
  114.                 select_subj(FALSE,s);
  115. #endif
  116.                 close(ufd);
  117.                 if(!prnt_instr())
  118.                     break;
  119.                 ntrlong(ufd,u,s);
  120.                 break;
  121.  
  122.             case 9:
  123.                 outstr("Finished",2);
  124.                 exit();
  125.                 break;
  126.  
  127.             default:
  128.                 outstr("Choice Error",2);
  129.                 break;
  130.         }
  131.     }
  132. }
  133. /****************************************************************/
  134. r("Loading new control",2);
  135.                 msgct = load_cntrl(msgct,s);
  136.                 ms