home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / ALLMODS.ZIP / FR007_F.MOD < prev    next >
Encoding:
Text File  |  1995-06-13  |  15.7 KB  |  454 lines

  1. ┌───────────────────────────────────────────────────────────────────────────┐
  2. │ Mod Name: FR007E.MOD        Mod Author: Frank Reid WWIVnet @8213          │
  3. │ Difficulty: Beginner              Date: June 3, 1995                      │
  4. │ WWIV Version: 4.24                                                        │
  5. │ Description: A two-up directory listing which allows you to change to a   │
  6. │ new conference or select a directory by number when done displaying.      │
  7. └───────────────────────────────────────────────────────────────────────────┘
  8.  
  9. 1.  Back up your source!  I take NO responsibility for ill effects of this or
  10. any of my mods.  I'd be happy to help you get it working, though.
  11.  
  12. 2.  Description:  Displays file directories in a two-column, top-to-bottom
  13. list.  Prompts when completed, so the user can select a directory number or go
  14. to a different conference.  The current conference is displayed on the white
  15. banner at the top.  Directories are listed vertically rather than horizontally
  16. (top to bottom rather than side to side), which I thought made more sense.  If
  17. a new conference is selected, the directory list for that conference is
  18. displayed.  '?' redisplays the listing and 'Q', obviously, quits it.  Here's
  19. what it looks like:
  20.  
  21. D
  22. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄A
  23. C▄▄▄▄▄▄▄▄▄
  24.      A
  25. C      A
  26. C     A
  27. C     [ ConA
  28. Cference S - Sysop Support Areas ]                   
  29. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀A
  30. C▀▀▀▀▀▀▀▀▀▀▀▀
  31. ╒═══════════════════════════════════════════════════════════════════A
  32. C═════════╕
  33. │   0▌ SysopA
  34. C's MessC 14▌ A
  35. CFront Ends and MailersC
  36. │   1▌A
  37. C New SysOp Uploads               ▐A
  38. C 15▌ Sunrise DoorsCA
  39. C
  40. │   2▌ RemotA
  41. CeAccessC 16▌ A
  42. CWWIV Core Support FilesC
  43. │   3▌ WildcA
  44. Cat! FilesC 17▌ A
  45. CWWIV Utility ProgramsC
  46. │   4▌ PCBoaA
  47. Crd FilesC 18▌ A
  48. CWWIV Network ProgramsC
  49. │   5▌ PCBoaA
  50. Crd Files IIC 19▌ A
  51. CWWIV v4.23 Mods UploadsC
  52. │   6▌ GenerA
  53. Cal BBS Files IC 20A
  54. C▌ WWIV v4.23 Mods [A-L]C
  55. │   7▌ GenerA
  56. Cal BBS Files IIC 21A
  57. C▌ FMD Software SupportC
  58. │   8▌ GenerA
  59. Cal BBS Files IIIC 22A
  60. C▌ Asylum Mod SupportC
  61. │   9▌ BBS OA
  62. Cnline Programs IC 23A
  63. C▌ WWIV v4.23 Mods [M-Z]C
  64. │  10▌ BBS Online ProgA
  65. Crams IIC 24▌ A
  66. CWWIV Older Mods [A-L]C
  67. │  11▌ BBS Online ProgA
  68. Crams IIIC 25▌ A
  69. CWWIV Older Mods [M-Z]C
  70. │  12▌ BBS Online ProgA
  71. Crams IVC 26▌ A
  72. CWWIV Mod CollectionsC
  73. │  13▌ Mailer-related A
  74. CFilesC 27▌ StA
  75. Carport Valhalla ModsC
  76. ╘══════════════════════════════════════════════════════════════════════════A
  77. C══╛
  78. Select [0-27,J,?,Q]:
  79. D
  80.  
  81. 3.  Credits:  Inspired by Morgul's dirlist(), the best of many.  Morgul's took
  82. too much landscape with a few hundred file areas here, so I sought out a way
  83. to display the directories in a side-by-side format.  If I remember, there's
  84. still some code from The Flying Chicken, Analog Kid and Jim Wire (who all did
  85. excellent dirlist mods!)
  86.  
  87. 4.  Drawback:  The mod provides non-ANSI support, however no support for 40
  88. columns.  If your users still use 40 column mode(!), you'll have to use the
  89. old dirlist, too -- drop me a note if you need help there.
  90.  
  91. 5.  Mechanics:  The mod itself is mainly a single block copy, but we have to
  92. give dirlist a new prototype with a 'mode' parameter.  (Mode '0' does not
  93. prompt for a directory number, and is needed for moving files and the like.)
  94. When the directory list is called in mode '0', it displays CDROM directories
  95. in a subdued color (so you don't try to move files into them!)
  96.  
  97. 6.  Note for ListPlus users:  The Asylum ListPlus mod calls a dirlist in one
  98. or two places.  You need to change those calls from dirlist() to dirlist(0)
  99. or you'll get errors in compile!
  100.  
  101. Open <BBSOVL1.C>
  102.  
  103. At the top of the file, add these two new stock includes.  (For the curious,
  104. math.h includes the prototype for "ceiling" which determines the top limit of
  105. the number of directories, and ctype.h has prototypes for determining whether
  106. keyboard input is numeric, alphabetic, etc.)
  107.  
  108. == #include "ripint.h"
  109.  
  110. ++ #include <math.h>
  111. ++ #include <ctype.h>
  112.  
  113. == #define FRAME 7
  114.  
  115. Search for "void extract_mod(char *b, long len)" and change the line
  116. indicated:
  117.  
  118. ==  do {
  119. ==    prt(2,get_string(1198));
  120. ==    ss1=mmkey(1);
  121. ==    if (ss1[0]=='?')
  122. =+      dirlist(0);
  123. ==  } while ((!hangup) && (ss1[0]=='?'));
  124.  
  125. Now, search for "void dirlist(void)" and delete the entire function.  Replace
  126. it with the following:
  127.  
  128. void dirlist(int mode)
  129. {
  130.   int i, i1, i2, i3, i4, oc, nc, os, done, next, abort, ns, ns1, sn, en, tt;
  131.   int c1, c2, c3, c4;
  132.   char *num, ch, s[100], s1[100], s2[100], s3[100], s4[40];
  133.   double nsd;
  134.  
  135.   sn = 0;
  136.   i4 = 0;
  137.   next = 0;
  138.   oc = nc = curconfdir;
  139.   os = udir[curdir].subnum;
  140.   en = dirconfnum - 1;
  141.  
  142.   do {
  143.     abort = 0;
  144.     done = 0;
  145.     if (!i4) {
  146.       if (okconf(&thisuser)) {
  147.         if ((uconfdir[1].confnum != -1) && (!next)) {
  148.           nl();
  149.           prt(2, get_string(1019));
  150.           ch = onek("Q A");
  151.           nl();
  152.           switch (ch) {
  153.           case ' ':
  154.             sn = curconfdir;
  155.             en = curconfdir;
  156.             break;
  157.           case 'A':
  158.             mode = 0;
  159.             break;
  160.           case 'Q':
  161.             return;
  162.           }
  163.         }
  164.       } else
  165.         oc = -1;
  166.     } else {
  167.       sn = curconfdir;
  168.       en = curconfdir;
  169.     }
  170.     next = 1;
  171.     i = sn;
  172.     outchr(12);
  173.     nl();
  174.     while ((i <= en) && (uconfdir[i].confnum != -1) && (!abort)) {
  175.       if ((uconfdir[1].confnum != -1) && (okconf(&thisuser))) {
  176.         setuconf(CONF_DIRS, i, -1);
  177.         sprintf(s, "[ %s %c - %s ]", get_string(1021),
  178.            dirconfs[uconfdir[i].confnum].designator,
  179.           stripcolors(dirconfs[uconfdir[i].confnum].name));
  180.         if (okansi()) {
  181.           tt = (40 - (strlen(s) / 2));
  182.           npr("\x1B" "[0;1m%s\r\n", charstr(strlen(s) + (tt * 2 - 2), '▄'));
  183.           npr("\x1B" "[0;34;47m%s", charstr(tt, ' '));
  184.           npr("\x1B" "[0;34;47m%s", s);
  185.           npr("\x1B" "[0;34;47m%s\x1B" "[40m\r\n", charstr(tt - 2, ' '));
  186.           npr("\x1B" "[0;1;30m%s\r\n", charstr(strlen(s) + (tt * 2 - 2), '▀'));
  187.         } else {
  188.           for (i2 = 0; i2 < 78; i2++)
  189.             outchr(45);
  190.           nl();
  191.           prt(1, s);
  192.           nl();
  193.           for (i2 = 0; i2 < 78; i2++)
  194.             outchr(45);
  195.           nl();
  196.         }
  197.       } else {
  198.         sprintf(s, "[ %s File Directories ]", syscfg.systemname);
  199.         if (okansi()) {
  200.           tt = (40 - (strlen(s) / 2));
  201.           npr("\x1B" "[0;1m%s\r\n", charstr(strlen(s) + (tt * 2 - 2), '▄'));
  202.           npr("\x1B" "[0;34;47m%s", charstr(tt, ' '));
  203.           npr("\x1B" "[0;34;47m%s", s);
  204.           npr("\x1B" "[0;34;47m%s\x1B" "[40m\r\n", charstr(tt - 2, ' '));
  205.           npr("\x1B" "[0;1;30m%s\r\n", charstr(strlen(s) + (tt * 2 - 2), '▀'));
  206.         } else {
  207.           for (i2 = 0; i2 < 78; i2++)
  208.             outchr(45);
  209.           nl();
  210.           prt(1, s);
  211.           nl();
  212.           for (i2 = 0; i2 < 78; i2++)
  213.             outchr(45);
  214.           nl();
  215.         }
  216.       }
  217.       c1 = thisuser.colors[8];
  218.       thisuser.colors[8] = 1;
  219.       ansic(8);
  220.       if (okansi())
  221.         outchr(213);
  222.       else
  223.         outchr(43);
  224.       for (i2 = 1; i2 < 77; i2++)
  225.         if (okansi())
  226.           outchr(205);
  227.         else
  228.           outchr(45);
  229.       if (okansi())
  230.         outchr(184);
  231.       else
  232.         outchr(43);
  233.       nl();
  234.       thisuser.colors[8] = c1;
  235.       i1 = 0;
  236.       ns = 0;
  237.       while ((i1 <= num_dirs) && (ns == 0)) {
  238.         if ((udir[i1].subnum == -1) || (i1 == num_dirs))
  239.           ns = i1;
  240.         else
  241.           i1++;
  242.       }
  243.       ns1 = ns;
  244.       nsd = ceil(((double) ns) / 2);
  245.       ns = (int) nsd;
  246.       i3 = 0;
  247.       for (i1 = 0; ((i1 < ns) && (!abort) && (!hangup)); i1++) {
  248.         if (atoi(udir[i1].keys) == 0)
  249.           i3 = 1;
  250.         strcpy(s4, directories[udir[i1].subnum].name);
  251.         if (okansi()) {
  252.           if ((nc == oc) || (!okconf(&thisuser))) {
  253.             if (udir[i1].subnum == os) {
  254.               sprintf(s3, "%-30.30s", s4);
  255.               sprintf(s1, "8│ 0▐6%3s2▌4 %-30s",
  256.                 udir[i1].keys,
  257.                 s3);
  258.             } else {
  259.               sprintf(s3, "%-30.30s", s4);
  260.               sprintf(s1, "8│ 0▐6%3s2▌ %s%-30s",
  261.                 udir[i1].keys,
  262.                 ((mode == 2) ?
  263.                 ((directories[udir[i1].subnum].mask & mask_cdrom) ?
  264.                  "a" : "1") : "9"),
  265.                 s3);
  266.             }
  267.           } else {
  268.             sprintf(s3, "%-30.30s", s4);
  269.             sprintf(s1, "8│ 0▐6%3s2▌ %s%-30s",
  270.               udir[i1].keys,
  271.               ((mode == 2) ?
  272.               ((directories[udir[i1].subnum].mask & mask_cdrom) ?
  273.                "a" : "1") : "9"),
  274.               s3);
  275.           }
  276.         } else {
  277.           sprintf(s3, "%-30.30s", s4);
  278.           sprintf(s1, " %3s | %-30s", udir[i1].keys,
  279.             s3);
  280.         }
  281.         if ((udir[i1 + ns].subnum != -1)) {
  282.           strcpy(s4, directories[udir[i1 + ns].subnum].name);
  283.           if (okansi()) {
  284.             if (udir[i1 + ns].subnum == os) {
  285.               sprintf(s3, "%-30.30s", s4);
  286.               sprintf(s2, " 0▐6%3s2▌4 %-30s 8│",
  287.                 udir[i1 + ns].keys,
  288.                 s3);
  289.             } else {
  290.               sprintf(s3, "%-30.30s", s4);
  291.               sprintf(s2, " 0▐6%3s2▌ %s%-30s 8│",
  292.                 udir[i1 + ns].keys,
  293.                 ((mode == 2) ?
  294.                 ((directories[udir[i1 + ns].subnum].mask & mask_cdrom) ?
  295.                  "a" : "1") : "9"),
  296.                 s3);
  297.             }
  298.           } else {
  299.             sprintf(s3, "%-30.30s", s4);
  300.             sprintf(s2, "| %3s | %-30s",
  301.               udir[i1 + ns].keys,
  302.               s3, numf);
  303.           }
  304.           sprintf(s, "%35s %-35s", s1, s2);
  305.         } else {
  306.           if (okansi())
  307.             sprintf(s, "%-35s %s8│", s1, charstr(38, 32));
  308.           else
  309.             sprintf(s, "%-35s |     |", s1);
  310.         }
  311.         c1 = thisuser.colors[8];
  312.         c2 = thisuser.colors[6];
  313.         c3 = thisuser.colors[2];
  314.         c4 = thisuser.colors[0];
  315.         thisuser.colors[8] = 1;
  316.         thisuser.colors[2] = 8;
  317.         thisuser.colors[6] = 112;
  318.         thisuser.colors[0] = 15;
  319.         pla(s, &abort);
  320.         thisuser.colors[8] = c1;
  321.         thisuser.colors[6] = c2;
  322.         thisuser.colors[2] = c3;
  323.         thisuser.colors[0] = c4;
  324.       }
  325.       i++;
  326.       c1 = thisuser.colors[8];
  327.       thisuser.colors[8] = 1;
  328.       ansic(8);
  329.       if (okansi())
  330.         outchr(212);
  331.       else
  332.         outchr(43);
  333.       for (i2 = 1; i2 < 77; i2++)
  334.         if (okansi())
  335.           outchr(205);
  336.         else
  337.           outchr(45);
  338.       if (okansi())
  339.         outchr(190);
  340.       else
  341.         outchr(43);
  342.       nl();
  343.       thisuser.colors[8] = c1;
  344.       if (!okconf(&thisuser))
  345.         break;
  346.     }
  347.     if (i == 0) {
  348.       pla(get_string(5), &abort);
  349.       nl();
  350.     }
  351.     if ((!abort) && (mode == 1)) {
  352.       prt(2, "Select [");
  353.       sprintf(s, "%s-%d", i3 ? "0" : "1", i3 ? (ns1 - 1) : ns1);
  354.       ansic(1);
  355.       outstr(s);
  356.       i3 = 0;
  357.       if (okconf(&thisuser))
  358.         outstr(",J");
  359.       outstr(",?,Q2]: ");
  360.       num = mmkey(1);
  361.       if ((strcmp(num, "") == 0) || (strcmp(num, "Q") == 0)) {
  362.         if (okconf(&thisuser))
  363.           setuconf(CONF_DIRS, nc, 1);
  364.         done = 1;
  365.       }
  366.       if (((strcmp(num, "C") == 0) || ((strcmp(num, "J") == 0))) &&
  367.           (okconf(&thisuser))) {
  368.         i4 = 1;
  369.         jump_conf(CONF_DIRS);
  370.         nc = curconfdir;
  371.         done = 0;
  372.       }
  373.       if (isdigit(num[0])) {
  374.         for (i2 = 0; i2 < num_dirs; i2++) {
  375.           if (strcmp(udir[i2].keys, num) == 0) {
  376.             curdir = i2;
  377.             os = udir[curdir].subnum;
  378.             done = 1;
  379.           }
  380.         }
  381.       }
  382.     } else {
  383.       if (okconf(&thisuser))
  384.         setuconf(CONF_DIRS, oc, os);
  385.       done = 1;
  386.     }
  387.   } while ((!hangup) && (!done));
  388.   nl();
  389. }
  390.  
  391. Save <BBSOVL1.C>
  392.  
  393. Load <MMENU.C>
  394.  
  395. In "void dlmainmenu(void)" search for "dirlist" and change:
  396.  
  397. ==      case '*':
  398. ==#ifdef RIPDRIVE
  399. ==        rd_coff();
  400. ==#endif
  401. =+        dirlist(1);
  402. ==#ifdef RIPDRIVE
  403. ==        rd_con();
  404. ==#endif
  405. ==        break;
  406.  
  407. Save <MMENU.C>
  408.  
  409. Load <XFEROVL.C>
  410.  
  411. Search again for "dirlist" and change:
  412.  
  413. ==        prt(2,get_string(823));
  414. ==        ss=mmkey(1);
  415. ==        if (ss[0]=='?') {
  416. =+          dirlist(0);
  417. ==          dliscan();
  418. ==        }
  419.  
  420. Save <XFEROVL.C>
  421.  
  422. Open <XFERTMP.C>
  423.  
  424. Again, search for "dirlist" and change the line:
  425.  
  426. ==          prt(2,get_string(823));
  427. ==          ss=mmkey(1);
  428. ==          if (ss[0]=='?') {
  429. =+            dirlist(0);
  430. ==            dliscan1(batch[i2].dir);
  431. ==          }
  432.  
  433. Save <XFERTMP.C>
  434.  
  435. Load <FCNS.H>
  436.  
  437. This step is unnecessary if you use 'MAKE FCNS'.
  438.  
  439. Search for "dirlist" again, and change:
  440.  
  441. ==void sublist(void);
  442. =+void dirlist(int mode);
  443. ==void text_edit(void);
  444.  
  445. Save <FCNS.H>
  446.  
  447. Recompile and drop me a note to say you like it (or hate it!)
  448.  
  449. 4───────────────────────────────────────────────────────────────────────────────0
  450. 4  Eagle's Dare             WWIV Core Support Site               WWIVnet @8213  0
  451. 4  FILEnet @1160                  Laurel, MD                    TerraNet @3104  0
  452. 4  IceNET @3104                 (301) 498-1984               Fidonet 1:109/568  0
  453. 4───────────────────────────────────────────────────────────────────────────────0
  454.