home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / bbs / lora / l2febbs / l2febbs.c < prev    next >
C/C++ Source or Header  |  1993-10-22  |  2KB  |  141 lines

  1.  
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6.  
  7. #include "f2lfunz.h"
  8.  
  9.  
  10. typedef unsigned short bit;
  11. typedef unsigned short word;
  12. typedef unsigned char  byte;
  13. typedef long           dword;
  14.  
  15.  
  16. #include "sb116.h"
  17.  
  18.  
  19. #define LORASIZE    0x280
  20. struct _lora
  21.     {
  22.      char  file_name[70];     /* File area name */
  23.      short file_num;          /* File area number */
  24.      char  uppath[40];        /* Upload path */
  25.      char  filepath[40];      /* Download path */
  26.      char  filelist[50];      /* CD-ROM list file name */
  27.      char filler[LORASIZE-(70+2+40+40+50)];
  28.  
  29.     } lora;
  30.  
  31.  
  32. struct FLSearchRec fbbs;
  33.  
  34.  
  35. #define MAXLEN    100
  36.  
  37.  
  38. char lorapath[MAXLEN];
  39.  
  40.  
  41.  
  42.  
  43.  
  44. int main(int argc, char **argv)
  45. {
  46.  FILE *fin;
  47.  FILE *fout;
  48.  
  49.  char in[MAXLEN];
  50.  char out[MAXLEN];
  51.  char a[MAXLEN];
  52.  
  53.  
  54.  puts("\nL2FEBBS V1.00");
  55.  puts("Written by Maurizio Giunti (2:332/102.3@fidonet.org)");
  56.  puts("This utility is FREEWARE: copy and use it freely.\n");
  57.  
  58.  
  59.  if(argc!=2)
  60.     {
  61.      puts("Usage:");
  62.      puts("       L2FEBBS <Lora_path>");
  63.      return 0;
  64.     }
  65.  
  66.  Slash(strcpy(lorapath,argv[1]));
  67.  
  68.  sprintf(in,"%sSYSFILE.DAT",lorapath);
  69.  sprintf(out,"%sFLSEARCH.BBS",lorapath);
  70.  
  71.  
  72.  if((fin=fopen(in,"rb"))==NULL)
  73.     {
  74.      puts("Can't open INPUT file !");
  75.     }
  76.  if((fout=fopen(out,"wb"))==NULL)
  77.     {
  78.      puts("Can't open OUTPUT file !");
  79.      fclose(fin);
  80.      return 0;
  81.     }
  82.  
  83.  
  84.  while(fread((void *)&lora,LORASIZE,1,fin)==1)
  85.     {
  86.      if(feof(fin)) break;
  87.      if(lora.file_name[0]=='\0') continue;
  88.  
  89.      // Opera la conversione e la copia dei dati
  90.  
  91.      strcpy(a,lora.file_name);
  92.      a[60]='\0';
  93.      C2P(fbbs.Name,a);
  94.  
  95.      puts(a);
  96.  
  97.      C2P(fbbs.Directory,NoSlash(lora.filepath));
  98.  
  99.      fbbs.Security=0;
  100.      fbbs.Flags=0;
  101.      fbbs.PFilesSec=0;
  102.      fbbs.PFlags=0;
  103.      fbbs.Attrib=0;
  104.      fbbs.Age=0;
  105.      //fbbs.ListName[0]=0;
  106.      C2P(fbbs.ListName,NoSlash(lora.filelist));
  107.  
  108.      // Scrive area
  109.      fwrite((void *)&fbbs,sizeof(struct FLSearchRec),1,fout);
  110.  
  111.  
  112.      if(*lora.uppath!='\0')
  113.         {
  114.          // Se c'e' una dir di upload la usa
  115.          a[55]='\0';
  116.          strcat(a," (UP)");
  117.          puts(a);
  118.          C2P(fbbs.Name,a);
  119.          C2P(fbbs.Directory,lora.uppath);
  120.          fbbs.ListName[0]=0;
  121.          fwrite((void *)&fbbs,sizeof(struct FLSearchRec),1,fout);
  122.         }
  123.  
  124.  
  125.  
  126.  
  127.     }
  128.  
  129.  
  130.  fclose(fout);
  131.  fclose(fin);
  132.  
  133.  return 0;
  134. }
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.