home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Aktief 1995 #3 / CDA3.iso / compress / qcom10.zip / QCOM.C < prev    next >
C/C++ Source or Header  |  1994-03-13  |  2KB  |  65 lines

  1. #include <stdio.h>
  2. #include <conio2.h>
  3. #include <dir.h>
  4. #include <fcntl.h>
  5. #include <dos.h>
  6. #include <io.h>
  7. #include <stdlib.h>
  8. #include <process.h>
  9.  
  10. void Usage(void);
  11.  
  12. void main(int argc, char *argv[])
  13. int done=0;
  14. struct ffblk dta;
  15. char mycomm[11], MYCOMM[11], TO_EXE[100];
  16. FILE *fp;
  17.  
  18.     if(argc==1 || strstr(argv[1], "?")) Usage();
  19.  
  20.   if((fp=fopen(argv[1], "rb"))==NULL){ printf("\n Error opening %s", argv[1]); exit(1); }
  21.   fseek(fp, -9L, SEEK_END);
  22.   fgets(MYCOMM, 9, fp);
  23.   fclose(fp);
  24.  
  25.  
  26. done=findfirst("*.ZIP", &dta, 0);
  27. while(!done)
  28.   {
  29.  
  30.   if((fp=fopen(dta.ff_name, "rb"))==NULL)
  31.     {   printf("\nProblems opening %s\n", dta.ff_name);  exit(1);   }
  32.  
  33.   printf("\n  %s", dta.ff_name);
  34.  
  35.   fseek(fp, -10L, SEEK_END);
  36.   fread(mycomm, 10, 1, fp);
  37.   if(!strstr(mycomm, MYCOMM))
  38.      {
  39.        printf(" --> Added %s", argv[1]);
  40.        sprintf(TO_EXE, "PKZIP -z %s < %s", dta.ff_name, argv[1]);
  41.        system(TO_EXE);
  42.      }
  43.   fclose(fp);
  44.  
  45.    done=findnext(&dta);
  46.   }
  47.   
  48. }
  49.  
  50.  
  51. void Usage(void)
  52. {
  53.     printf("\n  QCOM [ The Quick .ZIP Commenter ]");
  54.     printf("\n\n  Doesn't comment the .ZIP unless it NEEDS to!");
  55.     printf("\n  Freeware from the maker of STEALTH : David Smith");
  56.     printf("\n\n  Usage:   QCOM [commentfile]");
  57.     printf("\n\n           QCOM c:\comment.txt");
  58.     printf("\n           QCOM d:\pcb\comment.pcb");
  59.     printf("\n           QCOM d:\wc30\comment.bbs");
  60.     printf("\n\n  FREEWARE - Of Course: Source is included");
  61.     exit(0);
  62. }
  63.  
  64.