home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1997 March / Simtel-MSDOS-Mar1997-CD2.iso / 00_info / simcvt.c < prev    next >
C/C++ Source or Header  |  1997-01-27  |  3KB  |  70 lines

  1. /******************************************************************************
  2.  
  3. Written by reynolds@sun.com                                     01/21/90
  4. Minor corrections to instructions and portability
  5.         davidsen@crdos1.crd.ge.com            02/23/90
  6.  
  7. This SIMCVT.C filter should convert Simtel.Net's "SIMIBM.IDX" file into a
  8. readable "SIMIBM.LST" that is compatible with the other convert programs,
  9. except for the run-date at the top of the output file.
  10.  
  11. This program, written in "C" should compile on both 4.3BSD Unix machines,
  12. as well as IBM/pc compatible machines.  It works on both VAXen, and Suns.
  13.  
  14. To Compile on Unix, type "cc -o simcvt SIMCVT.C" creating simcvt.
  15. To Compile on IBM/pcs, see your C manual that came with the compiler.
  16.  
  17. To run, type "simcvt < simibm.idx > simibm.lst
  18.  
  19. ******************************************************************************/
  20.  
  21. #include <stdio.h>
  22.  
  23. main()
  24.  
  25. {
  26. char  fs[10],dir[60],name[15],descr[60]; /* input variables */
  27. char  inputline[257];                    /* for initial read */
  28. int   rev,bits;                          /* input variables */
  29. long  length,date;                       /* input variables */
  30. char  lfs[10],ldir[60];                  /* stores last filesystem/directory */
  31. char  type;                              /* output variable for 'A' or 'B' */
  32. char  c;                                 /* picks off EOF,",linefeed */
  33.  
  34. printf("Simtel.Net Public Domain, Freeware and Shareware listing\n\n");
  35. printf("NOTE: Type B is Binary; Type A is ASCII\n");
  36.  
  37. inputline[256] = 0;
  38.  
  39. while (fgets(inputline, 256, stdin) != NULL)  {
  40.  
  41.    sscanf(inputline, 
  42.            "\"%[^\"]\",\"%[^\"]\",\"%[^\"]\",%d,%ld,%d,%ld,\"%[^\"]\"",
  43.             fs, dir, name, &rev, &length, &bits, &date, descr);
  44.  
  45.    type = 'B';                           /* Binary 8-bit */
  46.    if (bits == 7) type = 'A';            /* ASCII  7-bit */
  47.  
  48.    if (strcmp(ldir,dir) || strcmp(lfs,fs)) {  /* New Directory */
  49.       printf("\nDirectory %s%s\n",fs,dir);
  50.       printf(" Filename   Type Length   Date    Description\n");
  51.       printf("==============================================\n");
  52.       strcpy(ldir, dir);          /* Remember last directory with ldir  */
  53.       strcpy(lfs,fs);             /* Remember last file system with lfs */
  54.    }                              /* End of the New Directory routine   */
  55.  
  56.  
  57.    printf("%-12.12s  %c %7ld  %6ld  %s\n",name,type,length,date,descr);
  58.    }
  59. } /* end of main() program by Ray */
  60.  
  61. /*****************************************************************************
  62.  
  63.    This filter takes data in the following format:
  64. "simtelnet","/msdos/ada","ada-lrm2.arc",1,320086,8,890411,"The Ada Language Reference Manual reader (2/4)"
  65.  
  66.    And converts it to the following format:
  67. ada-lrm1.arc  B  231947  890411  The Ada Language Reference Manual reader (1/4)
  68.  
  69. *****************************************************************************/
  70.