home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / SPV063I.ZIP / SPV063I.MOD
Encoding:
Text File  |  1995-06-09  |  14.3 KB  |  380 lines

  1. Papa Bear #1 @11579
  2. Wed Jun 07 23:46:41 1995
  3. 0R 34 06/09 07:13 WWIVNET 4051->8421
  4. 0R 34 06/08 18:18 WWIVNet 4001->4051
  5. 0R 34 06/08 14:07 WWIVnet 4000->4001
  6. 0R 34 06/08 05:34 WWIVnet ->4000
  7. 0R 34 06/08 01:36 WWIVnet 4001->4000
  8. 0R 34 06/08 09:17 WWIVnet 11579->4001
  9. 0R 34 06/07 23:46 WWIVnet ->11579
  10. 4Msg. Status:3▄ 16Please reply!00
  11. 3 ▀▀▀▀▀▀▀▀▀▀▀▀0
  12.  
  13. ┌────────────────────────────A CEREBRUM release!─────────────────────────────┐
  14. │ Mod Name: SPV063I.MOD      Mod Authors: Pâpâ ßêâr (11579.wwivnet)          │
  15. │ Difficulty: ▓░░░░░░░░░     First ----- [02/25/94]  Captain EJ              │
  16. │ WWIV Version: 4.24         Last ------ [06/07/95]                          │
  17. │ Files Affected: DIREDIT.C  FCNS.H                                          │
  18. │ Description: Mass create CD-ROM directories.  Mass-delete a range of dirs! │
  19. ╞═────────────────────────────────────═╤═───────────────────────────────────═╡
  20. │ StarPort Valhalla [   ]   -     ASV 28.8kbps  Home of the SPV mod series!  │
  21. └─────────────────────────────────────═╧═────────────────────────────────────┘
  22.  
  23.                      >>> OFFICIAL WWIV SUPPORT SITE! <<<
  24.  
  25.  Word of Warning:  You installed it, you're responsible! Make back-ups BEFORE
  26.  attempting to install this modification!  Read all text before beginning.
  27. ─────────────────────────────────────────────────────────────────────────────
  28.  LEGEND:
  29.  ==  Original Code [use this to search on]
  30.  ++  Add this Line [mods ALWAYS add stuff, don't they?]
  31.  -+  Chagne this line [take CARE when editing these lines].
  32. ─────────────────────────────────────────────────────────────────────────────
  33.  LONG DESCRIPTION:  This mod adds to really handy things to the //DIREDIT
  34. section of the BBS.  But first, a word from our sponsor!
  35.  This mod was originally written by Cpatain EJ.  Since he's off-net, and
  36. currently in Japan (for 2 1/2 more years), I've taken over the project.  I've
  37. always respected his work and ideas, and this is one of the best.
  38.  What this does, exactly, is allow you to mass-insert, and mass-delete
  39. directories into your file transfer section.  Originally written with
  40. CD-ROM's in mind, it will work for any type of dirs.
  41.  I've added a few things, improved a couple of weak places, and generally
  42. made it 4.24 ready.
  43. ─────────────────────────────────────────────────────────────────────────────
  44. STEP 1:  Load up DIREDIT.C In void dlboardedit(void) add these variable
  45.          declarations:
  46.  
  47. ==  int i,i1,i2,done,f, confchg=0;
  48. ==  char s[81],s1[81],ch;
  49. ==  SUBCONF_TYPE iconv;
  50. ++  int dir_num,ok1,ok2,conf_sel,i3,dsl,age,done1;                 // SPV063I
  51. ++  unsigned short dar;                                            // SPV063I
  52. ++  char stemp[81],inbuf[250],dn[180],pn[50],cd_num[3],ch2;        // SPV063I
  53. ++  FILE *fr;                                                      // SPV063I
  54. ==
  55. ==  if (!checkpw())
  56. ==    return;
  57. ─────────────────────────────────────────────────────────────────────────────
  58. STEP 2: Same function:
  59.  
  60. ==    nl();
  61. ==    prt(2,get_string(160));
  62. -+    ch=onek("QSDIM?C");                                  // SPV063I added C
  63. ==    switch(ch) {
  64. ==      case '?':
  65. ─────────────────────────────────────────────────────────────────────────────
  66. STEP 3:  Same function -- replace case 'D': with this one, and add a new
  67.          case 'C':
  68.  
  69. // SPV063I *REPLACEMENT* case 'D': and *NEW* case 'C': START
  70.       case 'D':
  71.         nl();
  72.         prt(2,get_string(163));
  73.         input(s,4);
  74.         i3=atoi(s);
  75.         if (s[0]==0)
  76.           break;
  77.         if (i3!=(num_dirs-1)) {
  78.           nl();
  79.           npr("2Last directory to delete 3(9Default=1%d3)2? 0",i3);
  80.           input(s,3);
  81.           i2=atoi(s);
  82.           if (i2>=num_dirs)
  83.             i2=(num_dirs-1);
  84.           if (i2<i3)
  85.             i2=i3;
  86.         } else
  87.           i2=(num_dirs-1);
  88.         nl();
  89.         if (i2==i3)
  90.           npr("6Are you sure you want to delete dir #2%d6? 0",i3);
  91.         else
  92.           npr("6Are you sure you want to delete dir #2%d 6thru 2%d6? 0",
  93.                i3,i2);
  94.         if (yn()) {
  95.           tmp_disable_pause(1);
  96.           nl();
  97.           prt(5,get_string(1380));
  98.           if (yn())
  99.             done1=1;
  100.           else
  101.             done1=0;
  102.           nl();
  103.           for (i=i3; i<=i2; i++) {
  104.             strcpy(s,directories[i3].filename);
  105.             npr("6Deleting #2%d9: 1%s0",i,directories[i3].name);
  106.             nl();
  107.             delete_dir(i3);
  108.             confchg=1;
  109.             if (done1) {
  110.               sprintf(s1,"%s%s.DIR",syscfg.datadir, s);
  111.               unlink(s1);
  112.               sprintf(s1,"%s%s.EXT",syscfg.datadir,s);
  113.               unlink(s1);
  114.             }
  115.           }
  116.           tmp_disable_pause(0);
  117.         }
  118.         break;
  119.       case 'C':
  120.         dir_num=1;
  121.         conf_sel=done1=stemp[0]=cd_num[0]=dar=age=0;
  122.         dsl=10;
  123.         if (num_dirs<max_dirs) {
  124.           sprintf(s,"%sDIRLIST.TXT",syscfg.datadir);
  125.           fr=fsh_open(s,"rt");
  126.           if (fr==NULL) {
  127.             pl("6No DIRLIST.TXT file exists in the DATA directory!0");
  128.             fsh_close(fr);
  129.             break;
  130.           }
  131.           nl();
  132.           npr("5Insert before which dir? 3(1$9 to enter at end3) 0");
  133.           input(s,3);
  134.           i=atoi(s);
  135.           if (((s[0]!=0) && (i>=0) && (i<=num_dirs)) || (s[0]=='$')) {
  136.             if (s[0]=='$')
  137.               i=num_dirs;
  138.             do {
  139.               outchr(12);
  140.               npr("9Inserting new directories at position2: 1%d0",i);
  141.               nln(2);
  142.               npr("1A9. 3Minimum DSL 2: 5%d0",dsl);  nl();
  143.               npr("1B9. 3Minimum Age 2: 5%d0",age);  nl();
  144.               npr("1C9. 3CD-ROM #    2: 5%s0",cd_num);  nl();
  145.               if (dar!=0) {
  146.                 for (i2=0; i2<16; i2++)
  147.                   if ((1 << i2) & dar)
  148.                     stemp[0]='A'+i2;
  149.                 stemp[1]=0;
  150.               }
  151.               npr("1D9. 3DAR         2: 5%s0",stemp);  nl();
  152.               confchg=1;
  153.               if (dirconfnum>1) {
  154.                 npr("1E9. 3Conference  2: 5%c0",
  155.                      dirconfs[conf_sel].designator);  nl();
  156.               }
  157.               npr("1F9. 3Directory # 2: 5%d0",dir_num);  nl();
  158.               nl();
  159.      npr("5Which 3(1A3-1F3,(1S3)ave [and create],(6Q3)uit)5? 0");
  160.               if (dirconfnum>1)
  161.                 ch=onek("QSABCDEF");
  162.               else
  163.                 ch=onek("QSABCDF");
  164.               switch(ch) {
  165.                 case 'Q':done1=1; cd_num[0]=0; break;
  166.                 case 'S':
  167.                   if (!cd_num[0]) {
  168.                     nl();
  169.                     pl("6CD-ROM # not set -- aborting!0");
  170.                     nl();
  171.                   }
  172.                   done1=1;
  173.                   break;
  174.                 case 'A':
  175.                   nl();
  176.                   prt(2,get_string(153));
  177.                   input(s,3);
  178.                   i2=atoi(s);
  179.                   if ((i2>=0) && (i2<256) && (s[0]))
  180.                     dsl=i2;
  181.                   break;
  182.                 case 'B':
  183.                   nl();
  184.                   prt(2,get_string(77));
  185.                   input(s,3);
  186.                   i2=atoi(s);
  187.                   if ((i2>=0) && (i2<128) && (s[0]))
  188.                     age=i2;
  189.                   break;
  190.                 case 'C':
  191.                   nl();
  192.               npr("9CD Rom Number (1HEX and must not be duplicate9)? 0");
  193.                   mpl(2);
  194.                   input(cd_num,2);
  195.                   if (cd_num[0]) {
  196.                     if (strlen(cd_num)<=1) {
  197.                       strcpy(s,cd_num);
  198.                       sprintf(cd_num,"0%1.1s",s);
  199.                     }
  200.                   }
  201.                   break;
  202.                 case 'D':
  203.                   nl();
  204.                   prt(2,get_string(154));
  205.                   ch2=onek("ABCDEFGHIJKLMNOP ");
  206.                   if (ch2==32)
  207.                     dar=0;
  208.                   else
  209.                     dar=1 << (ch2-'A');
  210.                   break;
  211.                 case 'E':
  212.                   confchg=1;
  213.                   if (dirconfnum>1) {
  214.                     nl();
  215.                     pl("5Pick which conference ALL dirs will belong2:0");
  216.                     nl();
  217.                     list_confs(CONF_DIRS,0);
  218.                     conf_sel=select_conf(get_string(1160),CONF_DIRS, 0);
  219.                   }
  220.                   break;
  221.                 case 'F':
  222.                   nl();
  223.               pl("2Enter directory number to start the file names from.0");
  224. pl("2This number will help generate the file names for your *.DIR files.0");
  225.                   nl();
  226.                   pl("1  example: CD Rom number - A3  Dir Number - 250");
  227.                   pl("1    Will generate file names like this:0");
  228.                   nl();
  229.                   pl("1    !A3_0025.DIR, !A3_0026.DIR, etc...0");
  230.                   nl();
  231.            pl("2If you hit C/R it will assume 1.  This function is here0");
  232.           pl("2so you can add directories to an existing CD Conference.0");
  233.                   nl();
  234.                   npr("5Directory number2: 0");
  235.                   mpl(4);
  236.                   input(s,4);
  237.                   if (s[0])
  238.                     dir_num=atoi(s);
  239.                   else
  240.                     dir_num=1;
  241.                   break;
  242.               }
  243.             } while ((!done1) && (!hangup));
  244.             if (cd_num[0]==0) {
  245.               fsh_close(fr);
  246.               break;
  247.             }
  248.           }
  249.           ok2=0;
  250.           if (cd_num[0]) {
  251.             nl();
  252.             npr("9Inserting directories before 1%d9.0",i);
  253.             nl();
  254.             tmp_disable_pause(1);
  255.             for (i1=i; !ok2; i1++) {
  256.               fgets(inbuf,250,fr);
  257.               inbuf[strlen(inbuf)-1]=0;
  258.               if (!feof(fr)) {
  259.                 insert_dir(i1);
  260.                 ok1=i3=0;
  261.                 for (i2=0; i2<=strlen(inbuf); i2++) {
  262.                   if ((inbuf[i2]==32) && (!ok1))
  263.                     ok1=1;
  264.                   if (!ok1) {
  265.                     pn[i2]=inbuf[i2];
  266.                     pn[i2+1]=0;
  267.                   }
  268.                   if ((inbuf[i2]>=33) && (inbuf[i2]<=125) && (ok1==1))
  269.                     ok1=2;
  270.                   if (ok1==2) {
  271.                     dn[i3]=inbuf[i2];
  272.                     i3++;
  273.                     dn[i3]=0;
  274.                   }
  275.                 }
  276.                 if (strlen(dn)>=40)
  277.                   dn[40]=0;
  278.                 strcat(pn,"\\");
  279.                 sprintf(s,"!%2.2s_%-3.3d",cd_num,dir_num);
  280.                 dir_num++;
  281.                 npr("9Adding 5#1%d2: 9'1%s9'0",i1,dn);
  282.                 nl();
  283.                 mod_dir(i1,dn,s,pn,dsl,age,dar);
  284.                 if (dirconfnum>1) {
  285.                   if (conf_sel>=0)
  286.                     if (in_conference(i1,&dirconfs[conf_sel])<0)
  287.                       addsubconf(CONF_DIRS,
  288.                                  &dirconfs[conf_sel],&(SUBCONF_TYPE)i1);
  289.                 } else {
  290.                   if (in_conference(i1,&dirconfs[0])<0)
  291.                     addsubconf(CONF_DIRS, &dirconfs[0], &(SUBCONF_TYPE)i1);
  292.                 }
  293.               } else
  294.                 ok2=1;
  295.             }
  296.             tmp_disable_pause(0);
  297.           }
  298.           fsh_close(fr);
  299.         }
  300.         break;
  301. // SPV063I *REPLACEMENT* case 'D': and *NEW* case 'C': END
  302. ─────────────────────────────────────────────────────────────────────────────
  303. STEP 4: Add these functions to the end of DIREDIT.C
  304. void mod_dir(int n, char *dir_name, char *file_name, char *path_name,
  305.              int mdsl, int mage, unsigned short mdar)
  306. {
  307.   directoryrec r;
  308.  
  309.   r=directories[n];
  310.   strcpy(r.name,dir_name);
  311.   strcpy(r.filename,file_name);
  312.   strcpy(r.path,path_name);
  313.   if (mdsl)
  314.     r.dsl=mdsl;
  315.   if (mage)
  316.     r.age=mage;
  317.   r.maxfiles=499;
  318.   if (mdar)
  319.     r.dar=mdar;
  320.   if(r.mask & mask_cdrom) {
  321.     r.mask ^= mask_cdrom;
  322.   } else {
  323.     r.mask |= mask_cdrom;
  324.     r.mask |= mask_no_uploads;
  325.   }
  326.   directories[n]=r;
  327. }
  328. ─────────────────────────────────────────────────────────────────────────────
  329. STEP 5: Add the function prototype to FCNS.H
  330.  
  331. == void insert_dir(int n);
  332. == void delete_dir(int n);
  333. == void dlboardedit(void);
  334. ++ void mod_dir(int n, char *dir_name, char *file_name, char *path_name,
  335. ++             int mdsl, int mage, unsigned short mdar);
  336. ==
  337. == /* File: extrn1.c */
  338. ─────────────────────────────────────────────────────────────────────────────
  339. STEP 6: Recompile
  340. ─────────────────────────────────────────────────────────────────────────────
  341. STEP 7: Change string entry 160 in BBS.STR from:
  342.  
  343.   Dirs: D:elete, I:nsert, M:odify, S:wapDirs, Q:uit, ? :
  344.  
  345.   to:
  346.  
  347.   Dirs: C:D-ROM, D:elete, I:nsert, M:odify, S:wapDirs, Q:uit, ? :
  348. ─────────────────────────────────────────────────────────────────────────────
  349. STEP 8: How to use the DIRLIST.TXT in the DATA dir:
  350.  
  351.   The file you need to make this work must be located in the data directory,
  352. and must be named DIRLIST.TXT and MUST be in the following format:
  353.  
  354. <drive letter><full path> <directory description>
  355.  
  356. Like this:
  357.  
  358. F:\1_X\COMM                OS/2 1.x communications
  359. F:\1_x\drivers             1.x device drivers
  360. F:\1_x\editors             1.x Editors
  361. F:\1_x\graphics            1.x graphics and sound
  362. F:\1_x\info                1.x related text/information
  363.  
  364. NOTICE there is NO trailing backslash on the path name.  The number of spaces
  365. between the path and the directory description are not important, but there
  366. must be at least one space separating the two.
  367. ─────────────────────────────────────────────────────────────────────────────
  368.        This mod is copyright 1995 by Tracy Baker, aka Papa Bear, and is
  369.  distributed as freeware.  Permission is granted to distribute and post this
  370.   mod on BBS systems and online services, provided no alterations are made
  371.  (removal of message headers/taglines allowed).  This mod may contain some
  372.  parts of WWIV source code, which is copyright 1988-1994 by Wayne Bell and
  373.    licensed only to registered users of WWIV.  Use of WWIV source without
  374.     registration constitutes a license violation and could lead to legal
  375.                        prosecution and certain doom.
  376.   Shareware distributors and CD-ROM publishers may not distribute this mod
  377. without express written permission of the Author or WWIV Software Services.
  378.  
  379. 7-9=1*6>2Pâpâ ßêâr6<1*9=7-0
  380.