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

  1. Snorkel #1 @2100
  2. Wed Jun 07 10:43:22 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 00:26 WWIVnet 4001->4000
  8. 0R 34 06/08 08:22 WWIVnet 2001->4001
  9. 0R 34 06/07 11:03 WWIVnet 2100->2001
  10. 0R 34 06/07 10:58 WWIVnet ->2100
  11. ┌────────────────────────────────────────────────────────────────────────────┐
  12. │ Mod Name      : M&M009.MOD        Mod Author: Snorkel     1@2100 WWIVnet   │
  13. │ Difficulty    : █░░░░░░░░░        The M&M Factory [GSA]   1@3459 WWIVlink  │
  14. │ WWIV Version  : 4.24                                                       │
  15. │ Mod Date      : 6-3-95                                                     │
  16. │ Files Affected: BATCH.C, FCNS.H, SR.C, XFER.C, XFEROVL.C                   │
  17. │                                                                            │
  18. │ Description   : Places the size of the .GIF file at the beginning of the   │
  19. │                 file description.  Works either with the command \\UPLOAD  │
  20. │                 or when a remote user uploads a file with a .GIF extension.│
  21. │                 Also tells the sysop if the file is not a .GIF (in the     │
  22. │                 sysop log).                                                │
  23. │                                                                            │
  24. │                 (Re-write of GIFINFO.MOD for 4.24)                         │
  25. └────────────────────────────────────────────────────────────────────────────┘
  26. ╔════════════════════════════════════════════════════════════════════════════╗
  27. ║   This WWIV Source Code  modification  is  copyright  1995  by  Snorkel,   ║
  28. ║   System Operator of The M&M Factory BBS and is distributed as freeware.   ║
  29. ║   Permission is granted to distribute and post this modified code on BBS   ║
  30. ║   systems and online services, provided no alterations are made (removal   ║
  31. ║   of  message headers/taglines allowed).  This modified code may contain   ║
  32. ║   some parts of WWIV source code,  which is copyright 1988-1995 by Wayne   ║
  33. ║   Bell  and  licensed  only  to  registered  users of WWIV.  Use of WWIV   ║
  34. ║   source without registration constitutes a license violation and  could   ║
  35. ║   lead to legal prosecution.                                               ║
  36. ║                                                                            ║
  37. ║   Shareware  distributors  and CD-ROM publishers may not distribute this   ║
  38. ║   modified code without express written permission of the Author or WWIV   ║
  39. ║   Software Services.                                                       ║
  40. ╚════════════════════════════════════════════════════════════════════════════╝
  41.  
  42. I have changed the code in this mod to make it more efficient, and also to
  43. look for both the old .GIF format (GIF87a) and the new format (GIF89a).
  44. Additionally, I have added a bit of code to the mod (at the end) so that the
  45. file description is not longer than the comment field when the .GIF dimensions
  46. are added to the file description.  I would like to give the original author
  47. credit for this mod, since he did the hard part of actually writing the
  48. routines which read the size of the .GIF and append the description onto it.
  49. However, in the process of converting this mod over several times, I have lost
  50. the original author's name.
  51.  
  52. This is a simple mod that automatically adds, to the file description, the
  53. dimensions of any .GIF file that is uploaded to your board, remotely or
  54. locally.  The dimensions will be in the format of WWWxHHHxCCC, where WWW is
  55. the width, HHH is the height, and CCC is the number of colors used.  The
  56. output should look like this:
  57.  
  58.  
  59. WORF    .GIF:   21k :320x200x16  ... Lt. Worf of the USS Enterprise.
  60. ALYSA1  .GIF:   59k :320x200x256 ... Lovely brunette with VERY brown eyes.
  61. BRNCORAL.GIF:  173k :640x480x256 ... Brain coral, St. Thomas, U.S.V.I.
  62. SCHIFF05.GIF:   83k :800x600x256 ... Claudia Schiffer in a white swim suit.
  63. EHZS0034.GIF:  659k :1024x768x256 .. Great scan of colorful autumn leaves.
  64.  
  65.  
  66. There is 58 characters total for the description.  With the .GIF size added to
  67. the beginning, the amount of room left for the input of a description changes
  68. to 42 characters.
  69.  
  70. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  71. Step 1
  72.  
  73. FCNS.H
  74.  
  75. Add the following code where indicated.
  76.  
  77. /* File: sr.c */                               /* search for */
  78.  
  79. int getbytes(FILE *dev);                             /* ADD */
  80. void check_gif(char *fn, char *descript);            /* ADD */
  81. void calc_CRC(unsigned char b);
  82.  
  83.  
  84. Save FCNS.H
  85. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  86. Step 2
  87.  
  88. BATCH.C 
  89.  
  90. In function "void uploaded(char *fn, long cps)" add the following code:
  91.  
  92.             if (f1>=0) {                      /* search for */
  93.               u.numbytes = filelength(f1);
  94.               sh_close(f1);
  95.               if (strstr(u.filename,".GIF"))        /* ADD */
  96.                 check_gif(s2,u.description);        /* ADD */
  97.               get_file_idz(&u,batch[i1].dir);
  98.               ++thisuser.uploaded;
  99.  
  100.  
  101. Save BATCH.C
  102. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  103. Step 3
  104.  
  105. XFEROVL.C
  106.  
  107. In function "int upload_file(char *fn, int dn, char *desc)" add the following:
  108.  
  109. int upload_file(char *fn, int dn, char *desc)    /* search for */
  110. {
  111.   directoryrec d;
  112.   uploadsrec u,u1;
  113.   int i,f;                     /* ████  EXISTING LINE - DELETE  ████ */
  114.   int i,f,w;                                      /* ADD */
  115.   char s[81],ff[81];
  116.   long l;
  117.  
  118.  
  119.  
  120. Further down in the code, change as follows:
  121.  
  122.       u.description[58]=0;                /* search for */
  123.       pl(u.description);
  124.     } else                     /* ████  EXISTING LINE - DELETE  ████ */
  125.     } else {                                    /* ADD */
  126.       if(strstr(u.filename,".GIF"))             /* ADD */
  127.         w=42;                                   /* ADD */
  128.       else                                      /* ADD */
  129.         w=58;                                   /* ADD */
  130.       inputl(u.description,w);                  /* ADD */
  131.     }                                           /* ADD */
  132.       inputl(u.description,58);/* ████  EXISTING LINE - DELETE  ████ */
  133.     if (u.description[0]==0)
  134.       return(0);
  135.     get_file_idz(&u,dn);
  136.     if (strstr(u.filename,".GIF"))              /* ADD */
  137.       check_gif(ff,u.description);              /* ADD */
  138.     ++thisuser.uploaded;
  139.     if (!(d.mask & mask_cdrom))
  140.       modify_database(u.filename,1);
  141.  
  142.  
  143. Save XFEROVL.C
  144. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  145. Step 4
  146.  
  147. XFEROVL2.C
  148.  
  149. In function "void upload(int dn)" add or change as noted below:
  150.  
  151.   directoryrec d;                          /* search for */
  152.   uploadsrec u,u1;
  153.   int i,i1,i2,i3,i4,ok,xfer,f; /* ████  EXISTING LINE - DELETE  ████ */
  154.   int i,i1,i2,i3,i4,ok,xfer,f,w;            /* ADD */
  155.   char s[255],s1[81],*ss;
  156.   long l;
  157.   double ti;
  158.  
  159.  
  160. Now search for the following line, and add or change the code as indicated
  161. below:
  162.  
  163.       pl(get_string(779));                      /* search for */
  164.       if(strstr(u.filename,".GIF"))                     /* ADD */
  165.         w=42;                                           /* ADD */
  166.       else                                              /* ADD */
  167.         w=58;                                           /* ADD */
  168.       outstr(": ");
  169.       inputl(u.description,58);/* ████  EXISTING LINE - DELETE  ████ */
  170.       inputl(u.description,w);                          /* ADD */
  171.       nl();
  172.  
  173.  
  174. A little further down in the function, add the following code:
  175.  
  176.  
  177.               f=sh_open1(s1,O_RDONLY | O_BINARY);  /* search for */
  178.             }
  179.           }
  180.         }
  181.         if (ok) {
  182.           if (ok==1) {
  183.             l=filelength(f);
  184.             u.numbytes=l;
  185.             sh_close(f);
  186.             if (strstr(u.filename,".GIF"))                /* ADD */
  187.               check_gif(s1,u.description);                /* ADD */
  188.             ++thisuser.uploaded;
  189.             modify_database(u.filename,1);
  190.  
  191.  
  192. Save XFEROVL2.C
  193. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  194. Step 5
  195.  
  196. SR.C
  197.  
  198. Block copy the following two functions to the end of SR.C
  199.  
  200.  
  201. int getbytes(FILE *dev)                        /* begin block copy */
  202. {
  203.     int byte1;
  204.     int byte2;
  205.     int result;
  206.  
  207.     /* read bytes and shift over */
  208.  
  209.     byte1 = getc(dev);
  210.     byte2 = getc(dev);
  211.  
  212.     result = (byte2 << 8) | byte1;
  213.  
  214.     return result;
  215.  
  216. }
  217.  
  218. void check_gif(char *fn, char *descript)
  219. {
  220.   int byte1, bits_per_pix,colors,i;
  221.   unsigned int width;
  222.   unsigned int height;
  223.   FILE *in;
  224.   char s[81];
  225.  
  226.   in = fsh_open (fn, "rb");
  227.   for (i = 0; (i < 6); i++) s[i] = getc(in);
  228.   s[6] = '\0';
  229.   width = getbytes(in);
  230.   height = getbytes(in);
  231.   byte1 = getc(in);
  232.   fsh_close(in);
  233.   if((strcmp(s,"GIF87a")) && (strcmp(s,"GIF89a"))) {
  234.     sprintf(s,"%s -- NOT a GIF file.",fn);
  235.     sysoplog(s);
  236.     return;
  237.   }
  238.   bits_per_pix = byte1 & 0x07;
  239.   bits_per_pix++;
  240.   colors = 1 << bits_per_pix;
  241.   if((width<1000) && (height<1000))
  242.     sprintf(s,"%dx%dx%-3d ... %s",width,height,colors,descript);
  243.   else {
  244.     if((width>999) && (height>999))
  245.       sprintf(s,"%dx%dx%-3d . %s",width,height,colors,descript);
  246.     if(((width>999) && (height<1000)) || ((width<1000) && (height>999)))
  247.       sprintf(s,"%dx%dx%-3d .. %s",width,height,colors,descript);
  248.   }
  249.   strcpy(descript,s);
  250. }                                            /* end block copy */
  251.  
  252.  
  253. Save SR.C
  254. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  255.  
  256. And that's all! You should now recompile your entire BBS (do a "build all") 
  257. since you have added 2 new functions to FCNS.H.
  258.  
  259. If you have any questions about this mod, please feel free to write me at 
  260. 1@2100.WWIVnet or 1@3459.WWIVlink.
  261. 1
  262. 2       6>> 1The M&M Factory   7Host of2 The Scuba Forum   4Subtype SCUBA_F6 <<
  263. 3                   6US Robotics Dual Standard  300-28,800 bps0
  264. 4                  6V.34/V.FC/V.terbo/V.32/V.32bis/V.42/V.42bis0
  265. 5              4Over 2,800 files On-line and available for download0
  266. 6
  267.