home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1995 October / Simtel-MSDOS-Oct1995-CD1.iso / disc1 / filedocs / simcvt.c < prev    next >
C/C++ Source or Header  |  1995-06-24  |  3KB  |  77 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. Updated for SimTel Software Repository
  7.         w8sdz@SimTel.Coast.NET                11/01/93
  8. Updated for the Coast to Coast Software Repository
  9.         w8sdz@SimTel.Coast.NET                09/17/94
  10. Updated for the Coast to Coast primary mirror site
  11.         w8sdz@SimTel.Coast.NET                06/22/95
  12.  
  13. This SIMCVT.C filter should convert SimTel's "SIMIBM.IDX" file into a
  14. readable "SIMIBM.LST" that is compatible with the other convert programs,
  15. except for the run-date at the top of the output file.
  16.  
  17. This program, written in "C" should compile on both 4.3BSD Unix machines,
  18. as well as IBM/pc compatible machines.  It works on both VAXen, and Suns.
  19.  
  20. To Compile on Unix, type "cc -o simcvt SIMCVT.C" creating simcvt.
  21. To Compile on IBM/pcs, see your C manual that came with the compiler.
  22.  
  23. To run, type "simcvt < simibm.idx > simibm.lst
  24.  
  25. ******************************************************************************/
  26.  
  27. #include <stdio.h>
  28.  
  29. main()
  30.  
  31. {
  32. char  fs[10],dir[60],name[15],descr[60]; /* input variables */
  33. char  inputline[257];                    /* for initial read */
  34. int   rev,bits;                          /* input variables */
  35. long  length,date;                       /* input variables */
  36. char  lfs[10],ldir[60];                  /* stores last filesystem/directory */
  37. char  type;                              /* output variable for 'A' or 'B' */
  38. char  c;                                 /* picks off EOF,",linefeed */
  39.  
  40. printf("These files are available by anonymous FTP from the SimTel primary\n");
  41. printf("mirror site ftp.coast.net (205.137.48.28) and other mirrors.  See\n");
  42. printf("/SimTel/msdos/filedocs/download.inf for a list of all mirror sites.\n\n");
  43.  
  44. printf("NOTE: Type B is Binary; Type A is ASCII\n");
  45.  
  46. inputline[256] = 0;
  47.  
  48. while (fgets(inputline, 256, stdin) != NULL)  {
  49.  
  50.    sscanf(inputline, 
  51.            "\"%[^\"]\",\"%[^\"]\",\"%[^\"]\",%d,%ld,%d,%ld,\"%[^\"]\"",
  52.             fs, dir, name, &rev, &length, &bits, &date, descr);
  53.  
  54.    type = 'B';                           /* Binary 8-bit */
  55.    if (bits == 7) type = 'A';            /* ASCII  7-bit */
  56.  
  57.    if (strcmp(ldir,dir) || strcmp(lfs,fs)) {  /* New Directory */
  58.       printf("\nDirectory %s%s\n",fs,dir);
  59.       printf(" Filename   Type Length   Date    Description\n");
  60.       printf("==============================================\n");
  61.       strcpy(ldir, dir);          /* Remember last directory with ldir  */
  62.       strcpy(lfs,fs);             /* Remember last file system with lfs */
  63.    }                              /* End of the New Directory routine   */
  64.  
  65.  
  66.    printf("%-12.12s  %c %7ld  %6ld  %s\n",name,type,length,date,descr);
  67.    }
  68. } /* end of main() program by Ray */
  69.  
  70. /*****************************************************************************
  71.  
  72.    This filter takes data in the following format:
  73. "pub/","msdos/ada/","ada-lrm2.zip",1,201439,8,890411,"The Ada Language Reference Manual reader (2/4)"
  74.    And converts it to the following format:
  75. ada-lrm2.zip  B  201439  890411  The Ada Language Reference Manual reader (2/4)
  76. *****************************************************************************/
  77.