r2 = r1;
static int generate_SF_file (char *manifile, char *who){  FILE *sf;  FILE *mf;  long r1, r2, r3;  char whofile [FNSIZE];  char *buf, *name;  JAR_Digest dig;  int line = 0;  strcpy (whofile, who);  if ((mf = fopen (manifile, "rb")) == NULL)    {    perror (manifile);    exit (ERRX);    }  if ((sf = fopen (whofile, "wb")) == NULL)    {    perror (who);    exit (ERRX);    }  buf = (char *) PORT_ZAlloc (BUFSIZ);  if (buf)    name = (char *) PORT_ZAlloc (BUFSIZ);  if (buf == NULL || name == NULL)    out_of_memory();  fprintf (sf, "Signature-Version: 1.0\n");  fprintf (sf, "Created-By: %s\n", CREATOR);  fprintf (sf, "Comments: %s\n", BREAKAGE);  if (fgets (buf, BUFSIZ, mf) == NULL)    {    PR_fprintf(errorFD, "%s: empty manifest file!\n", PROGRAM_NAME);	errorCount++;    exit (ERRX);    }  if (strncmp (buf, "Manifest-Version:", 17))    {    PR_fprintf(errorFD, "%s: not a manifest file!\n", PROGRAM_NAME);	errorCount++;    exit (ERRX);    }  fseek (mf, 0L, SEEK_SET);  /* Process blocks of headers, and calculate their hashen */  while (1)    {    /* Beginning range */    r1 = ftell (mf);    if (fgets (name, BUFSIZ, mf) == NULL)      break;    line++;    if (r1 != 0 && strncmp (name, "Name:", 5))      {      PR_fprintf(errorFD, "warning: unexpected input in manifest file \"%s\" at line %d:\n", manifile, line);      PR_fprintf(errorFD, "%s\n", name);		warningCount++;      }    while (fgets (buf, BUFSIZ, mf))      {      if (*buf == 0 || *buf == '\n' || *buf == '\r')        break;      line++;      /* Ending range for hashing */      r2 = ftell (mf);      }    r3 = ftell (mf);    if (r1)      {      fprintf (sf, "\n");      fprintf (sf, "%s", name);      }    calculate_MD5_range (mf, r1, r2, &dig);    if (optimize == 0)      {      fprintf (sf, "Digest-Algorithms: MD5 SHA1\n");      fprintf (sf, "MD5-Digest: %s\n",          BTOA_DataToAscii (dig.md5, MD5_LENGTH));      }    fprintf (sf, "SHA1-Digest: %s\n",        BTOA_DataToAscii (dig.sha1, SHA1_LENGTH));    /* restore normalcy after changing offset position */    fseek (mf, r3, SEEK_SET);    }  PORT_Free (buf);  PORT_Free (name);  fclose (sf);  fclose (mf);  return 0;}