home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol119 / lcrcknew.lbr / LCRCK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1985-02-10  |  1.4 KB  |  65 lines

  1. /*    LCRCK - version 1.2
  2.     Checks the "crc" of a library member.
  3.     The crc value computed by this program is compatible with the
  4.     one generated by CRCK44.
  5.     USE: LCRCK <library> <member>
  6.     COMPILE/LINK: cc1 lcrck
  7.               nl2 lcrck libacc crc
  8.     By S. Kluger 01-10-83
  9.     Modified 03-20-83 by Gary Novosielski
  10.         Changed do{}while to while{}
  11.         to properly handle null members.
  12.         Removed improper call to erxit.
  13. */
  14.  
  15. #include <bdscio.h>
  16.  
  17. char curdsk, crc, fcb[36];
  18. char fnam[12], libnam[16], dirbuf[128], *dirp;
  19. int fd, j, seccnt, lpc, dirsiz, filsiz;
  20.  
  21. main(argc,argv)
  22. int argc;
  23. char **argv;
  24. {
  25.     if (argc != 3)
  26.     {
  27.         printf("\nLCRCK crck check program for LBR file members.\n");
  28.         printf("Compatible with CRCK44.\n");
  29.         printf("USAGE: LCRCK <lbrname> <member>\n");
  30.         printf("Where: <lbrname> = name of .LBR file and\n");
  31.         printf("       <member> = full name of member file.\n");
  32.         printf("(Find <member> with LDIR.\n\n");
  33.         exit();
  34.     }
  35.     printf("\nLCRCK vers 1.2  03-20-83\n\n");
  36.     opnlib(argv[1]);
  37.     if (fndmem(argv[2]) == ERROR)
  38.     {
  39.         printf("\n%s not in LBR file!\n",argv[2]);
  40.         exit();
  41.     }
  42.     printf("\nMember %s\t\t-  ",argv[2]);
  43.     doit();
  44. }
  45.  
  46. doit()
  47.  
  48. {
  49.     unsigned sum;
  50.  
  51.     sum = 0;
  52.     dirsiz = filsiz;
  53.     while(dirsiz)
  54.     {
  55.         reload();
  56.         j = 127;
  57.         for (j=0; j<128; j++)
  58.         {
  59.             sum = updcrc(dirbuf[j],sum);
  60.             dirp++;
  61.         }
  62.     }
  63.     printf("CRC = %04x\n",sum);
  64. }
  65.